Skip to content

AdditionalLabels are not added to all GCP resources #1274

@bfournie

Description

@bfournie

/kind bug

Both the GCPClusterSpec and GCPMachineSpec have AdditionalLabels fields to add user-defined labels to the resources

e.g.
https://github.com/bfournie/cluster-api-provider-gcp/blob/main/api/v1beta1/gcpcluster_types.go#L55

     // AdditionalLabels is an optional set of tags to add to GCP resources managed by the GCP provider, in addition to the
       // ones added by default.
       // +optional
       AdditionalLabels Labels `json:"additionalLabels,omitempty"

We can see these labels being added to an instance here:
https://github.com/bfournie/cluster-api-provider-gcp/blob/main/cloud/scope/machine.go#L398

However other resources also take the Labels and this field is not being set, for example Disks, ForwardingRules, Addresses etc. (see https://raw.githubusercontent.com/googleapis/google-api-go-client/main/compute/v1/compute-gen.go)

What did you expect to happen:

The Labels field should be populated from AdditionalLabels for resources that have this field.

Anything else you would like to add:
Doing a openshift install using the capg-provider with the AdditionalLabels input set in the GCPCluster

Results in the instances getting the label

$ gcloud compute instances describe <instance-name>
...
labels:
  foo: bar

But no other resources get this label.

Environment:

Openshift 4.16 using capg provider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions