-
Notifications
You must be signed in to change notification settings - Fork 259
CNV-43973: HCP custom tolerations integration #2441
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
CNV-43973: HCP custom tolerations integration #2441
Conversation
2eccfe4
to
c2ff6ef
Compare
@davidvossel: This pull request references CNV-43973 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.17.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
pkg/network/ovn_kubernetes.go
Outdated
ovnHypershiftResult.ClusterID = hcp.ClusterID | ||
ovnHypershiftResult.HCPNodeSelector = hcp.NodeSelector | ||
|
||
tolerations, err := hypershift.TolerationsToStringArray(hcp.Tolerations) |
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.
bootstrapResult.OVN.OVNKubernetesConfig.HyperShiftConfig.HCPTolerations
is only used as the string array.
Can we just store it as StringArray instead of always converting it?
This could help avoid the len(bootstrapResult.OVN.OVNKubernetesConfig.HyperShiftConfig.HCPTolerations) != 0
condition too.
An alternative would be to use the tolerations as is, same as we do here:
cluster-network-operator/bindata/network-diagnostics/network-check-source.yaml
Lines 75 to 95 in 44c7f1d
{{ if .NetworkCheckSourceTolerations }} | |
tolerations: | |
{{ range .NetworkCheckSourceTolerations }} | |
- | |
{{ if .Key }} | |
key: "{{.Key}}" | |
{{ end }} | |
{{ if .Operator }} | |
operator: "{{.Operator}}" | |
{{ end }} | |
{{ if .Value }} | |
value: "{{.Value}}" | |
{{ end }} | |
{{ if .Effect }} | |
effect: "{{.Effect}}" | |
{{ end }} | |
{{ if .TolerationSeconds }} | |
tolerationSeconds: "{{.TolerationSeconds}}" | |
{{ end }} | |
{{ end }} | |
{{ end }} |
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 suggestion. i stored the string array and got rid of the != 0
checks.
tolerationsArrayConverted, hasConverted := tolerationsArray.([]interface{}) | ||
if hasConverted { | ||
for _, entry := range tolerationsArrayConverted { | ||
tolerationConverted, hasConverted := entry.(map[string]interface{}) |
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.
On second thought is there a point of parsing the tolerations if we are going to use them as a string array anyway?
pkg/hypershift/hypershift.go
Outdated
return conditions, nil | ||
} | ||
|
||
func TolerationsToStringArray(tolerations []corev1.Toleration) ([]string, error) { |
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.
Missing doc block
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.
fixed
c2ff6ef
to
dd7ae9d
Compare
Signed-off-by: David Vossel <[email protected]>
dd7ae9d
to
4776726
Compare
@davidvossel: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: davidvossel, kyrtapz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[ART PR BUILD NOTIFIER] Distgit: cluster-network-operator |
/cherry-pick release-4.16 |
@rtheis: new pull request created: #2788 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
The HostedCluster object for hypershift recently got a new feature that allows users creating HCP clusters to set custom tolerations on their HCP pods. The CNO needs to integrate this feature in the same way it integrated the NodeSelector feature for HCP.