jenkinsci / kubernetes-operator

Kubernetes native Jenkins Operator
https://jenkinsci.github.io/kubernetes-operator
Other
596 stars 233 forks source link

Jenkins pod is constantly reconciled by operator #914

Closed santipov-fl closed 8 months ago

santipov-fl commented 10 months ago

Describe the bug Operator constantly reconcilies Jenkins pod when backup is enabled. If I change imagePullPolicy to 'Always' in operator configuration then it says policy changed for backup container, but not for jenkins-master. I used -f to follow logs for jenkins-master and backup containers and those are exiting in different places means container is restarted from outside, not like an error in container itself.

To Reproduce Deploy with jenkins-operator v0.8.0 chart and enable backup.

Additional information

Kubernetes version: 1.27.4 Jenkins Operator version: 0.8.0

Disabling backup in helm chart solves the problem.

Add error logs about the problem here (operator logs and Kubernetes events).

2023-09-29T15:44:30.129Z        INFO    controller-jenkins      Jenkins master pod restarted by operator:       {"cr": "rcc"}
2023-09-29T15:44:30.130Z        INFO    controller-jenkins      Image pull policy has changed to 'IfNotPresent' in container 'jenkins-master'   {"cr": "rcc"}
2023-09-29T15:44:30.130Z        INFO    controller-jenkins      Image pull policy has changed to 'IfNotPresent' in container 'backup'   {"cr": "rcc"}

kubectl get events -w output:

21s         Normal                             jenkins/rcc                              Creating a new Jenkins Master Pod
2m23s       Normal                             jenkins/rcc                              Jenkins master pod restarted by operator:; Image pull policy has changed; Image p
santipov-fl commented 10 months ago

Figured out if I change value in chart template to be the same as for jenkins-master container then everything works. So it is either problem with that deep check for container fields from operator or chart template should configure imagePullPolicy to be the same as main container.

brokenpip3 commented 8 months ago

Figured out if I change value in chart template to be the same as for jenkins-master container then everything works. So it is either problem with that deep check for container fields from operator or chart template should configure imagePullPolicy to be the same as main container.

If it's the problem seems an easy fix, we just need to modify this value: https://github.com/jenkinsci/kubernetes-operator/blob/master/chart/jenkins-operator/templates/jenkins.yaml#L140 to this key: https://github.com/jenkinsci/kubernetes-operator/blob/63e8a76b95d9a1cf25a68151f031e9702fd7d10a/chart/jenkins-operator/templates/jenkins.yaml#L121 so they will always have the same policy.

Do you want to make a PR for this?

lunarwhite commented 8 months ago

Hi @brokenpip3, I'd like to help with this issue. Could you please assign this to me?

lunarwhite commented 8 months ago

https://github.com/jenkinsci/kubernetes-operator/pull/939 ready for review

brokenpip3 commented 8 months ago

Merged, ty