KohlsTechnology / eunomia

A GitOps Operator for Kubernetes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change Trigger to GitOpsconfig creates two Jobs and two pods

Beardface123 opened this issue · comments

What version of eunomia are you using?

kubectl exec $EUNOMIA_POD curl localhost:8383/metrics Output
$ kubectl get -n eunomia-operator endpoints/eunomia-operator -o jsonpath='{.subsets[*].addresses[*].targetRef.name}' | xargs -I% kubectl exec -n eunomia-operator % -- curl -sS localhost:8383/metrics | grep eunomia_build_info

eunomia version: v0.1.6

Does this issue reproduce with the latest release?
Unknown

What operating system and processor architecture are you using (kubectl version)?
platform: darwin/amd64

kubectl version Output
$ kubectl version

What did you do?
Edited the gitopsconfig for the namespace
Updated the cron field to trigger the change trigger. When the config was saved, kubectl returned that it had been edited.

What did you expect to see?
when use kubectl to get the pods, I expected to see a single running pod

What did you see instead?
I saw two pods created within a second of each other.

bectl get pods -n SOMENAME | grep Running
gitopsconfig-SOMENAME-1597284000-x4jth   1/1     Running   0          58s
gitopsconfig-SOMENAME-v49q0i-dws7g       1/1     Running   0          59s
kubectl get jobs -n somename
NAME                                                  COMPLETIONS   DURATION   AGE
gitopsconfig-SOMENAME-1597284000   1/1           2m57s      3m1s
gitopsconfig-SOMENAME-v49q0i       1/1           2m41s      3m2s

@Beardface123 thanks for opening this bug. I've added it to the v0.1.8 milestone for now.

Some more details for troubleshooting/debugging this issue:

I took a look into the GKE cluster in which this bug was discovered and found that the owner reference for gitopsconfig-SOMENAME-1597284000 was a CronJob and the owner reference for gitopsconfig-SOMENAME-v49q0i was the GitOpsConfig resource.

We already got test cases prepared for this, they just need to be enabled:

#validate_job_count eunomia-hello-world-yaml-demo 1

(You'll find it a couple more times).