2

I'm trying to add deployment strategy as rolling deployment. But I'm not sure why this is not working. We have the same config in OpenShift which runs without any issue, but in Kubernetes this fails.

deployment.yaml

spec:
  {{- if eq .Values.autoscale.enabled false}}
  replicas: {{ .Values.deployment.replicaCount }}
  {{- end }}
  {{- if eq .Values.strategy.enabled true}}
  strategy:
    activeDeadlineSeconds: {{ .Values.strategy.activeDeadlineSeconds }}
    rollingParams:
      intervalSeconds: {{ .Values.strategy.rollingParams.intervalSeconds }}
      maxSurge: {{ .Values.strategy.rollingParams.maxSurge }}
      maxUnavailable: {{ .Values.strategy.rollingParams.maxUnavailable }}
      timeoutSeconds: {{ .Values.strategy.rollingParams.timeoutSeconds }}
      updatePeriodSeconds: {{ .Values.strategy.rollingParams.updatePeriodSeconds }}
    type: {{ .Values.strategy.type }}
  {{- end}}

values.yaml:

strategy:
  enabled: true
  activeDeadlineSeconds: 21600
  rollingParams:
    intervalSeconds: 1
    maxSurge: 25%
    maxUnavailable: 25%
    timeoutSeconds: 600
    updatePeriodSeconds: 1
  type: Rolling

Error:

Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(Deployment.spec.strategy): unknown field "activeDeadlineSeconds" in io.k8s.api.apps.v1.DeploymentStrategy, ValidationError(Deployment.spec.strategy): unknown field "rollingParams" in io.k8s.api.apps.v1.DeploymentStrategy]
helm.go:75: [debug] error validating "": error validating data: [ValidationError(Deployment.spec.strategy): unknown field "activeDeadlineSeconds" in io.k8s.api.apps.v1.DeploymentStrategy, ValidationError(Deployment.spec.strategy): unknown field "rollingParams" in io.k8s.api.apps.v1.DeploymentStrategy]

I'm not sure what's the issue. I checked for documentation for io.k8s.api.apps.v1.DeploymentStrategy, but couldn't get anything working

Thanks

pri05
  • 75
  • 1
  • 11

1 Answers1

7

It seems your variable names are wrong, checking the documentation it says it should be done as you tried, went to a working production example and its like this:

  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%

Change the variable names and let me know if it helped.

paltaa
  • 2,985
  • 13
  • 28
  • 2
    Yes, you are right! The same configuration works fine in OpenShift. `activeDeadlineSeconds`, `intervalSeconds `, `timeoutSeconds`, `updatePeriodSeconds ` doesn't get recognised. Is it because of some version mismatch? Can you point me to the documentation you referred ? Thank you! – pri05 May 22 '20 at 14:38
  • openshift have different parameters you can see here: https://docs.openshift.com/container-platform/3.3/dev_guide/deployments/deployment_strategies.html#when-to-use-a-rolling-deployment it have rollingparams, but Open Source Kubernetes describe the strategy in other structure. – Will R.O.F. May 22 '20 at 17:15
  • @pri05 to be complete honest i went to the documentation and saw the same as you, then went to a production helm char i use and got the example from there... Sometimes the documentation go slower than the software itself – paltaa May 23 '20 at 02:46