-
Notifications
You must be signed in to change notification settings - Fork 208
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
odiglet: Initialize clientset at startup and do OpenShift selinux changes last #2405
Conversation
f9e3e90
to
b2900fb
Compare
I understand the first change and not sure about the second. BTW, could/should we undo the chroot after we don't longer need it? |
@RonFed it's messy to be initializing a new k8s client in different spots in the same code, especially in a helper method like Initializing early, especially in code that modifies host files like this, helps ensure the k8s client actually gets set up and would have prevented this issue. |
I only got to check this today and just confirmed the same thing - I just did a simple fix
doing the copy at the end, since we are exiting at the end of the init, so the chroot goes away |
Is there a place where the odiglet runs outside of k8s? |
This does 2 things in the Odiglet:
chroot
to the host directory to run selinux commands that update the agent permissions, so they are readable by pods. Thischroot
was preventing the k8s client from initializing withopen /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory
. Moved last so thechroot
doesn't mess up future changes.clientset
an argument to functions likeodiglet.New
andk8snode.AddLabelToNode
, the latter of which is just a helper which should not be initializing its own clientset every call anyway.Technically, either one of these changes would have fixed the issue. But doing both is even better to help prevent future issues like this.