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

cmd/operator-sdk/new/cmd.go: fallback to default helm RBAC role without kubeconfig #1627

Merged

Conversation

joelanford
Copy link
Member

Description of the change:
Updates operator-sdk new --type=helm to fallback to default RBAC rules if there is an error getting the kubeconfig or creating a discovery client.

Motivation for the change:
Closes #1625

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 1, 2019
Copy link
Contributor

@AlexNPavel AlexNPavel left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

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

Overall lgtm, one question that I would like answered.

roleScaffold := helm.DefaultRoleScaffold
if k8sCfg, err := config.GetConfig(); err != nil {
log.Warnf("Using default RBAC rules: failed to get Kubernetes config: %s", err)
} else if dc, err := discovery.NewDiscoveryClientForConfig(k8sCfg); err != nil {
Copy link
Member

@lilic lilic Jul 2, 2019

Choose a reason for hiding this comment

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

What happens here if k8sCfg is nil and we pass it to NewDiscoveryClientForConfig?

Copy link
Member Author

Choose a reason for hiding this comment

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

In that case, config.GetConfig() would have to return nil, nil, which is probably not something that it would ever do. But better safe than sorry 🙂 . I'll check if the follow-on functions handle nil for both k8sCfg and dc.

Copy link
Member

@lilic lilic Jul 2, 2019

Choose a reason for hiding this comment

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

Missed the else part of the if, nvm. :)

CHANGELOG.md Outdated Show resolved Hide resolved
@joelanford
Copy link
Member Author

/test marker

@joelanford
Copy link
Member Author

/test e2e-aws-ansible

Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

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

lgtm on green

@AlexNPavel
Copy link
Contributor

/test e2e-aws-ansible

1 similar comment
@lilic
Copy link
Member

lilic commented Jul 4, 2019

/test e2e-aws-ansible

@AlexNPavel AlexNPavel merged commit cdbcc93 into operator-framework:master Jul 8, 2019
@joelanford joelanford deleted the helm-new-default-role branch August 8, 2019 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Why is kubeconfig needed during operator-sdk new
4 participants