@@ -33,50 +33,40 @@ type Client interface {
33
33
// This is a blocking call, it should only return once the deployment has completed.
34
34
DeploymentRestart (ctx context.Context , namespace , name string ) error
35
35
36
- // IngressCreate creates an ingress in the given namespace
36
+ EventsWatch (ctx context.Context , namespace string ) (watch.Interface , error )
37
+
37
38
IngressCreate (ctx context.Context , namespace string , ingress * networkingv1.Ingress ) error
38
- // IngressExists returns true if the ingress exists in the namespace, false otherwise.
39
39
IngressExists (ctx context.Context , namespace string , ingress string ) bool
40
- // IngressUpdate updates an existing ingress in the given namespace
41
40
IngressUpdate (ctx context.Context , namespace string , ingress * networkingv1.Ingress ) error
42
41
43
- // NamespaceCreate creates a namespace
42
+ LogsGet (ctx context.Context , namespace string , name string ) (string , error )
43
+
44
44
NamespaceCreate (ctx context.Context , namespace string ) error
45
- // NamespaceExists returns true if the namespace exists, false otherwise
46
45
NamespaceExists (ctx context.Context , namespace string ) bool
47
- // NamespaceDelete deletes the existing namespace
48
46
NamespaceDelete (ctx context.Context , namespace string ) error
49
47
50
- // PersistentVolumeCreate creates a persistent volume
51
48
PersistentVolumeCreate (ctx context.Context , namespace , name string ) error
52
- // PersistentVolumeExists returns true if the persistent volume exists, false otherwise
53
49
PersistentVolumeExists (ctx context.Context , namespace , name string ) bool
54
- // PersistentVolumeDelete deletes the existing persistent volume
55
50
PersistentVolumeDelete (ctx context.Context , namespace , name string ) error
56
51
57
- // PersistentVolumeClaimCreate creates a persistent volume claim
58
52
PersistentVolumeClaimCreate (ctx context.Context , namespace , name , volumeName string ) error
59
- // PersistentVolumeClaimExists returns true if the persistent volume claim exists, false otherwise
60
53
PersistentVolumeClaimExists (ctx context.Context , namespace , name , volumeName string ) bool
61
- // PersistentVolumeClaimDelete deletes the existing persistent volume claim
62
54
PersistentVolumeClaimDelete (ctx context.Context , namespace , name , volumeName string ) error
63
55
64
- // SecretCreateOrUpdate will update or create the secret name with the payload of data in the specified namespace
56
+ PodList (ctx context.Context , namespace string ) (* corev1.PodList , error )
57
+
65
58
SecretCreateOrUpdate (ctx context.Context , secret corev1.Secret ) error
66
- // SecretGet returns the secrets for the namespace and name
59
+ // SecretDeleteCollection deletes multiple secrets.
60
+ // Note this takes a `type` and not a `name`. All secrets matching this type will be removed.
61
+ SecretDeleteCollection (ctx context.Context , namespace , _type string ) error
67
62
SecretGet (ctx context.Context , namespace , name string ) (* corev1.Secret , error )
68
63
69
- // ServiceGet returns the service for the given namespace and name
70
64
ServiceGet (ctx context.Context , namespace , name string ) (* corev1.Service , error )
71
65
66
+ StreamPodLogs (ctx context.Context , namespace string , podName string , since time.Time ) (io.ReadCloser , error )
67
+
72
68
// ServerVersionGet returns the kubernetes version.
73
69
ServerVersionGet () (string , error )
74
-
75
- EventsWatch (ctx context.Context , namespace string ) (watch.Interface , error )
76
-
77
- LogsGet (ctx context.Context , namespace string , name string ) (string , error )
78
- StreamPodLogs (ctx context.Context , namespace string , podName string , since time.Time ) (io.ReadCloser , error )
79
- PodList (ctx context.Context , namespace string ) (* corev1.PodList , error )
80
70
}
81
71
82
72
var _ Client = (* DefaultK8sClient )(nil )
@@ -289,6 +279,13 @@ func (d *DefaultK8sClient) SecretCreateOrUpdate(ctx context.Context, secret core
289
279
return fmt .Errorf ("unexpected error while handling the secret %s: %w" , name , err )
290
280
}
291
281
282
+ func (d * DefaultK8sClient ) SecretDeleteCollection (ctx context.Context , namespace , _type string ) error {
283
+ listOptions := metav1.ListOptions {
284
+ FieldSelector : "type=" + _type ,
285
+ }
286
+ return d .ClientSet .CoreV1 ().Secrets (namespace ).DeleteCollection (ctx , metav1.DeleteOptions {}, listOptions )
287
+ }
288
+
292
289
func (d * DefaultK8sClient ) SecretGet (ctx context.Context , namespace , name string ) (* corev1.Secret , error ) {
293
290
secret , err := d .ClientSet .CoreV1 ().Secrets (namespace ).Get (ctx , name , metav1.GetOptions {})
294
291
if err != nil {
0 commit comments