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

scorecard - lookup namespace from kubeconfig #3478

Merged
merged 1 commit into from
Jul 21, 2020
Merged

scorecard - lookup namespace from kubeconfig #3478

merged 1 commit into from
Jul 21, 2020

Conversation

jmccormick2001
Copy link
Contributor

Description of the change:

add logic in scorecard command to lookup the namespace, if not set on the command line, from the
kubeconfig

Motivation for the change:

Closes #3422

Checklist

If the pull request includes user-facing changes, extra documentation is required:

"testing"
)

func TestGetKubeNamespace(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.

Nit: we should be writing all new tests with ginkgo/gomega. But let's get this merged and add a TODO.

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2020

ns, _, err := kubeConfig.Namespace()
if err != nil {
return "default"
Copy link
Member

@estroz estroz Jul 21, 2020

Choose a reason for hiding this comment

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

The "default" namespace might not exist, and we probably shouldn't mask this error so I would return it to the CLI. On the flip side, then this would be a breaking change, although I don't think that matters too much because this command was still in alpha in the most recent release.

Copy link
Member

Choose a reason for hiding this comment

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

Address in a follow-up

Comment on lines +69 to +72

if kubeconfigPath != "" {
rules.ExplicitPath = kubeconfigPath
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
if kubeconfigPath != "" {
rules.ExplicitPath = kubeconfigPath
}
rules.ExplicitPath = kubeconfigPath

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

/lgtm

@jmccormick2001 jmccormick2001 merged commit 40aebd2 into operator-framework:master Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scorecard should use namespace from user's kubeconfig context
4 participants