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

Adjust how add_kubernetes_rule.py determines template filepath #12068

Closed

Conversation

yuumasato
Copy link
Member

@yuumasato yuumasato commented Jun 14, 2024

Description:

  • Adjust how utils/add_kubernetes_rule.py determines the resouces filepath.
    • Let's use the last GET attempt instead of the first one. In some cases oc makes multiple requests.
$ oc get subscriptions.operators.coreos.com cluster-kube-descheduler-operator -n descheduler-operator --loglevel=6
I0614 17:26:23.990375  707335 loader.go:373] Config loaded from file:  /home/wsato/openshift/cluster-bot/cluster-bot-2024-06-14-132324.kubeconfig.txt
I0614 17:26:23.997814  707335 discovery.go:214] Invalidating discovery information
I0614 17:26:24.603751  707335 round_trippers.go:553] GET https://api.ci-ln-2xmvwv2-76ef8.origin-ci-int-aws.dev.rhcloud.com:6443/api?timeout=32s 200 OK in 605 milliseconds
I0614 17:26:24.779482  707335 round_trippers.go:553] GET https://api.ci-ln-2xmvwv2-76ef8.origin-ci-int-aws.dev.rhcloud.com:6443/apis?timeout=32s 200 OK in 168 milliseconds
I0614 17:26:24.966879  707335 round_trippers.go:553] GET https://api.ci-ln-2xmvwv2-76ef8.origin-ci-int-aws.dev.rhcloud.com:6443/apis/operators.coreos.com/v1alpha1/namespaces/descheduler-operator/subscriptions/cluster-kube-descheduler-operator 200 OK in 171 milliseconds
NAME                                PACKAGE                             SOURCE             CHANNEL
cluster-kube-descheduler-operator   cluster-kube-descheduler-operator   redhat-operators   stable

Rationale:

  • Depending on the OpenShift resource being checked, oc comamnd may make multiple requests.
    So let's use the last request sent to determine the url of the resource.

Review Hints:

  • Get an OCP cluster;
  • Install Kube Descheduler Operator;
  • ./utils/add_kubernetes_rule.py create platform --rule test --name cluster-kube-descheduler-operator --namespace descheduler-operator --type subscriptions.operators.coreos.com --title "test" --description "test" --match-entity "at least one" --yamlpath '.status.installedCSV' --match "clusterkubedescheduleroperator.*" --regex
  • ./build_product -d ocp4
  • Build fails

@yuumasato yuumasato added the OpenShift OpenShift product related. label Jun 14, 2024
@yuumasato
Copy link
Member Author

CC: @ermeratos

Copy link

Start a new ephemeral environment with changes proposed in this pull request:

Fedora Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

Copy link

github-actions bot commented Jun 14, 2024

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:12068
This image was built from commit: 53babf2

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:12068

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:12068 make deploy-local

Depending on the OpenShift resource being checked, `oc` comamnd may make
multiple requests.
So let's use the last request sent to determine the url of the resource.
Copy link

codeclimate bot commented Jun 21, 2024

Code Climate has analyzed commit 53babf2 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 59.4% (0.0% change).

View more on Code Climate.

@xiaojiey
Copy link
Collaborator

xiaojiey commented Jul 5, 2024

@yuumasato In my test, it always complaining format issue of the rule generated by ./utils/add_kubernetes_rule.py create platform --rule test --name cluster-kube-descheduler-operator --namespace descheduler-operator --type subscriptions.operators.coreos.com --title "test" --description "test" --match-entity "at least one" --yamlpath '.status.installedCSV' --match "clusterkubedescheduleroperator.*" --regex
I updated the formate with https://github.com/ComplianceAsCode/content/blob/master/applications/openshift/integrity/file_integrity_exists/rule.yml, I didn't reproduce this issue without/with the PR

Copy link

openshift-ci bot commented Jul 30, 2024

@yuumasato: The following test 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/4.17-images 53babf2 link true /test 4.17-images

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.

@jan-cerny
Copy link
Collaborator

ping

@jan-cerny
Copy link
Collaborator

Hi. There is no activity in this PR for a long period of time, therefore, I'm closing the PR. If you still want to work on this PR, please feel free to reopen it. Thank you.

@jan-cerny jan-cerny closed this Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants