Skip to content

Commit

Permalink
fix: remove setting requests default
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Sestito <fabrizio.sestito@suse.com>
  • Loading branch information
fabriziosestito committed Apr 10, 2024
1 parent f0dbeaa commit 53a129b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
10 changes: 0 additions & 10 deletions pkg/apis/policies/v1/policyserver_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ func (ps *PolicyServer) Default() {
if ps.ObjectMeta.DeletionTimestamp == nil {
controllerutil.AddFinalizer(ps, constants.KubewardenFinalizer)
}

// Default the requests to the limits if not set
for limitName, limitQuantity := range ps.Spec.Limits {
if _, found := ps.Spec.Requests[limitName]; !found {
if ps.Spec.Requests == nil {
ps.Spec.Requests = make(corev1.ResourceList)
}
ps.Spec.Requests[limitName] = limitQuantity
}
}
}

// +kubebuilder:webhook:path=/validate-policies-kubewarden-io-v1-policyserver,mutating=false,failurePolicy=fail,sideEffects=None,groups=policies.kubewarden.io,resources=policyservers,verbs=create;update,versions=v1,name=vpolicyserver.kb.io,admissionReviewVersions=v1
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/policies/v1/policyserver_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ func TestDefault(t *testing.T) {
policyServer.Default()

assert.Contains(t, policyServer.Finalizers, constants.KubewardenFinalizer)
assert.Equal(t, corev1.ResourceList{
"cpu": resource.MustParse("100m"),
"memory": resource.MustParse("1Gi"),
}, policyServer.Spec.Requests)
}

func TestValidatePolicyServerName(t *testing.T) {
Expand Down

0 comments on commit 53a129b

Please sign in to comment.