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
pkg/k8s: use a controller manager in K8sClient #17112
Conversation
8a2c4db
to
821a2a3
Compare
test-me-please |
@@ -282,6 +282,7 @@ func (c *Controller) runController() { | |||
|
|||
case <-runTimer.After(interval): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it on purpose that we do nothing after the timer elapses? Go doesn't do case fallthrough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation seems to be a bit off as well :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it on purpose that we do nothing after the timer elapses? Go doesn't do case fallthrough.
We do "something". Once that timer elapses we run the function in
cilium/pkg/controller/controller.go
Line 206 in a8e3fa2
err = params.DoFunc(c.ctxDoFunc) |
Indentation seems to be a bit off as well :-)
The indentation is correct, otherwise gofmt would have complained.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah now I get the logic. And I guess it's just github not showing it properly.
Since "controller.NewManager()" returns a new Manager, triggering a controller from this newly returned manager does not work because the manager does not have any controller set in it. In order to be able to re-trigger controllers, a single instance of this manager is set in the K8sClient struct. Fixes: bd34b95 ("pkg/k8s: remove node.cilium.io/agent-not-ready taint from nodes") Signed-off-by: André Martins <andre@cilium.io>
`runFunc` should be set to true when the controller is manually triggered otherwise the controller might never be executed in the case where its run interval is zero. Fixes: c61d02f ("controller: allow to manually trigger it") Signed-off-by: André Martins <andre@cilium.io>
821a2a3
to
91b8de5
Compare
test-me-please k8s-1.20-kernel-4.19 failed with:
gke-stable was unable to be provisioned https://jenkins.cilium.io/job/Cilium-PR-K8s-GKE/6245/flowGraphTable |
test-gke |
test-1.20-4.19 |
ci-gke |
Since "controller.NewManager()" returns a new Manager, triggering a
controller from this newly returned manager does not work because the
manager does not have any controller set in it. In order to be able
to re-trigger controllers, a single instance of this manager is set in
the K8sClient struct.
Fixes: bd34b95 ("pkg/k8s: remove node.cilium.io/agent-not-ready taint from nodes")
Signed-off-by: André Martins andre@cilium.io
Fixes: #17103