Skip to content

Conversation

@89luca89
Copy link
Contributor

/kind bugfix

resolves devspace-sh/devspace#2517
Closes ENG-938

Right now we're using quote in the maxSurge and maxUnavailable values
This works ok with % values, but not with pure integers

Pure integers are expected to work, as by k8s documentation: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#proportional-scaling

This commit removes the quote, testing it results in devspace working also with integer values in maxSurge/maxUnavailable

Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
@linear
Copy link

linear bot commented Mar 21, 2023

ENG-938 Enable int values on maxSurge and maxUnavailable, as well as percent values.

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

@FabianKramm FabianKramm merged commit 5e6d0b6 into master Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants