This repository was archived by the owner on Nov 1, 2022. It is now read-only.
This repository was archived by the owner on Nov 1, 2022. It is now read-only.
Flux did not notice branch deletion and undeletion #2288
Closed
Description
Describe the bug
- My Flux was up and configured to poll a branch named
flux-branch
in a remote repo - I issued
git push origin :flux-branch
to delete the remote branch - Got the following Flux logs (filtered out irrelevant lines):
ts=2019-07-24T06:09:26.378624874Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:09:30.898645292Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:09:48.926886623Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:09:52.846874111Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
<--- remote delete happened here
ts=2019-07-24T06:10:11.394893034Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:10:17.692321457Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:10:33.881518139Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
Expected the following Flux logs:
ts=2019-07-24T06:09:26.378624874Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:09:30.898645292Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:09:48.926886623Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:09:52.846874111Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
<--- remote delete happened here
ts=2019-07-24T06:10:11.394893034Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:10:17.692321457Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:10:33.881518139Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
- I restarted Flux:
$ kubectl delete -n wkp-flux pod/flux-6dfc9bcc94-bfglw
pod "flux-6dfc9bcc94-bfglw" deleted
- I pushed the deleted branch (to effectively undelete it)
- Got the following Flux logs:
ts=2019-07-24T06:18:56.665459934Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:06.665618972Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:16.665782681Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:26.665941962Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:36.666085952Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
<-- push happened here
ts=2019-07-24T06:19:46.666235994Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:56.666393099Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:20:06.666652373Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:20:16.666821377Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
Expected the following Flux logs:
ts=2019-07-24T06:18:56.665459934Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:06.665618972Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:16.665782681Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:26.665941962Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:36.666085952Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
ts=2019-07-24T06:19:46.666235994Z caller=loop.go:85 component=sync-loop err="git repo not ready: configured branch 'flux-branch' does not exist"
<-- push happened here
ts=2019-07-24T06:19:56.666393099Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:20:06.666652373Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
ts=2019-07-24T06:20:16.666821377Z caller=loop.go:111 component=sync-loop event=refreshed url=git@github.com:mflendrich/configrepo-demo.git branch=flux-branch HEAD=a44875b7890af62ab0cfe27ecb0c2514dd11ecef
To Reproduce
Steps to reproduce the behaviour:
0. Set up an empty k8s cluster
- Install Flux 1.13.2 and point it to a GitHub repo (with manifest generation using
jk
enabled, if that's relevant) - Observe that Flux can read HEAD from the repo (WAI)
- Delete the Git branch from the repo Flux polls
- Observe that Flux didn't notice the deletion and claims that HEAD is unchanged (not WAI)
- Restart Flux by deleting its pod
- Observe that Flux says that the branch does not exist (WAI)
- Recreate the remote branch
- Observe that Flux says that the branch does not exist (not WAI)
Expected behavior
In reproduction step 4: I expected Flux to notice that the branch did not exist anymore.
In reproduction step 8: I expected Flux to notice the HEAD of the newly created branch.
In a scenario where a disaster happens to the Git repo (e.g. deletion of all the branches), Flux may be unable to recover after the branch is back without restarting.
Logs
Logs above.
Additional context
Add any other context about the problem here, e.g
- Flux version: 1.13.2
- Helm Operator version: n/a
- Kubernetes version:
Server Version: version.Info{Major:"1", Minor:"12+", GitVersion:"v1.12.6-eks-d69f1b", GitCommit:"d69f1bf3669bf00b7f4a758e978e0e7a1e3a68f7", GitTreeState:"clean", BuildDate:"2019-02-28T20:26:10Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
- Git provider: GitHub
- Container registry provider: n/a
Activity