kubewarden / container-resources-policy

Policy is designed to enforce constraints on the resource requirements of Kubernetes containers
https://kubewarden.io
Apache License 2.0
0 stars 4 forks source link

Cannot Deploy with empty Memory settings #26

Closed TechDufus closed 7 months ago

TechDufus commented 7 months ago

Is there an existing issue for this?

Current Behavior

When deploying with the following settings via the UI:

settings:
    cpu:
      defaultLimit: 500m
      defaultRequest: 50m
      maxLimit: 2000m
    memory: {}

image

I get this error from the new policy server trying to spin up:

policy-server-default Error: [clusterwide-max-requests-limits] settings are not valid: Some("Provided settings are not valid: invalid memory settings all the quantities must be defined")

Expected Behavior

I should be able to ONLY set CPU settings via the Rancher / Kubewarden UI and have the policy server successfully redeploy.

Steps To Reproduce

Steps provided above.

Environment

Versions:
- Rancher: 2.8.2
- K8s: v1.25.16+rke2r1
- Kubewarden App Version: v1.11.0
- Kubewarden Rancher Extension: 1.4.0

Anything else?

No response

viccuad commented 7 months ago

As a workaround, you can click on "edit YAML", and remove the empty settings.memory key.

viccuad commented 7 months ago

This would be a good moment to revisit questions-ui.yml and add support for settings.memory.ignoreValues and settings.cpu.ignoreValues.

For testing, it may be useful to create an empty chart with the needed questions-ui.yml. If not, one needs to publish a fork of the policy into artifacthub.

kravciak commented 7 months ago

Hi, pls how did you generate YAML in your description? There was a bug in previous UI versions, but it was fixed. When I create policy in UI extension v1.4.0 and switch to Edit YAML tab, I get this:

  # Filled only CPU values in policy settings tab
  settings:
    cpu:
      defaultRequest: '100'
      defaultLimit: '100'
      maxLimit: '100'
    memory:
      defaultRequest: ''
      defaultLimit: ''
      maxLimit: ''

I can't reproduce getting memory: {} in YAML from UI 1.4.0.

TechDufus commented 7 months ago

I manually added your yaml and the policy is working.. I can no longer reproduce getting my initial issue either... 🤣

one and done I suppose.