Skip to content

cmd/catalog: Default to the $KUBECONFIG environment variable when building client configs #2303

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

Conversation

timflannagan
Copy link
Member

Update the catalog operator and default to the $KUBECONFIG environment
variable value when the --kubeconfig flag hasn't been provided. This
mirrors the same way that the olm operator (e.g. controller-runtime is
handling this check under-the-hood) behaves.

Description of the change:

Motivation for the change:

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /doc
  • Commit messages sensible and descriptive

@@ -37,7 +37,7 @@ const (
// config flags defined globally so that they appear on the test binary as well
var (
kubeConfigPath = flag.String(
"kubeconfig", "", "absolute path to the kubeconfig file")
"kubeconfig", os.Getenv("KUBECONFIG"), "absolute path to the kubeconfig file")
Copy link
Member Author

Choose a reason for hiding this comment

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

When providing the value through the CLI flag, that value still takes precedence over the local $KUBECONFIG environment variable, which seems like the correct behavior. Might be worth calling out that behavior in this flags description?

@openshift-ci openshift-ci bot requested review from anik120 and awgreene July 29, 2021 20:48
@timflannagan timflannagan reopened this Dec 20, 2021
@timflannagan timflannagan force-pushed the update-catalog-operator-kubeconfig-flag-handling branch 2 times, most recently from 1174dcf to f0f5219 Compare December 20, 2021 18:53
@timflannagan timflannagan force-pushed the update-catalog-operator-kubeconfig-flag-handling branch from f0f5219 to f1b10a7 Compare January 4, 2022 19:00
@timflannagan timflannagan force-pushed the update-catalog-operator-kubeconfig-flag-handling branch from f1b10a7 to 1c863c5 Compare February 9, 2022 19:21
@openshift-ci
Copy link

openshift-ci bot commented Feb 9, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: timflannagan

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 Feb 9, 2022
Update the catalog operator and default to the $KUBECONFIG environment
variable value when the --kubeconfig flag hasn't been provided. This
mirrors the same way that the olm operator (e.g. controller-runtime is
handling this check under-the-hood) behaves.

Signed-off-by: timflannagan <[email protected]>
@timflannagan timflannagan force-pushed the update-catalog-operator-kubeconfig-flag-handling branch from 1c863c5 to 9ff3357 Compare February 9, 2022 19:31
@exdx
Copy link
Member

exdx commented Feb 10, 2022

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Feb 10, 2022
@timflannagan timflannagan merged commit 1858075 into operator-framework:master Feb 10, 2022
@timflannagan timflannagan deleted the update-catalog-operator-kubeconfig-flag-handling branch February 10, 2022 14:58
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. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants