-
Notifications
You must be signed in to change notification settings - Fork 223
Use SetLabels() to set ForwardingRules labels #1277
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
Conversation
|
Hi @bfournie. 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 Once the patch is verified, the new status will be reflected by the 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-sigs/prow repository. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
cpanato
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
ea8befc to
31b640b
Compare
| err = s.forwardingrules.SetLabels(ctx, key, setLabelsRequest) | ||
| if err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
| err = s.forwardingrules.SetLabels(ctx, key, setLabelsRequest) | |
| if err != nil { | |
| return nil, err | |
| } | |
| if err := s.forwardingrules.SetLabels(ctx, key, setLabelsRequest); err != nil { | |
| return nil, err | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed.
|
|
||
| // Labels on ForwardingRules must be added after resource is created | ||
| labels := s.scope.AdditionalLabels() | ||
| if !reflect.DeepEqual(labels, forwarding.Labels) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, this is a map right? So ordering should not be an issue while diffing correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is a map. There's actually a predefined function https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/main/api/v1beta1/labels.go#L29-L31 that I changed to use.
| err = s.regionalforwardingrules.SetLabels(ctx, key, setLabelsRequest) | ||
| if err != nil { | ||
| return nil, err | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
The ForwardingRules resource requires that the SetLabels() method be used to add the labels after the resource has been created.
31b640b to
e9eda6e
Compare
damdo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/assign @cpanato
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bfournie, richardcase 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 |
This picks up fix for shared VPC and labels, particularly: kubernetes-sigs/cluster-api-provider-gcp#1280 kubernetes-sigs/cluster-api-provider-gcp#1277 kubernetes-sigs/cluster-api-provider-gcp#1275
What type of PR is this?
/kind bug
What this PR does / why we need it:
The ForwardingRules resource requires that the SetLabels() method be used to add the labels after the resource has been created. This resource is different than, for example, Instances or Disks. See Issue #1276 for more information.
Which issue(s) this PR fixes
Fixes #1276
Special notes for your reviewer:
This is the comment for
ForwardingRulesin https://github.com/googleapis/google-api-go-client/blame/main/compute/v1/compute-gen.goTODOs:
Release note: