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

feat: support adding ResourceManagerTags to compute instances #1

Merged
merged 80 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
cb17cb1
Bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0
dependabot[bot] Aug 28, 2023
c9eb9c1
Update Makefile
cpanato Aug 29, 2023
eb65f59
Merge pull request #1009 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Aug 29, 2023
bc5faa1
chore: approve actions on ok-to-test
richardcase Aug 31, 2023
4d8b183
Merge pull request #1010 from richardcase/gha_auto_approve
k8s-ci-robot Aug 31, 2023
682457a
Support master authorized network config (#65)
yuecong Aug 15, 2023
01af3be
Merge pull request #1004 from yuecong/support-master-authorized-netwo…
k8s-ci-robot Sep 1, 2023
ee2aec9
Bump golang.org/x/net from 0.14.0 to 0.15.0
dependabot[bot] Sep 11, 2023
1b2f67f
Merge pull request #1013 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 11, 2023
e089530
Bump google.golang.org/grpc from 1.57.0 to 1.58.0
dependabot[bot] Sep 11, 2023
aa0c0c4
Merge pull request #1015 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 11, 2023
b78b73f
Bump google.golang.org/api from 0.138.0 to 0.139.0
dependabot[bot] Sep 11, 2023
44bd891
Merge pull request #1014 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 12, 2023
deac6be
build(deps): Bump cloud.google.com/go/container from 1.25.0 to 1.26.0
dependabot[bot] Sep 18, 2023
12da58a
build(deps): Bump google.golang.org/api from 0.139.0 to 0.141.0
dependabot[bot] Sep 18, 2023
eb94255
Merge pull request #1020 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Sep 19, 2023
666117d
Merge pull request #1022 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 19, 2023
b6e79f9
build(deps): Bump google.golang.org/grpc from 1.58.0 to 1.58.1
dependabot[bot] Sep 19, 2023
5df0281
Merge pull request #1021 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 19, 2023
f16ae33
build(deps): Bump google.golang.org/grpc from 1.58.1 to 1.58.2
dependabot[bot] Sep 25, 2023
df0fd32
build(deps): Bump github.com/onsi/ginkgo/v2 from 2.12.0 to 2.12.1
dependabot[bot] Sep 25, 2023
f04917e
Merge pull request #1028 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 25, 2023
2d18f13
build(deps): Bump google.golang.org/api from 0.141.0 to 0.142.0
dependabot[bot] Sep 25, 2023
a90b328
Update Makefile
cpanato Sep 25, 2023
9adbde2
Merge pull request #1029 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 25, 2023
2e5725a
Merge pull request #1030 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Sep 25, 2023
7e2f428
build(deps): Bump google.golang.org/api from 0.142.0 to 0.143.0
dependabot[bot] Oct 2, 2023
f6be760
build(deps): Bump github.com/onsi/gomega from 1.27.10 to 1.28.0
dependabot[bot] Oct 2, 2023
a771bb9
Merge pull request #1033 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 2, 2023
8bb4d82
Merge pull request #1032 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 2, 2023
26c8e07
build(deps): Bump github.com/onsi/ginkgo/v2 from 2.12.1 to 2.13.0
dependabot[bot] Oct 9, 2023
aa4f867
build(deps): Bump golang.org/x/mod from 0.12.0 to 0.13.0
dependabot[bot] Oct 9, 2023
9976f00
Merge pull request #1038 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 10, 2023
d535449
build(deps): Bump golang.org/x/crypto from 0.13.0 to 0.14.0
dependabot[bot] Oct 10, 2023
ee9d130
Merge pull request #1035 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 10, 2023
d48e91b
Update Makefile
cpanato Oct 10, 2023
dbe6091
build(deps): Bump golang.org/x/net from 0.15.0 to 0.16.0
dependabot[bot] Oct 10, 2023
077f213
Merge pull request #1036 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 10, 2023
3382bfe
Merge pull request #1037 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 10, 2023
58fc575
build(deps): Bump google.golang.org/api from 0.143.0 to 0.146.0
dependabot[bot] Oct 10, 2023
f1ea132
Merge pull request #1039 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 10, 2023
3d332fc
build(deps): Bump cloud.google.com/go/compute from 1.23.0 to 1.23.1
dependabot[bot] Oct 16, 2023
269df52
build(deps): Bump cloud.google.com/go/iam from 1.1.2 to 1.1.3
dependabot[bot] Oct 16, 2023
ba84c46
build(deps): Bump google.golang.org/grpc from 1.58.2 to 1.58.3
dependabot[bot] Oct 16, 2023
267a394
Merge pull request #1045 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 17, 2023
dc74892
Merge pull request #1042 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Oct 17, 2023
a093d7d
Merge pull request #1043 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Oct 17, 2023
fa9845e
build(deps): Bump google.golang.org/api from 0.146.0 to 0.147.0
dependabot[bot] Oct 17, 2023
76b7396
build(deps): Bump github.com/google/go-cmp from 0.5.9 to 0.6.0
dependabot[bot] Oct 17, 2023
cc196f2
build(deps): Bump cloud.google.com/go/container from 1.26.0 to 1.26.1
dependabot[bot] Oct 17, 2023
6c80ca9
Merge pull request #1048 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 17, 2023
9fb106b
Merge pull request #1044 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 17, 2023
ee0bd43
Merge pull request #1046 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Oct 17, 2023
5429939
update k8s version for testing and go to 1.20.8
cpanato Sep 15, 2023
f233a11
using ubuntu 2204 and update capi image creation
cpanato Sep 15, 2023
853d6ca
update calico to v3.26.1
cpanato Sep 17, 2023
7bed424
introduce cloud-provider-gce ccm
cpanato Sep 17, 2023
5493980
using the staging image for ccm
cpanato Oct 21, 2023
c82901c
Merge pull request #1018 from cpanato/update-k8s-test
k8s-ci-robot Oct 23, 2023
9d16fc0
build(deps): Bump github.com/onsi/gomega from 1.28.0 to 1.28.1
dependabot[bot] Oct 23, 2023
a65850b
build(deps): Bump google.golang.org/grpc from 1.58.3 to 1.59.0
dependabot[bot] Oct 23, 2023
ac989ab
Merge pull request #1050 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 23, 2023
4b4214c
build(deps): Bump google.golang.org/api from 0.147.0 to 0.148.0
dependabot[bot] Oct 23, 2023
ad67f47
Merge pull request #1049 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 23, 2023
11da9ad
Merge pull request #1051 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 24, 2023
02a61ff
update CAPI to 1.5.3
cpanato Oct 26, 2023
cb295a4
Merge pull request #1055 from cpanato/updatecapi1.5
k8s-ci-robot Oct 26, 2023
908e903
update metadata file to add the 1.5 releases
cpanato Oct 27, 2023
ae6749f
Merge pull request #1056 from cpanato/update-metadata
k8s-ci-robot Oct 27, 2023
3a44916
build(deps): Bump github.com/onsi/gomega from 1.28.1 to 1.29.0
dependabot[bot] Oct 30, 2023
de0f518
build(deps): Bump github.com/go-logr/logr from 1.2.4 to 1.3.0
dependabot[bot] Oct 30, 2023
8af9fb3
Merge pull request #1062 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 30, 2023
9f7d650
build(deps): Bump cloud.google.com/go/container from 1.26.1 to 1.26.2
dependabot[bot] Oct 30, 2023
3ce7f5e
Merge pull request #1061 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Oct 31, 2023
9228623
build(deps): Bump cloud.google.com/go/iam from 1.1.3 to 1.1.4
dependabot[bot] Oct 31, 2023
c4f3400
build(deps): Bump cloud.google.com/go/compute from 1.23.1 to 1.23.2
dependabot[bot] Oct 31, 2023
173829c
Merge pull request #1059 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Oct 31, 2023
bb8943f
Merge pull request #1060 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Oct 31, 2023
e102655
Merge pull request #1063 from kubernetes-sigs/dependabot/go_modules/c…
k8s-ci-robot Oct 31, 2023
2b58598
feat: support adding resource manager tags to gcp resources
salasberryfin Aug 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/pr-gh-workflow-approve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PR approve GH Workflows

on:
pull_request_target:
types:
- edited
- labeled
- reopened
- synchronize

jobs:
approve:
name: Approve ok-to-test
if: contains(github.event.pull_request.labels.*.name, 'ok-to-test')
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Update PR
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
continue-on-error: true
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
event: "pull_request",
status: "action_required",
head_sha: context.payload.pull_request.head.sha,
per_page: 100
});

for (var run of result.data.workflow_runs) {
await github.rest.actions.approveWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id
});
}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

# Build the manager binary
FROM golang:1.20.6@sha256:b6c53162b13ec2ac1c725078671dbff289d9e723c045c27d73eacf0a50893598 as builder
FROM golang:1.20.10@sha256:098d628490c97d4419ed44a23d893f37b764f3bea06e0827183e8af4120e19be as builder
WORKDIR /workspace

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand All @@ -38,7 +38,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} \
-o manager .

# Copy the controller-manager into a thin image
FROM gcr.io/distroless/static:latest
FROM cgr.dev/chainguard/static:latest
WORKDIR /
COPY --from=builder /workspace/manager .
USER nobody
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ RELEASE_NOTES_VER := v0.11.0
RELEASE_NOTES_BIN := release-notes
RELEASE_NOTES := $(TOOLS_BIN_DIR)/$(RELEASE_NOTES_BIN)-$(RELEASE_NOTES_VER)

GINKGO_VER := v2.11.0
GINKGO_VER := v2.13.0
GINKGO_BIN := ginkgo
GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER)
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo

KUBECTL_VER := v1.25.10
KUBECTL_VER := v1.27.3
KUBECTL_BIN := kubectl
KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER)

Expand Down Expand Up @@ -140,7 +140,7 @@ endif
# Build time versioning details.
LDFLAGS := $(shell hack/version.sh)

GOLANG_VERSION := 1.20.6
GOLANG_VERSION := 1.20.8

# CI
CAPG_WORKER_CLUSTER_KUBECONFIG ?= "/tmp/kubeconfig"
Expand Down Expand Up @@ -473,7 +473,7 @@ create-management-cluster: $(KUSTOMIZE) $(ENVSUBST) $(KIND) $(KUBECTL)
./hack/install-cert-manager.sh

# Deploy CAPI
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.0/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -
curl --retry $(CURL_RETRIES) -sSL https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.3/cluster-api-components.yaml | $(ENVSUBST) | $(KUBECTL) apply -f -

# Deploy CAPG
$(KIND) load docker-image $(CONTROLLER_IMG)-$(ARCH):$(TAG) --name=clusterapi
Expand Down
4 changes: 2 additions & 2 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ settings = {
"deploy_cert_manager": True,
"preload_images_for_kind": True,
"kind_cluster_name": "capg",
"capi_version": "v1.5.0",
"capi_version": "v1.5.3",
"cert_manager_version": "v1.11.0",
"kubernetes_version": "v1.26.1",
"kubernetes_version": "v1.27.3",
}

keys = ["GCP_B64ENCODED_CREDENTIALS"]
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha3/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions api/v1alpha4/gcpcluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func (src *GCPCluster) ConvertTo(dstRaw conversion.Hub) error { // nolint
dst.Spec.CredentialsRef = restored.Spec.CredentialsRef.DeepCopy()
}

for _, restoredTag := range restored.Spec.ResourceManagerTags {
dst.Spec.ResourceManagerTags = append(dst.Spec.ResourceManagerTags, *restoredTag.DeepCopy())
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha4/gcpclustertemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (src *GCPClusterTemplate) ConvertTo(dstRaw conversion.Hub) error { // nolin
dst.Spec.Template.Spec.CredentialsRef = restored.Spec.Template.Spec.CredentialsRef.DeepCopy()
}

for _, restoredTag := range restored.Spec.Template.Spec.ResourceManagerTags {
dst.Spec.Template.Spec.ResourceManagerTags = append(dst.Spec.Template.Spec.ResourceManagerTags, *restoredTag.DeepCopy())
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha4/gcpmachine_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ func (src *GCPMachine) ConvertTo(dstRaw conversion.Hub) error { // nolint
dst.Spec.ConfidentialCompute = restored.Spec.ConfidentialCompute
}

if restored.Spec.ResourceManagerTags != nil {
dst.Spec.ResourceManagerTags = restored.Spec.ResourceManagerTags
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions api/v1alpha4/gcpmachinetemplate_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ func (src *GCPMachineTemplate) ConvertTo(dstRaw conversion.Hub) error { // nolin
dst.Spec.Template.Spec.ConfidentialCompute = restored.Spec.Template.Spec.ConfidentialCompute
}

if restored.Spec.Template.Spec.ResourceManagerTags != nil {
dst.Spec.Template.Spec.ResourceManagerTags = restored.Spec.Template.Spec.ResourceManagerTags
}

return nil
}

Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha4/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/v1beta1/gcpcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ type GCPClusterSpec struct {
// +optional
AdditionalLabels Labels `json:"additionalLabels,omitempty"`

// ResourceManagerTags is an optional set of tags to apply to GCP resources managed
// by the GCP provider. GCP supports a maximum of 50 tags per resource.
// +maxItems=50
// +optional
ResourceManagerTags ResourceManagerTags `json:"resourceManagerTags,omitempty"`

// CredentialsRef is a reference to a Secret that contains the credentials to use for provisioning this cluster. If not
// supplied then the credentials of the controller will be used.
// +optional
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta1/gcpmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ type GCPMachineSpec struct {
// +optional
AdditionalNetworkTags []string `json:"additionalNetworkTags,omitempty"`

// ResourceManagerTags is an optional set of tags to apply to GCP resources managed
// by the GCP provider. GCP supports a maximum of 50 tags per resource.
// +maxItems=50
// +optional
ResourceManagerTags ResourceManagerTags `json:"resourceManagerTags,omitempty"`

// RootDeviceSize is the size of the root volume in GB.
// Defaults to 30.
// +optional
Expand Down
64 changes: 64 additions & 0 deletions api/v1beta1/tags.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
Copyright 2023 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1

// ResourceManagerTags is an slice of ResourceManagerTag structs.
type ResourceManagerTags []ResourceManagerTag

// ResourceManagerTagsMap defines a map of key value pairs as expected by compute.InstanceParams.ResourceManagerTags.
type ResourceManagerTagsMap map[string]string

// ResourceManagerTag is a tag to apply to GCP resources managed by the GCP provider.
type ResourceManagerTag struct {
// ParentID is the ID of the hierarchical resource where the tags are defined
// e.g. at the Organization or the Project level. To find the Organization or Project ID ref
// https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id
// https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects
// An OrganizationID must consist of decimal numbers, and cannot have leading zeroes.
// A ProjectID must be 6 to 30 characters in length, can only contain lowercase letters,
// numbers, and hyphens, and must start with a letter, and cannot end with a hyphen.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=32
// +kubebuilder:validation:Pattern=`(^[1-9][0-9]{0,31}$)|(^[a-z][a-z0-9-]{4,28}[a-z0-9]$)`
ParentID string `json:"parentID"`

// Key is the key part of the tag. A tag key can have a maximum of 63 characters and cannot
// be empty. Tag key must begin and end with an alphanumeric character, and must contain
// only uppercase, lowercase alphanumeric characters, and the following special
// characters `._-`.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([0-9A-Za-z_.-]{0,61}[a-zA-Z0-9])?$`
Key string `json:"key"`

// Value is the value part of the tag. A tag value can have a maximum of 63 characters and
// cannot be empty. Tag value must begin and end with an alphanumeric character, and must
// contain only uppercase, lowercase alphanumeric characters, and the following special
// characters `_-.@%=+:,*#&(){}[]` and spaces.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([0-9A-Za-z_.@%=+:,*#&()\[\]{}\-\s]{0,61}[a-zA-Z0-9])?$`
Value string `json:"value"`
}

// Merge merges resource manager tags in receiver and other.
func (t *ResourceManagerTags) Merge(other ResourceManagerTags) {
*t = append(*t, other...)
}
65 changes: 65 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions cloud/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type ClusterGetter interface {
AdditionalLabels() infrav1.Labels
FailureDomains() clusterv1.FailureDomains
ControlPlaneEndpoint() clusterv1.APIEndpoint
ResourceManagerTags() infrav1.ResourceManagerTags
}

// ClusterSetter is an interface which can set cluster information.
Expand Down
17 changes: 17 additions & 0 deletions cloud/scope/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
computerest "cloud.google.com/go/compute/apiv1"
container "cloud.google.com/go/container/apiv1"
credentials "cloud.google.com/go/iam/credentials/apiv1"
resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
"github.com/GoogleCloudPlatform/k8s-cloud-provider/pkg/cloud"
"github.com/pkg/errors"
"google.golang.org/api/compute/v1"
Expand Down Expand Up @@ -143,3 +144,19 @@ func newInstanceGroupManagerClient(ctx context.Context, credentialsRef *infrav1.

return instanceGroupManagersClient, nil
}

func newTagBindingsClient(ctx context.Context, credentialsRef *infrav1.ObjectReference, crClient client.Client, location string) (*resourcemanager.TagBindingsClient, error) {
opts, err := defaultClientOptions(ctx, credentialsRef, crClient)
endpoint := fmt.Sprintf("%s-cloudresourcemanager.googleapis.com:443", location)
opts = append(opts, option.WithEndpoint(endpoint))
if err != nil {
return nil, fmt.Errorf("getting default gcp client options: %w", err)
}

client, err := resourcemanager.NewTagBindingsClient(ctx, opts...)
if err != nil {
return nil, errors.Errorf("failed to create gcp tag binding client: %v", err)
}

return client, nil
}
Loading
Loading