devspace-sh / devspace

DevSpace - The Fastest Developer Tool for Kubernetes ⚡ Automate your deployment workflow with DevSpace and develop software directly inside Kubernetes.
https://devspace.sh
Apache License 2.0
4.37k stars 361 forks source link

Enable int values on maxSurge and maxUnavailable, as well as percent values. #2517

Closed pablorsk closed 1 year ago

pablorsk commented 1 year ago

Is your feature request related to a problem?

Let's assume this deployment:

my_deployment:
    helm:
        values:
            containers:
                  image: my_app:1.0.0
                  name: cool
            rollingUpdate:
                enabled: true
                maxSurge: 1%
                maxUnavailable: 0%
            replicas: 1
            autoScaling:
                horizontal:
                    averageCPU: 200m
                    maxReplicas: 10

Suppose we have autoscaled to 10 replicas. When I deploy, all 10 replicas are recreaded simultaneously. I think is because maxSurge:1% of replicas:1 is 1; and 1 is the 100% of pods (based on K8S documentation).

I think, if I put maxSurge:1 the problem will be solved. Now, if I put maxSurge:1 I receive:

Error: UPGRADE FAILED: cannot patch "my_deployment" with kind Deployment: Deployment.apps "my_deployment" is invalid: spec.strategy.rollingUpdate.maxSurge: Invalid value: intstr.IntOrString{Type:1, IntVal:0, StrVal:"1"}: a valid percent string must be a numeric string followed by an ending '%!'(MISSING) (e.g. '1%!'(MISSING),  or '93%!'(MISSING), regex used for validation is '[0-9]+%!'(MISSING))

Which solution do you suggest?

Enable int values on maxUnavailable and maxSurge, like K8S documentation.

Which alternative solutions exist?

Maybe my problem is with the cluster; but if integer values ​​are enabled devspace could accept values ​​allowed by K8s.

Additional context

$ devspace -v
devspace version 6.2.2
89luca89 commented 1 year ago

Thanks @pablorsk for reporting! We will take a look

89luca89 commented 1 year ago

Hi @pablorsk the problem was not in devspace itself but in the component chart Future releases of the chart will work with integer values :+1: