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

refactor: secret generator #1262

Open
wants to merge 2 commits into
base: incubation
Choose a base branch
from

Conversation

zdtsw
Copy link
Member

@zdtsw zdtsw commented Sep 25, 2024

Description

  • split logic to deletion and creation
  • final return nil in the end

How Has This Been Tested?

local build: quay.io/wenzhou/opendatahub-operator:2.18.925-0

  • install operator
  • create DSCI
  • create DSC to have dashboard enabled
  • check operator pod log: no error on oauth related secret
  • set dashboard to removed in DSC
  • check operator pod log: no error
  • restart oprator pod
  • check operator pod log: no error

Screenshot or short clip

Merge criteria

  • You have read the contributors guide.
  • Commit messages are meaningful - have a clear and concise summary and detailed explanation of what was changed and why.
  • Pull Request contains a description of the solution, a link to the JIRA issue, and to any dependent or related Pull Request.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link

openshift-ci bot commented Sep 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from zdtsw. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

- split logic to deletion and creation
- final return nil in the end

Signed-off-by: Wen Zhou <[email protected]>
return ctrl.Result{}, err
}

r.Log.Info("Reconciling Secret on creation.", "Request.Name", request.Name)
Copy link

Choose a reason for hiding this comment

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

Shouldn't this be

log := r.Log
log.Info(...)

to align with #1272?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks , updated

Comment on lines -134 to +136
generatedSecretKey := types.NamespacedName{
Name: generatedSecret.Name, Namespace: generatedSecret.Namespace,
}
err = r.Client.Get(ctx, generatedSecretKey, generatedSecret)
err = r.Client.Get(ctx, client.ObjectKey{Name: generatedSecret.Name, Namespace: generatedSecret.Namespace}, generatedSecret)
Copy link

Choose a reason for hiding this comment

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

What does the types.NamespacedName change to client.ObjectKey achieve?

Copy link
Member Author

Choose a reason for hiding this comment

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

no real difference.
both generatedSecretKey and client.ObjectKey{} return types.NamespacedName type,
i went for the later one only because of inline style than introducing a one time variable

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

nice, then it can be simplified to err = r.Client.Get(ctx, client.ObjectKeyFromObject(generatedSecret), generatedSecret)

@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

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.

Copy link

openshift-ci bot commented Oct 11, 2024

@zdtsw: 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/opendatahub-operator-e2e f03b56d link true /test opendatahub-operator-e2e
ci/prow/images f03b56d link true /test images
ci/prow/opendatahub-operator-pr-image-mirror f03b56d link true /test opendatahub-operator-pr-image-mirror
ci/prow/ci-index f03b56d link true /test ci-index

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

5 participants