Skip to content

Commit

Permalink
Merge pull request #103 from red-hat-storage/sync_us--main
Browse files Browse the repository at this point in the history
Syncing latest changes from upstream main for kubernetes-csi-addons
  • Loading branch information
openshift-merge-bot[bot] authored Nov 18, 2023
2 parents 8bcee0e + 209424e commit 7774294
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ updates:
patterns:
- "github.com/golang*"
- "google.golang.org/*"
- "golang.org/x/*"
k8s-dependencies:
patterns:
- "k8s.io*"
Expand Down
8 changes: 8 additions & 0 deletions apis/csiaddons/v1alpha1/networkfence_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ const (
FencingOperationResultFailed FencingOperationResult = "Failed"
)

const (
// FenceOperationSuccessfulMessage represents successful message on fence operation
FenceOperationSuccessfulMessage = "fencing operation successful"

// UnFenceOperationSuccessfulMessage represents successful message on unfence operation
UnFenceOperationSuccessfulMessage = "unfencing operation successful"
)

// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="secret is immutable"
// SecretSpec defines the secrets to be used for the network fencing operation.
type SecretSpec struct {
Expand Down
10 changes: 9 additions & 1 deletion controllers/csiaddons/networkfence_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,15 @@ func (r *NetworkFenceReconciler) Reconcile(ctx context.Context, req ctrl.Request
return ctrl.Result{}, err
}

err = nf.updateStatus(ctx, csiaddonsv1alpha1.FencingOperationResultSucceeded, "fencing operation successful")
var successMsg string
switch nf.instance.Spec.FenceState {
case csiaddonsv1alpha1.Fenced:
successMsg = csiaddonsv1alpha1.FenceOperationSuccessfulMessage
case csiaddonsv1alpha1.Unfenced:
successMsg = csiaddonsv1alpha1.UnFenceOperationSuccessfulMessage
}

err = nf.updateStatus(ctx, csiaddonsv1alpha1.FencingOperationResultSucceeded, successMsg)
if err != nil {
logger.Error(err, "failed to update status")
return ctrl.Result{}, err
Expand Down

0 comments on commit 7774294

Please sign in to comment.