-
Notifications
You must be signed in to change notification settings - Fork 562
Bug 1860035: Fix SubscriptionConfig NodeSelector field #1716
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -206,3 +206,17 @@ func InjectResourcesIntoDeployment(podSpec *corev1.PodSpec, resources corev1.Res | |
|
||
return nil | ||
} | ||
|
||
// InjectNodeSelectorIntoDeployment injects the provided NodeSelector | ||
// into the container(s) of the given PodSpec. | ||
// | ||
// If any Container in PodSpec already defines a NodeSelector it will | ||
// be overwritten. | ||
func InjectNodeSelectorIntoDeployment(podSpec *corev1.PodSpec, nodeSelector map[string]string) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: this function is called maybe calling it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense, but none of the other methods in this file distinguish injecting into the deployment or podSpec. I suspect this was either an oversight when the code was written or assuming its fine given that the podspec is part of the deployment. Should we change the distinction in all places or follow convention. |
||
if podSpec == nil { | ||
return errors.New("no pod spec provided") | ||
} | ||
|
||
podSpec.NodeSelector = nodeSelector | ||
return nil | ||
} |
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.
nit: this is a bit vague. Could we say "for the pods associated with the operator deployment" instead?
This also future-proofs it a bit where in the future OLM supports more than just deploying operators, something we discussed recently
Uh oh!
There was an error while loading. Please reload this page.
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.
Technically this config is applied to all deployments created by OLM.
OLM also creates deployments for webhooks, which could be stored in the same deployment as the operator but isn't guaranteed, so I don't know how OLM could only create deployments for operators.