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

Replace more usages of go-autorest #4775

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

mboersma
Copy link
Contributor

@mboersma mboersma commented Apr 24, 2024

/kind cleanup

What this PR does / why we need it:

Replaces several usages of the deprecated Azure/go-autorest library.

Which issue(s) this PR fixes:

Refs #2974

Special notes for your reviewer:

There's more to do still, but this moves the ball forward.

  • cherry-pick candidate

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 24, 2024
Copy link

codecov bot commented Apr 24, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 62.44%. Comparing base (f71c5ed) to head (b6e2153).
Report is 4 commits behind head on main.

Files Patch % Lines
azure/scope/clients.go 86.36% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4775      +/-   ##
==========================================
+ Coverage   62.35%   62.44%   +0.08%     
==========================================
  Files         196      196              
  Lines       16192    16140      -52     
==========================================
- Hits        10097    10079      -18     
+ Misses       5362     5328      -34     
  Partials      733      733              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -40,7 +37,6 @@ const AzureSecretKey = "clientSecret"

// CredentialsProvider defines the behavior for azure identity based credential providers.
type CredentialsProvider interface {
GetAuthorizer(ctx context.Context, tokenCredential azcore.TokenCredential, tokenAudience string) (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.

My dumb grep also shows this which isn't strictly related I don't think, but is also unused AFAICT:

// GetAuthorizer returns an autorest.Authorizer-compatible object from MSAL.
func GetAuthorizer(settings auth.EnvironmentSettings) (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.

also this?

func getCloudConfig(environment azureautorest.Environment) cloud.Configuration {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Your dumb grep is smarter than I was--thanks! Love to remove dead code.

@@ -47,23 +45,23 @@ func (c *AzureClients) CloudEnvironment() string {

// TenantID returns the Azure tenant id the controller runs in.
func (c *AzureClients) TenantID() string {
return c.Values[auth.TenantID]
return c.Values["AZURE_TENANT_ID"]
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like I should technically point out that constants for these would be good, but since the SDK doesn't even expose these that I can find, I'm not gonna push to do that here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's frustrating that there aren't any constants for these in the SDK. We could define them locally, but I didn't see a good common package to house them at first glance.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 25, 2024
Copy link
Contributor

@nojnhuh nojnhuh 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

/hold for squash

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 25, 2024
@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
Copy link
Contributor

LGTM label has been added.

Git tree hash: 9b9f80b62c13dfd7b68315770c619194e5dc3623

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nojnhuh

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 25, 2024
@mboersma mboersma force-pushed the autorest-in-peace branch from cd515ec to b6e2153 Compare April 25, 2024 15:59
@k8s-ci-robot k8s-ci-robot removed 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 requested a review from nojnhuh April 25, 2024 15:59
@mboersma
Copy link
Contributor Author

/hold cancel

Rebased.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 25, 2024
@nojnhuh
Copy link
Contributor

nojnhuh commented Apr 25, 2024

/lgtm

@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
Copy link
Contributor

LGTM label has been added.

Git tree hash: d842a13ecf820af08f49e3ff900cf163c596a0c5

@nojnhuh
Copy link
Contributor

nojnhuh commented Apr 25, 2024

github issue + transient regional capacity issue:
/retest

@mboersma
Copy link
Contributor Author

/retest

@mboersma mboersma added this to the v1.15 milestone Apr 25, 2024
@k8s-ci-robot k8s-ci-robot merged commit 6d229b4 into kubernetes-sigs:main Apr 25, 2024
20 checks passed
@mboersma mboersma deleted the autorest-in-peace branch April 26, 2024 14:04
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants