mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
secret deletion
This commit is contained in:
@@ -4,13 +4,12 @@ import (
|
||||
"context"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
type KubernetesClient interface {
|
||||
Apply(ctx context.Context, obj client.Object) error
|
||||
Delete(ctx context.Context, obj *unstructured.Unstructured, opts DeleteOptions) error
|
||||
Delete(ctx context.Context, obj client.Object, opts DeleteOptions) error
|
||||
}
|
||||
|
||||
// DeleteOptions contains options for delete requests.
|
||||
|
||||
@@ -3,6 +3,7 @@ package handler
|
||||
import (
|
||||
"context"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
@@ -31,3 +32,15 @@ func (k *KubernetesHandler) ApplyAll(ctx context.Context) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (k *KubernetesHandler) DeleteAll(ctx context.Context) error {
|
||||
for _, obj := range k.objs {
|
||||
err := k.client.Delete(ctx, obj, DeleteOptions{
|
||||
DeletionPropagation: metav1.DeletePropagationBackground,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user