Skip to content
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

Configure Compliance Operator for ROSA HCP #510

Conversation

JustinKuli
Copy link
Member

As mentioned in the Compliance Operator documentation, when installed on ROSA hosted control planes, a special node selector must be configured for the operator to run. This update uses conditionals to only make this configuration only on those clusters.

Refs:

As mentioned in the Compliance Operator documentation, when installed on
ROSA hosted control planes, a special node selector must be configured
for the operator to run. This update uses conditionals to only make this
configuration only on those clusters.

Refs:
 - https://issues.redhat.com/browse/ACM-14161

Signed-off-by: Justin Kulikauskas <[email protected]>
JustinKuli added a commit to JustinKuli/console that referenced this pull request Dec 10, 2024
This conditionally configures a node selector to allow the operator to
run on ROSA HCP clusters. This update matches what is in the
policy-collection.

Refs:
 - https://issues.redhat.com/browse/ACM-14161
 - open-cluster-management-io/policy-collection#510

Signed-off-by: Justin Kulikauskas <[email protected]>
Copy link

openshift-ci bot commented Dec 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JustinKuli, yiraeChristineKim

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:
  • OWNERS [JustinKuli,yiraeChristineKim]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit b57156c into open-cluster-management-io:main Dec 11, 2024
3 checks passed
@@ -51,3 +51,9 @@ spec:
namespace: openshift-compliance
source: redhat-operators
sourceNamespace: openshift-marketplace
# Conditionally configure a nodeSelector for installing on ROSA hosted control planes
config: '{{ if and (eq "ROSA" (fromClusterClaim
Copy link
Member

@dhaiducek dhaiducek Dec 11, 2024

Choose a reason for hiding this comment

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

Nice work! Not necessary to update now, but this would be cleaner as a folded multiline string:

config: >-
  {{ if and 
    (eq "ROSA" (fromClusterClaim "product.open-cluster-management.io"))
    (eq "true" (fromClusterClaim "hostedcluster.hypershift.openshift.io"))
  }}
    {"nodeSelector":{"node-role.kubernetes.io/worker":""} }
  {{ else }}
    {{ "{}" | toLiteral }}
  {{ end }}

But actually, now that I do that, it looks like it'd fail--it has an extra } in there after the nodeSelector?

Copy link
Member Author

Choose a reason for hiding this comment

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

Using >- is generally a good idea! But multiline yaml can be incredibly frustrating. In this case, the indents break the line folding, so I think this would be necessary:

config: >-
  {{ if and
  (eq "ROSA" (fromClusterClaim "product.open-cluster-management.io"))
  (eq "true" (fromClusterClaim "hostedcluster.hypershift.openshift.io"))
  }}
  {"nodeSelector":{"node-role.kubernetes.io/worker":""} }
  {{ else }}
  {{ "{}" | toLiteral }}
  {{ end }}

You also had a space at the end of the first line, emphasizing how tricky this is.

JustinKuli added a commit to JustinKuli/console that referenced this pull request Jan 20, 2025
This conditionally configures a node selector to allow the operator to
run on ROSA HCP clusters. This update matches what is in the
policy-collection.

Refs:
 - https://issues.redhat.com/browse/ACM-14161
 - open-cluster-management-io/policy-collection#510

Signed-off-by: Justin Kulikauskas <[email protected]>
@JustinKuli JustinKuli deleted the 16141-comp-op-on-rosa-hcp branch January 22, 2025 19:42
openshift-merge-bot bot pushed a commit to stolostron/console that referenced this pull request Jan 23, 2025
This conditionally configures a node selector to allow the operator to
run on ROSA HCP clusters. This update matches what is in the
policy-collection.

Refs:
 - https://issues.redhat.com/browse/ACM-14161
 - open-cluster-management-io/policy-collection#510

Signed-off-by: Justin Kulikauskas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants