Helm throwing validation error for Deployment.spec.strategy

5/22/2020

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
kubernetes
kubernetes-helm

1 Answer

5/22/2020

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
Source: StackOverflow