Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,7 @@ func (r *{{ .Resource.Kind }}Reconciler) Reconcile(ctx context.Context, req ctrl
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers
if !controllerutil.ContainsFinalizer({{ lower .Resource.Kind }}, {{ lower .Resource.Kind }}Finalizer) {
log.Info("Adding Finalizer for {{ .Resource.Kind }}")
if ok := controllerutil.AddFinalizer({{ lower .Resource.Kind }}, {{ lower .Resource.Kind }}Finalizer); !ok {
err = fmt.Errorf("finalizer for {{ .Resource.Kind }} was not added")
log.Error(err, "Failed to add finalizer for {{ .Resource.Kind }}")
return ctrl.Result{}, err
}

controllerutil.AddFinalizer({{ lower .Resource.Kind }}, {{ lower .Resource.Kind }}Finalizer)
if err = r.Update(ctx, {{ lower .Resource.Kind }}); err != nil {
log.Error(err, "Failed to update custom resource to add finalizer")
return ctrl.Result{}, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ func (r *BusyboxReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers
if !controllerutil.ContainsFinalizer(busybox, busyboxFinalizer) {
log.Info("Adding Finalizer for Busybox")
if ok := controllerutil.AddFinalizer(busybox, busyboxFinalizer); !ok {
err = fmt.Errorf("finalizer for Busybox was not added")
log.Error(err, "Failed to add finalizer for Busybox")
return ctrl.Result{}, err
}

controllerutil.AddFinalizer(busybox, busyboxFinalizer)
if err = r.Update(ctx, busybox); err != nil {
log.Error(err, "Failed to update custom resource to add finalizer")
return ctrl.Result{}, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers
if !controllerutil.ContainsFinalizer(memcached, memcachedFinalizer) {
log.Info("Adding Finalizer for Memcached")
if ok := controllerutil.AddFinalizer(memcached, memcachedFinalizer); !ok {
err = fmt.Errorf("finalizer for Memcached was not added")
log.Error(err, "Failed to add finalizer for Memcached")
return ctrl.Result{}, err
}

controllerutil.AddFinalizer(memcached, memcachedFinalizer)
if err = r.Update(ctx, memcached); err != nil {
log.Error(err, "Failed to update custom resource to add finalizer")
return ctrl.Result{}, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ func (r *BusyboxReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers
if !controllerutil.ContainsFinalizer(busybox, busyboxFinalizer) {
log.Info("Adding Finalizer for Busybox")
if ok := controllerutil.AddFinalizer(busybox, busyboxFinalizer); !ok {
err = fmt.Errorf("finalizer for Busybox was not added")
log.Error(err, "Failed to add finalizer for Busybox")
return ctrl.Result{}, err
}

controllerutil.AddFinalizer(busybox, busyboxFinalizer)
if err = r.Update(ctx, busybox); err != nil {
log.Error(err, "Failed to update custom resource to add finalizer")
return ctrl.Result{}, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,7 @@ func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/finalizers
if !controllerutil.ContainsFinalizer(memcached, memcachedFinalizer) {
log.Info("Adding Finalizer for Memcached")
if ok := controllerutil.AddFinalizer(memcached, memcachedFinalizer); !ok {
err = fmt.Errorf("finalizer for Memcached was not added")
log.Error(err, "Failed to add finalizer for Memcached")
return ctrl.Result{}, err
}

controllerutil.AddFinalizer(memcached, memcachedFinalizer)
if err = r.Update(ctx, memcached); err != nil {
log.Error(err, "Failed to update custom resource to add finalizer")
return ctrl.Result{}, err
Expand Down
Loading