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

Main routine ignoring stop signals #2

Open
antoineco opened this issue Oct 5, 2017 · 1 comment · May be fixed by #3
Open

Main routine ignoring stop signals #2

antoineco opened this issue Oct 5, 2017 · 1 comment · May be fixed by #3

Comments

@antoineco
Copy link

first of all a big thank you for these very well documented project and article, I learned a lot from them! 👏

I noticed that the controller was ignoring both SIGINT and SIGTERM, both on macOS and Linux.

$ ./operator -run-outside-cluster
2017/10/05 15:41:41 Created AD RoleBinding for Namespace: ad-kubernetes-default
2017/10/05 15:41:41 Created AD RoleBinding for Namespace: ad-kubernetes-kube-public
2017/10/05 15:41:41 Created AD RoleBinding for Namespace: ad-kubernetes-kube-system
^C^C^C
$ kubectl exec operator -- kill 1
(process ignored the signal and is still running)

I'm investigating what's going on under the hood, but maybe you already have an idea why this is not working.

@antoineco
Copy link
Author

Alright, adding the following routine inside main():

go func() {
	fmt.Printf("received: %v\n", <-sigs)
}()

I found out that the signal was actually received:

$ ./operator -run-outside-cluster
2017/10/05 16:30:52 Failed to create Role Binding: rolebindings.rbac.authorization.k8s.io "ad-kubernetes-default" already exists
2017/10/05 16:30:52 Failed to create Role Binding: rolebindings.rbac.authorization.k8s.io "ad-kubernetes-kube-public" already exists
2017/10/05 16:30:52 Failed to create Role Binding: rolebindings.rbac.authorization.k8s.io "ad-kubernetes-kube-system" already exists
^Creceived: interrupt

My feeling is that controller.NewNamespaceController(clientset).Run(stop, wg) is blocking, preventing <-sigs to be executed.

@antoineco antoineco linked a pull request Oct 6, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant