-
Notifications
You must be signed in to change notification settings - Fork 710
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
OCPBUGS-16628: Fix namespace when checking the hosted clusters #10987
OCPBUGS-16628: Fix namespace when checking the hosted clusters #10987
Conversation
Not all clusters use 'clusters' as the prefix for hosted clusters. These rules should use the the variable hypershift_namespace_prefix.
Code Climate has analyzed commit b28a6b2 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 53.3% (0.0% change). View more on Code Climate. |
@@ -6,7 +6,7 @@ title: 'Configure the Encryption Provider Cipher' | |||
|
|||
{{% set default_jqfilter = '[.spec.encryption.type]' %}} | |||
{{% set default_api_path = '/apis/config.openshift.io/v1/apiservers/cluster' %}} | |||
{{% set hypershift_path = '/apis/hypershift.openshift.io/v1beta1/namespaces/clusters/hostedclusters/{{.hypershift_cluster}}' %}} | |||
{{% set hypershift_path = '/apis/hypershift.openshift.io/v1beta1/namespaces/{{.hypershift_namespace_prefix}}/hostedclusters/{{.hypershift_cluster}}' %}} |
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.
Is the prefix always the namespace? Or does it need to be concatenated with the cluster, too?
{{.hypershift_namespace_prefix}}-{{.hypershift_cluster}}
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 question,
It seems that when we are specifying the path, it should be:
namespaces/{{.hypershift_namespace_prefix}}/hostedclusters/{{.hypershift_cluster}}
e.g.:
oc get --raw /apis/hypershift.openshift.io/v1beta1/namespaces/local-cluster/hostedclusters/acfd5e74e18f6cb76f95 | jq [.spec.secretEncryption.type]
oc get --raw /apis/hypershift.openshift.io/v1beta1/namespaces/clusters/hostedclusters/wsato-hypershift1 | jq [.spec.secretEncryption.type]
But when the API check pod is retrieving the information, it is looking for:
{{.hypershift_namespace_prefix}}-{{.hypershift_cluster}}
e.g:
URI: '/api/v1/namespaces/clusters-wsato-hypershift1/pods?labelSelector=app%3Dkube-controller-manager'
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 did not know /apis/hypershift.openshift.io/v1beta1/namespaces/clusters/
was different too
Verification pass with 4.13.0-0.nightly-2023-08-11-101506 + PR in the code:
|
/test e2e-aws-ocp4-cis |
thanks for fixing this! |
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.
/lgtm
Description:
Rationale:
hypershift_namespace_prefix
.