cluster-api-provider-azure icon indicating copy to clipboard operation
cluster-api-provider-azure copied to clipboard

Migrate from "getting full resource to get tags" to "just getting tags at resource scope"

Open karuppiah7890 opened this issue 3 years ago • 13 comments

This is based on https://github.com/kubernetes-sigs/cluster-api-provider-azure/pull/1745#discussion_r741488690

For example, in this method

https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/1a16f42bc104b6a8f5931dcb36f7c5ca184ff4e3/azure/services/publicips/publicips.go#L142-L151

We need to replace GET public IP API call (s.Client.Get) with GET Tags At Scope API call with Public IP as scope to just get the tags as we want only tag data to check if Public IP is managed or not. A GET public IP API call is heavier with more data and hence unnecessary.

References -

  • GET public IP API call - https://docs.microsoft.com/en-us/rest/api/virtualnetwork/public-ip-addresses/get
  • GET Tags At Scope API call - https://docs.microsoft.com/en-us/rest/api/resources/tags/get-at-scope

cc @CecileRobertMichon

karuppiah7890 avatar Nov 30 '21 11:11 karuppiah7890

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-triage-robot avatar Feb 28 '22 12:02 k8s-triage-robot

/remove-lifecycle stale /help

CecileRobertMichon avatar Feb 28 '22 18:02 CecileRobertMichon

@CecileRobertMichon: This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

/remove-lifecycle stale /help

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 avatar Feb 28 '22 18:02 k8s-ci-robot

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-triage-robot avatar May 29 '22 19:05 k8s-triage-robot

/remove-lifecycle stale

CecileRobertMichon avatar May 31 '22 17:05 CecileRobertMichon

@Jont828 this might be a good one for you to pick up as a follow up from #1716 and #1716

CecileRobertMichon avatar May 31 '22 17:05 CecileRobertMichon

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-triage-robot avatar Aug 29 '22 18:08 k8s-triage-robot

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-triage-robot avatar Sep 28 '22 18:09 k8s-triage-robot

Sorry I forgot about this, I can take a look and work on this soon.

Jont828 avatar Sep 28 '22 23:09 Jont828

/assign

Jont828 avatar Sep 28 '22 23:09 Jont828

@CecileRobertMichon @karuppiah7890 I'm currently taking a look at this and I had a couple things to clarify.

  1. Is the public IP scope in this case just the resource ID?
  2. Is the intended change to initialize the tags client and use that instead?

Jont828 avatar Oct 11 '22 00:10 Jont828

/remove-lifecycle rotten

  1. Yes, it should be
  2. Yes exactly. There is already a GetAtScope function we can use.

CecileRobertMichon avatar Oct 11 '22 00:10 CecileRobertMichon

Okay sounds good. I'll revisit #2210 as well and see if we can make some changes to the tags service to make it easier to use here.

Jont828 avatar Oct 11 '22 00:10 Jont828