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

custom Azure Active Directory Authority Host #4210

Conversation

Jeremy-Boyle
Copy link
Contributor

@Jeremy-Boyle Jeremy-Boyle commented Jan 25, 2024

Description
This allows custom Azure Active Directory Authority Host field to be set, this allows the configuration of the value and enables externaldns to work in private Azure environments that are not apart of the Azure SDK.

Looking for feedback on how i went about adding the fix, open to suggestions / improvements if the env route is undesired.

Inspiration for the env: https://learn.microsoft.com/en-us/azure/developer/go/azure-sdk-authorization#authentication-on-azure-stack

Issue in Azure Cloud ADK:
https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore@v1.9.1/cloud#pkg-variables

Fixes #4209

Checklist

  • Unit tests updated
  • End user documentation updated (TODO)

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 25, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @Jeremy-Boyle!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jan 25, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @Jeremy-Boyle. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 25, 2024
@szuecs szuecs changed the title Adding feature for #4209 custom Azure Active Directory Authority Host Feb 8, 2024
@szuecs
Copy link
Contributor

szuecs commented Feb 8, 2024

/ok-to-test
/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 8, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 8, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: szuecs

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 Feb 8, 2024
@szuecs
Copy link
Contributor

szuecs commented Feb 8, 2024

#4240

@@ -149,6 +149,17 @@ func getCloudConfiguration(name string) (cloud.Configuration, error) {
return cloud.AzureGovernment, nil
case "AZURECHINACLOUD":
return cloud.AzureChina, nil
case "AZURECUSTOMCLOUD":
azureAdEndpoint := os.Getenv("AZURE_AD_ENDPOINT")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this is the best way to get this. This method (getCloudConfiguration) gets called with the cloud type (e.g. "AZURECLOUD"), which comes from the config file but then we take the endpoint config from some environment variable. I think it could be better to have the endpoint config as part of the config file

Copy link
Contributor

Choose a reason for hiding this comment

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

@Jeremy-Boyle we are waiting for this one to comment or fix

@szuecs
Copy link
Contributor

szuecs commented Feb 9, 2024

please rebase the test was fixed

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2024
Signed-off-by: Jeremy-Boyle <9406398+Jeremy-Boyle@users.noreply.github.com>
@Jeremy-Boyle Jeremy-Boyle force-pushed the feature/azure-add-endpoints-4209 branch from 3ca267a to e39959d Compare February 22, 2024 17:48
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 22, 2024
@Jeremy-Boyle
Copy link
Contributor Author

Rebased

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 23, 2024
@mloiseleur
Copy link
Contributor

@Jeremy-Boyle Wdyt of @pascalgn comment ? BTW, Would you please update the documentation about this new settings ?

@Jeremy-Boyle
Copy link
Contributor Author

I haven't had a response back, I'm going to do the suggestion.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 16, 2024
@Jeremy-Boyle
Copy link
Contributor Author

@szuecs @pascalgn

Does this look good now with your recommendations ?

@pascalgn
Copy link
Contributor

Thanks for updating, I like the PR much better now. To me the PR looks good!

@@ -58,6 +58,7 @@ The following fields are used:
* `aadClientID` and `aadClientSecret` are associated with the Service Principal. This is only used with Service Principal method documented in the next section.
* `useManagedIdentityExtension` - this is set to `true` if you use either AKS Kubelet Identity or AAD Pod Identities methods documented in the next section.
* `userAssignedIdentityID` - this contains the client id from the Managed identitty when using the AAD Pod Identities method documented in the next setion.
* `activeDirectoryAuthorityHost` - this contains the uri to overwrite the default provided AAD Endpoint. This is useful for providing additional support where the endpoint is not available in the default cloud config from the [azure-sdk-for-go](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud#pkg-variables).
* `useWorkloadIdentityExtension` - this is set to `true` if you use Workload Identity method documented in the next section.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not really required I guess, but it would be super great if we could add documentation for the cloud field

// If activeDirectoryAuthorityHost is provided explicitly, override existing one in config file
if activeDirectoryAuthorityHost != "" {
cfg.ActiveDirectoryAuthorityHost = activeDirectoryAuthorityHost
}
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing I thought about: what happens if cloud is set to a non-empty value (e.g. "AZURECHINACLOUD") but activeDirectoryAuthorityHost is also set to some non-empty value. I think we should return an error in that case

@szuecs
Copy link
Contributor

szuecs commented Apr 25, 2024

/lgtm

@Jeremy-Boyle @pascalgn I guess it makes sense to add the docs, but maybe we just do it in another PR to save some time.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 25, 2024
@k8s-ci-robot k8s-ci-robot merged commit 9f81bbe into kubernetes-sigs:master Apr 25, 2024
12 checks passed
@Jeremy-Boyle
Copy link
Contributor Author

@szuecs

Is there a issue that you know of or a roadmap of when 0.14.2 will be released ? I'm assuming this would be the next release with these changes added.

@Jeremy-Boyle Jeremy-Boyle deleted the feature/azure-add-endpoints-4209 branch May 1, 2024 15:18
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

Allow Configuration of Azure Active Directory Endpoints
5 participants