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

Update how ci-operator gets cluster profile secrets #4112

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

psalajova
Copy link
Contributor

Use config-resolver to get the name of cluster profile secret we need, instead of mounting it to the job and then reading it locally along with the other user-defined secrets.

Next steps:

  • create a presubmit job to check the cluster profile secret (defined in the test config) exists in the ci namespace
  • edit prowgen so it doesn't add the cluster profile volume to the job yaml, as it won't be needed anymore & regenerate all jobs

/cc @droslean

@openshift-ci openshift-ci bot requested a review from droslean May 9, 2024 12:12
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 9, 2024
Copy link
Contributor

openshift-ci bot commented May 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: psalajova

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 May 9, 2024
@psalajova
Copy link
Contributor Author

/retest

// Use config-resolver to get details about the cluster profile (which includes the secret's name)
cpDetails, err := resolverClient.ClusterProfile(clusterProfile)
if err != nil {
logrus.WithError(err).Errorf("failed to retrieve details from config resolver for '%s' cluster profile", clusterProfile)
Copy link
Member

Choose a reason for hiding this comment

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

No need to log the error, since you are returning it.

}

// getSecretFromCiNamespace retrieves a secret from the ci namespace
func getSecretFromCiNamespace(secretName string, client ctrlruntimeclient.Client, ctx context.Context) (*coreapi.Secret, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Since you are using this function only once, and it is a few lines of code you can do it directly. Also, the unit tests you added for this function are not testing anything valuable, you can remove them.

@openshift-ci-robot
Copy link
Contributor

/test remaining-required

@psalajova
Copy link
Contributor Author

/test e2e

@psalajova
Copy link
Contributor Author

/test e2e

1 similar comment
@psalajova
Copy link
Contributor Author

/test e2e

@droslean
Copy link
Member

/test e2e

1 similar comment
@psalajova
Copy link
Contributor Author

/test e2e

@psalajova
Copy link
Contributor Author

/test e2e

@psalajova
Copy link
Contributor Author

/test e2e

@psalajova
Copy link
Contributor Author

/test e2e

}

// getClusterProfileNamesFromTargets extracts the needed cluster profile name(s) from the target arg(s)
func (o *options) getClusterProfileNamesFromTargets() {
Copy link
Member

Choose a reason for hiding this comment

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

We could use unittests for this.

return nil, nil
}

func TestGetClusterProfileSecret(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Technically you are not testing anything. The main operation that is being done to retrieve the cluster profiles is being tested in https://github.com/psalajova/ci-tools/blob/35c5f8f232ef977adf77ce20c237560df3e4eea8/pkg/registry/server/client_test.go#L88

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hm, right

// getClusterProfileNamesFromTargets extracts the needed cluster profile name(s) from the target arg(s)
func (o *options) getClusterProfileNamesFromTargets() {
for _, targetName := range o.targets.values {
for _, test := range o.configSpec.Tests {
Copy link
Member

Choose a reason for hiding this comment

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

Consider having a helper method on the Tests object to retrieve the cluster profiles.

@psalajova
Copy link
Contributor Author

/test e2e

@psalajova
Copy link
Contributor Author

/label tide/merge-method-squash

@psalajova
Copy link
Contributor Author

/test e2e

@openshift-ci openshift-ci bot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Aug 9, 2024
Copy link
Contributor

openshift-ci bot commented Aug 9, 2024

@psalajova: 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/security 8d73570 link false /test security

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.

@psalajova psalajova changed the title [WIP] Update how ci-operator gets cluster profile secrets Update how ci-operator gets cluster profile secrets Aug 9, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 9, 2024
@psalajova
Copy link
Contributor Author

/hold to synchronize with rolling out of the other changes that need to be done

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 9, 2024
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants