-
Notifications
You must be signed in to change notification settings - Fork 260
fix initialize from kube pods flow #1194
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
Conversation
53cc280 to
e42a739
Compare
| } | ||
| }() | ||
|
|
||
| clientset, err := kubernetes.NewForConfig(kubeConfig) |
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.
I still suggest to move this logic inside initCNS. It is more contained there as part of CNS initialization workflow.
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.
podInfoByProvider is kind of an internal state which we are passing to InitCNS func.
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.
moving the clientset/the rest of this initialization into the initCNS breaks IOC - we should provide that func all of the objects it needs as inputs. passing it ready-to-use implementations of the interfaces it needs is the better pattern
f415b48 to
62b2b34
Compare
| } else { | ||
| logger.Printf("Initializing from Kubernetes") | ||
| podInfoByIPProvider = cns.PodInfoByIPProviderFunc(func() (map[string]cns.PodInfo, error) { | ||
| pods, err := clientset.CoreV1().Pods("").List(ctx, metav1.ListOptions{ //nolint:govet // ignore err shadow |
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.
I think I'm okay with the contents of this pr, but I do want to mention that hostnetworking pods on windows do require a hacky kubeconfig to be constructed externally and loaded via file as opposed to using an inclusterconfig, if running in hostnw on windows becomes a thing
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.
good to know, we would need to update how we source the kubeconfigs in a couple of places for that
Signed-off-by: Evan Baker <rbtr@users.noreply.github.
Signed-off-by: Evan Baker <rbtr@users.noreply.github.com>
62b2b34 to
673a4ee
Compare
Signed-off-by: Evan Baker rbtr@users.noreply.github.
Reason for Change:
Issue Fixed:
Requirements:
Notes: