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

async publicips #1716

Closed
Tracked by #1702
CecileRobertMichon opened this issue Sep 21, 2021 · 15 comments · Fixed by #2317
Closed
Tracked by #1702

async publicips #1716

CecileRobertMichon opened this issue Sep 21, 2021 · 15 comments · Fixed by #2317
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Milestone

Comments

@CecileRobertMichon
Copy link
Contributor

No description provided.

@CecileRobertMichon CecileRobertMichon added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Sep 21, 2021
@karuppiah7890
Copy link
Contributor

I'm assuming no one's working on this, and also assuming that #1721 work is mostly over with maybe some discussion and final touches pending

I'll try to give this one a shot!

/assign

@karuppiah7890
Copy link
Contributor

Question: For getting tags of Public IP to check if Public IP is managed or not over here

// isIPManaged returns true if the IP has an owned tag with the cluster name as value,
// meaning that the IP's lifecycle is managed.
func (s *Service) isIPManaged(ctx context.Context, ipName string) (bool, error) {
ip, err := s.Client.Get(ctx, s.Scope.ResourceGroup(), ipName)
if err != nil {
return false, err
}
tags := converters.MapToTags(ip.Tags)
return tags.HasOwned(s.Scope.ClusterName()), nil
}

Can we replace the GET Public IP API call with GET Tags At Scope API call with Public IP as scope? I think that would make the GET API call more light weight. What do you think @CecileRobertMichon ?

@karuppiah7890
Copy link
Contributor

Regarding Delete, looks like the DELETE Public IP API Call never returns 404 Not Found according to https://docs.microsoft.com/en-us/rest/api/virtualnetwork/public-ip-addresses/delete#response . It may return some cloud errors though. If that's true then I guess in the below code, the if condition on error scenario is never executed

err = s.Client.Delete(ctx, s.Scope.ResourceGroup(), ip.Name)
if err != nil && azure.ResourceNotFound(err) {
// already deleted
continue
}

As azure.ResourceNotFound(err) will always be false according to the API docs

karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Sep 29, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Sep 29, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Sep 30, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 1, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 1, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 2, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 2, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 3, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 4, 2021
@CecileRobertMichon
Copy link
Contributor Author

CecileRobertMichon commented Oct 4, 2021

@karuppiah7890 I don't think the API docs are accurate (or at least not descriptive enough), a delete can definitely return a resource not found 404 error. Here's an example:

urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "DELETE /subscriptions/redacted/resourceGroups/group/providers/Microsoft.Network/virtualNetworks/foo?api-version=2021-02-01 HTTP/1.1" 404 97
cli.azure.cli.core.sdk.policies: Response status: 404

@CecileRobertMichon
Copy link
Contributor Author

Can we replace the GET Public IP API call with GET Tags At Scope API call with Public IP as scope? I think that would make the GET API call more light weight.

+1

@karuppiah7890
Copy link
Contributor

karuppiah7890 commented Oct 5, 2021

@karuppiah7890 I don't think the API docs are accurate (or at least not descriptive enough), a delete can definitely return a resource not found 404 error. Here's an example:

urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "DELETE /subscriptions/redacted/resourceGroups/group/providers/Microsoft.Network/virtualNetworks/foo?api-version=2021-02-01 HTTP/1.1" 404 97
cli.azure.cli.core.sdk.policies: Response status: 404

That example is for virtual networks though, and yeah in it's API also 404 is not mentioned. I also tried the two DELETE APIs - both public IPs and virtual networks and noticed that they give 204 when trying to delete a non existent resource in a existing resource group. They do give 404 when the resource group itself does not exist. I'm wondering how in the above example 404 came up - maybe it was because of non existent resource group? Could you verify?

Also, I did take care of resource not found in the PR https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/1745/files#diff-fe943e74189aa531d871d7b774c371755043f5bd1b7e8ab14ad3d2b5fc023301R100-R103 similar to existing code, but yeah, seems like that can occur only when resource group itself is not found (probably deleted) which in turn means public IP is also not found / deleted

karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 5, 2021
@karuppiah7890
Copy link
Contributor

I tried to replace GET Public IP API call with GET Tags At Scope API call with Public IP as scope, but for that I had to get the tags client from the tags service

// newClient creates a new tags client from subscription ID.
func newClient(auth azure.Authorizer) *azureClient {
c := newTagsClient(auth.SubscriptionID(), auth.BaseURI(), auth.Authorizer())
return &azureClient{c}
}

which I exported to make it available in publicips package but then I noticed import errors. I think it's due to a cyclic dependency. I see tags service package depending on azure package and azure package depends on publicips service package, so publicips package depending on tags service package would make a full circle causing a cyclic import / cyclic dependency issue. Gotta see how we can resolve it, it's a bit of a tricky thing. I also have to export a few other things, like the azure client returned by the newClient function

// azureClient contains the Azure go-sdk Client.
type azureClient struct {
tags resources.TagsClient
}

Any thoughts on this @CecileRobertMichon ? Also, who can I request to review #1745 ?

karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 5, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Oct 5, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Nov 1, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Nov 30, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Nov 30, 2021
karuppiah7890 added a commit to karuppiah7890/issues-info that referenced this issue Nov 30, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 3, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 2, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

@CecileRobertMichon
Copy link
Contributor Author

/reopen
/unassign @karuppiah7890

If someone decides to work on this one, please see #1745 for prior work

@k8s-ci-robot
Copy link
Contributor

@CecileRobertMichon: Reopened this issue.

In response to this:

/reopen
/unassign @karuppiah7890

If someone decides to work on this one, please see #1745 for prior work

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.

@CecileRobertMichon CecileRobertMichon added this to the v1.3 milestone Mar 24, 2022
@CecileRobertMichon
Copy link
Contributor Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Mar 28, 2022
@CecileRobertMichon CecileRobertMichon modified the milestones: v1.3, v1.4 May 4, 2022
@Jont828
Copy link
Contributor

Jont828 commented May 18, 2022

/assign Jont828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
5 participants