Skip to content

Conversation

davidvossel
Copy link
Contributor

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.

@openshift-ci openshift-ci bot requested review from abhat and dougbtv July 18, 2024 14:57
@davidvossel davidvossel force-pushed the hcp-tolerations branch 4 times, most recently from 2eccfe4 to c2ff6ef Compare July 23, 2024 13:33
@davidvossel davidvossel changed the title HCP custom tolerations integration CNV-43973: HCP custom tolerations integration Jul 23, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jul 23, 2024

@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:

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.

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 23, 2024
ovnHypershiftResult.ClusterID = hcp.ClusterID
ovnHypershiftResult.HCPNodeSelector = hcp.NodeSelector

tolerations, err := hypershift.TolerationsToStringArray(hcp.Tolerations)
Copy link
Contributor

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:

{{ 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 }}

Copy link
Contributor Author

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{})
Copy link
Contributor

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?

return conditions, nil
}

func TolerationsToStringArray(tolerations []corev1.Toleration) ([]string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing doc block

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Signed-off-by: David Vossel <[email protected]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 25, 2024

@davidvossel: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/security 4776726 link false /test security
ci/prow/e2e-network-mtu-migration-ovn-ipv6 4776726 link false /test e2e-network-mtu-migration-ovn-ipv6
ci/prow/e2e-vsphere-ovn-dualstack-primaryv6 4776726 link false /test e2e-vsphere-ovn-dualstack-primaryv6
ci/prow/e2e-aws-hypershift-ovn-kubevirt 4776726 link false /test e2e-aws-hypershift-ovn-kubevirt
ci/prow/e2e-ovn-ipsec-step-registry 4776726 link false /test e2e-ovn-ipsec-step-registry
ci/prow/e2e-vsphere-ovn-dualstack 4776726 link false /test e2e-vsphere-ovn-dualstack

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.

@kyrtapz
Copy link
Contributor

kyrtapz commented Jul 26, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 26, 2024
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 26, 2024

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 26, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit b454d8d into openshift:master Jul 26, 2024
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cluster-network-operator
This PR has been included in build cluster-network-operator-container-v4.18.0-202407261044.p0.gb454d8d.assembly.stream.el9.
All builds following this will include this PR.

@rtheis
Copy link

rtheis commented Aug 27, 2025

/cherry-pick release-4.16

@openshift-cherrypick-robot

@rtheis: new pull request created: #2788

In response to this:

/cherry-pick release-4.16

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants