nats-io / nats-operator

NATS Operator
https://nats-io.github.io/k8s/
Apache License 2.0
574 stars 111 forks source link

Helm install error - unknown field "updateStrategy" #192

Open swdee opened 5 years ago

swdee commented 5 years ago

Trying to deploy NATS operator using Helm on a Digital Ocean k8s instance using the following command;

$ helm install nats-operator --name v20190521 --namespace=nats-io

This fails with error

Error: validation failed: error validating "": error validating data: ValidationError(Deployment.spec.template.spec): unknown field "updateStrategy" in io.k8s.api.core.v1.PodSpec

Which corresponds with the deployment template here https://github.com/nats-io/nats-operator/blob/7ecd1fc69f0afcc65ea183db1d7bd0a99e7242d5/helm/nats-operator/templates/deployment.yaml#L29

Helm and k8s versions used;

$ helm version
Client: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.14.0", GitCommit:"05811b84a3f93603dd6c2fcfe57944dfa7ab7fd0", GitTreeState:"clean"}

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:02:58Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

The issue is field updateStrategy is apart of the StatefulSet and not the Pod spec so the deployment.yaml template needs modification?

wallyqs commented 5 years ago

Looks like this might be a similar issue to https://github.com/helm/charts/pull/14006/files we should try moving update strategy to be outside of the pod spec.

swdee commented 5 years ago

Yeah I found that issue also and tried it, but it gives error;

Error: validation failed: error validating "": error validating data: ValidationError(Deployment.spec): unknown field "updateStrategy" in io.k8s.api.apps.v1beta2.DeploymentSpec

I would think the solution is to remove from deployment.yaml and create a new template statefulset.yaml and have the updateStrategy placed in there, like how its done on the NATS Helm charts https://github.com/helm/charts/tree/master/stable/nats/templates

Thoughts?

swdee commented 5 years ago

Note that by removing the following lines from deployment.yaml, nats-operator installs fine.

      updateStrategy:
        type: {{ .Values.updateStrategy }}
        {{- if .Values.rollingUpdatePartition }}
        rollingUpdate:
          partition: {{ .Values.rollingUpdatePartition }}
        {{- end }}

updateStrategy is a field as apart of StatefulSet, but the templates have nats-operator configured as a Deployment. It seems that the charts have been copied over from the NATS charts where NATS is configured as a StatefulSet so these additional fields have been copied across in error.

Either nats-operator is left to be configured as a k8s Deployment and the above updateStrategy fields removed along with definitions in values.yaml https://github.com/nats-io/nats-operator/blob/7ecd1fc69f0afcc65ea183db1d7bd0a99e7242d5/helm/nats-operator/values.yaml#L68 Or signification changes are made to the templates to install nats-operator as a StatefulSet?