Skip to content

Conversation

@CecileRobertMichon
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it: This fixes Certificate auth for AAD pod identity. It was already supported according to docs but never worked properly https://capz.sigs.k8s.io/topics/multitenancy.html#service-principal-identity.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #2250

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Add support for Service Principal with Certificate auth 

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 22, 2022
@CecileRobertMichon
Copy link
Contributor Author

/cc @chewong @aramase

@CecileRobertMichon CecileRobertMichon force-pushed the fix-certificate-auth branch 2 times, most recently from 23c553f to ba1be3d Compare April 22, 2022 20:48
@CecileRobertMichon
Copy link
Contributor Author

/retest

1 similar comment
@CecileRobertMichon
Copy link
Contributor Author

/retest

@kfox1111
Copy link

lgtm


// IdentityType represents different types of identities.
// +kubebuilder:validation:Enum=ServicePrincipal;ManualServicePrincipal;UserAssignedMSI
// +kubebuilder:validation:Enum=ServicePrincipal;ManualServicePrincipal;ServicePrincipalCertificate
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like a breaking change, is that intended/allowed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It technically breaking but in practice, no one should be broken by the change. Right now if you set it to UserAssignedMSI it won't work and just throw a validation error in the controller. It has never been supported and there is an issue to add support for it (planning on working on that next). I could leave it as-is but IMO this is an improvement as it's better to fail the user right away if they try to use an unsupported value than to let them create the resource and later fail in the controller.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense!

Copy link
Contributor

@jackfrancis jackfrancis left a comment

Choose a reason for hiding this comment

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

lgtm

@CecileRobertMichon
Copy link
Contributor Author

/assign @mboersma

Copy link
Contributor

@mboersma mboersma left a comment

Choose a reason for hiding this comment

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

/lgtm

// AzureClusterIdentitySpec defines the parameters that are used to create an AzureIdentity.
type AzureClusterIdentitySpec struct {
// UserAssignedMSI or Service Principal
// Type is the type of Azure Identity used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Type is the type of Azure Identity used.
// IdentityType is the type of Azure Identity used.

Although since this field is just type in its JSON representation, making this a proper Go comment here will create a naming discrepancy in the generated CRD description. I still think that would be more correct, but I am not invested in this change. 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Type is the name of the field too... IdentityType is the type of the field (this is confusing!) :D

So I think Type is more correct

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right--so hard to read when things "stutter" like that.

Copy link
Contributor

Choose a reason for hiding this comment

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

🤯

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 28, 2022
@mboersma
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mboersma

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 Apr 28, 2022
@k8s-ci-robot k8s-ci-robot merged commit c536cf1 into kubernetes-sigs:main Apr 28, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Apr 28, 2022
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

login trying too aggressively

5 participants