mirror of
https://github.com/storytold/irsa-manager.git
synced 2026-10-09 00:09:43 +00:00
fix deletion logic (when cleanup is false)
This commit is contained in:
@@ -18,7 +18,6 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
ctrl "sigs.k8s.io/controller-runtime"
|
ctrl "sigs.k8s.io/controller-runtime"
|
||||||
@@ -105,6 +104,11 @@ func (r *IRSASetupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
|
|||||||
|
|
||||||
if !obj.DeletionTimestamp.IsZero() {
|
if !obj.DeletionTimestamp.IsZero() {
|
||||||
err = r.reconcileDelete(ctx, obj, kubeClient)
|
err = r.reconcileDelete(ctx, obj, kubeClient)
|
||||||
|
if err != nil {
|
||||||
|
return ctrl.Result{}, err
|
||||||
|
}
|
||||||
|
controllerutil.RemoveFinalizer(obj, irsamanagerFinalizer)
|
||||||
|
err = r.Update(ctx, obj)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Info("successfully deleted")
|
log.Info("successfully deleted")
|
||||||
}
|
}
|
||||||
@@ -149,14 +153,7 @@ func (r *IRSASetupReconciler) reconcileDelete(ctx context.Context, obj *irsav1al
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = selfhosted.Delete(ctx, factory)
|
return selfhosted.Delete(ctx, factory)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !controllerutil.RemoveFinalizer(obj, irsamanagerFinalizer) {
|
|
||||||
return errors.New("failed to remove finalizer")
|
|
||||||
}
|
|
||||||
return r.Update(ctx, obj)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconcileSelfhosted ensures that the self-hosted resources are set up correctly.
|
// reconcileSelfhosted ensures that the self-hosted resources are set up correctly.
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ func (b *baseManifestFactory) deployment() *appsv1.Deployment {
|
|||||||
{
|
{
|
||||||
Name: "pod-identity-webhook",
|
Name: "pod-identity-webhook",
|
||||||
Image: "amazon/amazon-eks-pod-identity-webhook:latest",
|
Image: "amazon/amazon-eks-pod-identity-webhook:latest",
|
||||||
|
|
||||||
ImagePullPolicy: corev1.PullAlways,
|
ImagePullPolicy: corev1.PullAlways,
|
||||||
// Command: []string{}, // Command must be patched
|
// Command: []string{}, // Command must be patched
|
||||||
VolumeMounts: []corev1.VolumeMount{
|
VolumeMounts: []corev1.VolumeMount{
|
||||||
|
|||||||
Reference in New Issue
Block a user