From 5e4780e5baca9be73623d3c6281334b5ccabaca4 Mon Sep 17 00:00:00 2001 From: Chai Bot Date: Wed, 12 Aug 2026 17:38:04 +0000 Subject: [PATCH] OCPSTRAT-3624: Add Licenses field to GCPDisk struct Add a Licenses field to GCPDisk to allow users to specify license URLs on disks for BYOL and software licensing tracking. Licenses accept both the full URL format (https://www.googleapis.com/compute/v1/projects/.../global/licenses/...) and the short self-link format (projects/.../global/licenses/...). Co-Authored-By: Claude Opus 4.6 --- machine/v1beta1/types_gcpprovider.go | 15 ++++++++++++++ machine/v1beta1/zz_generated.deepcopy.go | 5 +++++ .../zz_generated.swagger_doc_generated.go | 1 + .../generated_openapi/zz_generated.openapi.go | 20 +++++++++++++++++++ openapi/openapi.json | 9 +++++++++ 5 files changed, 50 insertions(+) diff --git a/machine/v1beta1/types_gcpprovider.go b/machine/v1beta1/types_gcpprovider.go index 9713a4e4a87..4e608b155d8 100644 --- a/machine/v1beta1/types_gcpprovider.go +++ b/machine/v1beta1/types_gcpprovider.go @@ -244,6 +244,21 @@ type GCPDisk struct { // encryptionKey is the customer-supplied encryption key of the disk. // +optional EncryptionKey *GCPEncryptionKeyReference `json:"encryptionKey,omitempty"` + // licenses is a list of URLs of license resources attached to this disk. + // License URLs must match either the full URL format + // (https://www.googleapis.com/compute/v1/projects/{project}/global/licenses/{license}) + // or the short self-link format (projects/{project}/global/licenses/{license}). + // Each license URL must be at least 1 character and must not exceed 256 characters. + // When specified, at least 1 and a maximum of 8 licenses may be provided. + // When omitted, no additional licenses are applied. + // +optional + // +listType=atomic + // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=8 + // +kubebuilder:validation:items:MinLength=1 + // +kubebuilder:validation:items:MaxLength=256 + // +kubebuilder:validation:items:Pattern=`^https?://.+|projects/.+/global/licenses/.+$` + Licenses []string `json:"licenses,omitempty"` } // GCPMetadata describes metadata for GCP. diff --git a/machine/v1beta1/zz_generated.deepcopy.go b/machine/v1beta1/zz_generated.deepcopy.go index 63b9bb5ff81..09ce3433057 100644 --- a/machine/v1beta1/zz_generated.deepcopy.go +++ b/machine/v1beta1/zz_generated.deepcopy.go @@ -696,6 +696,11 @@ func (in *GCPDisk) DeepCopyInto(out *GCPDisk) { *out = new(GCPEncryptionKeyReference) (*in).DeepCopyInto(*out) } + if in.Licenses != nil { + in, out := &in.Licenses, &out.Licenses + *out = make([]string, len(*in)) + copy(*out, *in) + } return } diff --git a/machine/v1beta1/zz_generated.swagger_doc_generated.go b/machine/v1beta1/zz_generated.swagger_doc_generated.go index e686cad25a6..d71507f3746 100644 --- a/machine/v1beta1/zz_generated.swagger_doc_generated.go +++ b/machine/v1beta1/zz_generated.swagger_doc_generated.go @@ -436,6 +436,7 @@ var map_GCPDisk = map[string]string{ "image": "image is the source image to create this disk.", "labels": "labels list of labels to apply to the disk.", "encryptionKey": "encryptionKey is the customer-supplied encryption key of the disk.", + "licenses": "licenses is a list of URLs of license resources attached to this disk. License URLs must match either the full URL format (https://www.googleapis.com/compute/v1/projects/{project}/global/licenses/{license}) or the short self-link format (projects/{project}/global/licenses/{license}). Each license URL must be at least 1 character and must not exceed 256 characters. When specified, at least 1 and a maximum of 8 licenses may be provided. When omitted, no additional licenses are applied.", } func (GCPDisk) SwaggerDoc() map[string]string { diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index fbb8d32f7e7..5548a6d3ec7 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -45885,6 +45885,26 @@ func schema_openshift_api_machine_v1beta1_GCPDisk(ref common.ReferenceCallback) Ref: ref(machinev1beta1.GCPEncryptionKeyReference{}.OpenAPIModelName()), }, }, + "licenses": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "licenses is a list of URLs of license resources attached to this disk. License URLs must match either the full URL format (https://www.googleapis.com/compute/v1/projects/{project}/global/licenses/{license}) or the short self-link format (projects/{project}/global/licenses/{license}). Each license URL must be at least 1 character and must not exceed 256 characters. When specified, at least 1 and a maximum of 8 licenses may be provided. When omitted, no additional licenses are applied.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, }, Required: []string{"autoDelete", "boot", "sizeGb", "type", "image", "labels"}, }, diff --git a/openapi/openapi.json b/openapi/openapi.json index 2c13f336217..5ab0c09987e 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -26466,6 +26466,15 @@ "default": "" } }, + "licenses": { + "description": "licenses is a list of URLs of license resources attached to this disk. License URLs must match either the full URL format (https://www.googleapis.com/compute/v1/projects/{project}/global/licenses/{license}) or the short self-link format (projects/{project}/global/licenses/{license}). Each license URL must be at least 1 character and must not exceed 256 characters. When specified, at least 1 and a maximum of 8 licenses may be provided. When omitted, no additional licenses are applied.", + "type": "array", + "items": { + "type": "string", + "default": "" + }, + "x-kubernetes-list-type": "atomic" + }, "sizeGb": { "description": "sizeGb is the size of the disk (in GB).", "type": "integer",