Skip to content

Commit

Permalink
allow to remove a sriovPool named default
Browse files Browse the repository at this point in the history
we allow any name for the pool policy

Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Jul 25, 2024
1 parent 18c4695 commit e142088
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions pkg/webhook/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ func validateSriovNetworkPoolConfig(cr *sriovnetworkv1.SriovNetworkPoolConfig, o
log.Log.V(2).Info("validateSriovNetworkPoolConfig", "object", cr)
var warnings []string

if cr.GetName() == consts.DefaultConfigName && operation == v1.Delete {
return false, warnings, fmt.Errorf("default SriovOperatorConfig shouldn't be deleted")
}

if (cr.Spec.MaxUnavailable != nil || cr.Spec.NodeSelector != nil) && cr.Spec.OvsHardwareOffloadConfig.Name != "" {
return false, warnings, fmt.Errorf("SriovOperatorConfig can't have both parallel configuration and OvsHardwareOffloadConfig")
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/webhook/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ func TestValidateSriovNetworkPoolConfigWithDefault(t *testing.T) {
snclient = fakesnclientset.NewSimpleClientset()

ok, _, err := validateSriovNetworkPoolConfig(config, "DELETE")
g.Expect(err).To(HaveOccurred())
g.Expect(ok).To(Equal(false))
g.Expect(err).ToNot(HaveOccurred())
g.Expect(ok).To(Equal(true))

ok, _, err = validateSriovNetworkPoolConfig(config, "UPDATE")
g.Expect(err).NotTo(HaveOccurred())
Expand Down

0 comments on commit e142088

Please sign in to comment.