Skip to content

Commit

Permalink
added break in for loop and comments
Browse files Browse the repository at this point in the history
Signed-off-by: shubham <[email protected]>
  • Loading branch information
shubham14bajpai committed Jan 29, 2020
1 parent f74b5e2 commit 889826b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/webhook/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,16 +436,24 @@ func GetAdmissionReference() (*metav1.OwnerReference, error) {
return nil, fmt.Errorf("failed to create deployment ownerReference")
}

// addCSPCDeleteRule adds the DELETE operation to for CSPC if coming from 1.6.0
// or older version
func addCSPCDeleteRule(config *v1beta1.ValidatingWebhookConfiguration) {
if config.Labels[string(apis.OpenEBSVersionKey)] < "1.7.0" {
index := -1
// find the index of the RuleWithOperations having CSPC
for i, rule := range config.Webhooks[0].Rules {
if util.ContainsString(rule.Rule.Resources, "cstorpoolclusters") {
index = i
break
}
}
// if CSPC RuleWithOperations is found append DELETE operation
if index != -1 {
config.Webhooks[0].Rules[index].Operations = append(config.Webhooks[0].Rules[index].Operations, v1beta1.Delete)
config.Webhooks[0].Rules[index].Operations = append(
config.Webhooks[0].Rules[index].Operations,
v1beta1.Delete,
)
}
}
}
Expand Down

0 comments on commit 889826b

Please sign in to comment.