-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With this pr, several files where seperated and refactored in order to improve readability and general code quality Also removed usage of deprecated kustomize functionality
- Loading branch information
dvirgilad
committed
May 22, 2024
1 parent
f655858
commit 733d930
Showing
13 changed files
with
477 additions
and
459 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ kind: Kustomization | |
images: | ||
- name: controller | ||
newName: controller | ||
newTag: latest | ||
newTag: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package finalizer | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/dana-team/nfspvc-operator/internal/controller/utils" | ||
|
||
danaiov1alpha1 "github.com/dana-team/nfspvc-operator/api/v1alpha1" | ||
"sigs.k8s.io/controller-runtime/pkg/client" | ||
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" | ||
) | ||
|
||
// Remove removes a finalizer from the nfspvc object. | ||
func Remove(ctx context.Context, nfspvc danaiov1alpha1.NfsPvc, k8sClient client.Client) error { | ||
controllerutil.RemoveFinalizer(&nfspvc, utils.NfsPvcDeletionFinalizer) | ||
if err := k8sClient.Update(ctx, &nfspvc); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
// Ensure adds a finalizer to the nfspvc object if one does not exist. | ||
func Ensure(ctx context.Context, nfspvc danaiov1alpha1.NfsPvc, k8sClient client.Client) error { | ||
if !controllerutil.ContainsFinalizer(&nfspvc, utils.NfsPvcDeletionFinalizer) { | ||
controllerutil.AddFinalizer(&nfspvc, utils.NfsPvcDeletionFinalizer) | ||
if err := k8sClient.Update(ctx, &nfspvc); err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.