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

azure: support CLI credentials instead of service principal #4295

Merged
merged 1 commit into from
Sep 22, 2021

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Aug 30, 2021

During development it is simpler to reuse the existing credentials. Also, some
setups with Active Directory make it hard to create a service principal because
that depends on additional privileges.

/cc @bpineau

@k8s-ci-robot
Copy link
Contributor

@pohly: GitHub didn't allow me to request PR reviews from the following users: bpineau.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

During development it is simpler to reuse the existing credentials. Also, some
setups with Active Directory make it hard to create a service principal because
that depends on additional privileges.

/cc @bpineau

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 30, 2021
@bpineau
Copy link
Contributor

bpineau commented Aug 30, 2021

(not an Azure maintainer here)
Thanks, that's a sweet improvement!

Perhaps we could consider s/UseCLI bool/AuthMethod string/g, anticipating support for other methods (without ending up with a maze of mutually exclusive flags)?

What do you think?

(edit: just realising there's a useManagedIdentityExtension opt available)

@@ -206,13 +207,24 @@ func newServicePrincipalTokenFromCredentials(config *Config, env *azure.Environm
return nil, fmt.Errorf("no credentials provided for AAD application %s", config.AADClientID)
}

func newAuthorizerFromCredentials(config *Config, env *azure.Environment) (autorest.Authorizer, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit (naming): with CLI support, that's not necessarily FromCredentials anymore right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed FromCredentials.

@pohly
Copy link
Contributor Author

pohly commented Aug 30, 2021

Perhaps we could consider s/UseCLI bool/AuthMethod string/g, anticipating support for other methods (without ending up with a maze of mutually exclusive flags)?

Makes sense. I wasn't sure whether there are others. I can change that once it has been determined that this PR can be merged despite the additional dependencies (small, but still not something that would be needed for "normal" deployments).

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 14, 2021
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 14, 2021
@mwielgus mwielgus added the area/provider/azure Issues or PRs related to azure provider label Sep 20, 2021
@pohly
Copy link
Contributor Author

pohly commented Sep 20, 2021

/cc @feiskyer @nilo19 @marwanad

Is it okay to pull in additional Azure credential providers into cluster-autoscaler?

@pohly
Copy link
Contributor Author

pohly commented Sep 20, 2021

Perhaps we could consider s/UseCLI bool/AuthMethod string/g, anticipating support for other methods (without ending up with a maze of mutually exclusive flags)?

Makes sense. I wasn't sure whether there are others.

I've changed it so that (for now) "cli" and "principal" are valid authentication methods, with "principal" being the default when nothing is set (i.e. the current behavior).

@marwanad
Copy link
Member

@pohly yup the PR adding the functionality is reasonable. I'll take a look at the code tomorrow. Sorry for the delay!

During development it is simpler to reuse the existing credentials. Also, some
setups with Active Directory make it hard to create a service principal because
that depends on additional privileges.
@marwanad
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 21, 2021
@pohly
Copy link
Contributor Author

pohly commented Sep 21, 2021

/assign @towca

For final approval.

Copy link
Member

@feiskyer feiskyer left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: feiskyer, marwanad, pohly

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 22, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7e6e0f9 into kubernetes:master Sep 22, 2021
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. area/cluster-autoscaler area/provider/azure Issues or PRs related to azure provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants