mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-18 07:33:15 +00:00
secret deletion
This commit is contained in:
@@ -3,11 +3,7 @@ package kubernetes
|
||||
import (
|
||||
"context"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
|
||||
)
|
||||
|
||||
func NewKubernetesClient(c client.Client, owner Owner) (*KubernetesClient, error) {
|
||||
@@ -22,19 +18,10 @@ func (h KubernetesClient) Apply(ctx context.Context, obj client.Object) error {
|
||||
client.ForceOwnership,
|
||||
client.FieldOwner(h.owner.Field),
|
||||
}
|
||||
gvk, err := apiutil.GVKForObject(obj, h.client.Scheme())
|
||||
u, err := h.toUnstructured(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u := &unstructured.Unstructured{}
|
||||
unstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
u.Object = unstructured
|
||||
u.SetGroupVersionKind(gvk)
|
||||
u.SetManagedFields(nil)
|
||||
err = h.client.Patch(ctx, u, client.Apply, opts...)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -48,18 +35,10 @@ func (h KubernetesClient) PatchStatus(ctx context.Context, obj client.Object) er
|
||||
FieldManager: h.owner.Field,
|
||||
},
|
||||
}
|
||||
gvk, err := apiutil.GVKForObject(obj, h.client.Scheme())
|
||||
u, err := h.toUnstructured(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u := &unstructured.Unstructured{}
|
||||
unstructured, err := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
u.Object = unstructured
|
||||
u.SetGroupVersionKind(gvk)
|
||||
u.SetManagedFields(nil)
|
||||
return h.client.Status().Patch(ctx, u, client.Apply, opts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user