From e8cb86668b63048e786fbb0d892230a195f49f41 Mon Sep 17 00:00:00 2001 From: OpenShift CI Bot Date: Mon, 13 Apr 2026 19:51:47 +0000 Subject: [PATCH 1/5] fix(api): document valid character sets and add validation for Azure Marketplace image fields - Replace TODO comments with proper documentation for imageID, publisher, offer, and sku fields in AzureVMImage and AzureMarketplaceImage - Add kubebuilder validation pattern for offer field enforcing valid Azure Marketplace characters (alphanumeric, hyphens, underscores, periods) - Add concrete examples and links to Microsoft Learn documentation - Document expected Azure resource ID format for imageID with examples Signed-off-by: OpenShift CI Bot Commit-Message-Assisted-by: Claude (via Claude Code) --- api/hypershift/v1beta1/azure.go | 29 ++++++++++++----- .../AAA_ungated.yaml | 31 +++++++++++++++---- .../GCPPlatform.yaml | 31 +++++++++++++++---- .../OpenStack.yaml | 31 +++++++++++++++---- 4 files changed, 97 insertions(+), 25 deletions(-) diff --git a/api/hypershift/v1beta1/azure.go b/api/hypershift/v1beta1/azure.go index c99523ceedfc..26ae5cdfa6b4 100644 --- a/api/hypershift/v1beta1/azure.go +++ b/api/hypershift/v1beta1/azure.go @@ -131,7 +131,12 @@ type AzureVMImage struct { Type AzureVMImageType `json:"type"` // imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. - // TODO: What is the valid character set for this field? What about minimum and maximum lengths? + // The expected format is an Azure resource ID string. This can be a managed image or an + // Azure Compute Gallery image version, for example: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + // See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + // Azure resource naming rules and restrictions. // // +optional // +unionMember @@ -166,9 +171,11 @@ type AzureMarketplaceImage struct { ImageGeneration *AzureVMImageGeneration `json:"imageGeneration,omitempty"` // publisher is the name of the organization that created the image. - // It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + // For example, "azureopenshift", "Canonical", or "RedHat". + // It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). // It must start with a lowercase letter or a number. - // TODO: Can we explain where a user might find this value, or provide an example of one they might want to use + // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + // information on Azure Marketplace image publishers. // // +kubebuilder:validation:Pattern=`^[a-z0-9][a-z0-9-_]{2,49}$` // +kubebuilder:validation:MinLength=3 @@ -177,8 +184,14 @@ type AzureMarketplaceImage struct { Publisher string `json:"publisher,omitempty"` // offer specifies the name of a group of related images created by the publisher. - // TODO: What is the valid character set for this field? What about minimum and maximum lengths? - // + // For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + // The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + // hyphens (-), underscores (_), and periods (.). + // It must start with an alphanumeric character. + // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + // information on Azure Marketplace image offers. + // + // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9][a-zA-Z0-9._-]*$` // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=255 // +optional @@ -186,8 +199,10 @@ type AzureMarketplaceImage struct { // sku specifies an instance of an offer, such as a major release of a distribution. // For example, 22_04-lts-gen2, 8-lvm-gen2. - // The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). - // TODO: What about length limits? + // The value must be between 1 and 255 characters in length, and consist of only lowercase + // letters, numbers, hyphens (-), and underscores (_). + // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + // information on Azure Marketplace image SKUs. // // +kubebuilder:validation:Pattern=`^[a-z0-9-_]+$` // +kubebuilder:validation:MinLength=1 diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml index 9463ef0840c2..171d541e3bee 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml @@ -837,16 +837,26 @@ spec: - Gen2 type: string offer: - description: offer specifies the name of a group of - related images created by the publisher. + description: |- + offer specifies the name of a group of related images created by the publisher. + For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + hyphens (-), underscores (_), and periods (.). + It must start with an alphanumeric character. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image offers. maxLength: 255 minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string publisher: description: |- publisher is the name of the organization that created the image. - It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + For example, "azureopenshift", "Canonical", or "RedHat". + It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image publishers. maxLength: 50 minLength: 3 pattern: ^[a-z0-9][a-z0-9-_]{2,49}$ @@ -855,7 +865,10 @@ spec: description: |- sku specifies an instance of an offer, such as a major release of a distribution. For example, 22_04-lts-gen2, 8-lvm-gen2. - The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). + The value must be between 1 and 255 characters in length, and consist of only lowercase + letters, numbers, hyphens (-), and underscores (_). + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image SKUs. maxLength: 255 minLength: 1 pattern: ^[a-z0-9-_]+$ @@ -884,8 +897,14 @@ spec: has(self.version)].filter(x, x == true).size() == 4' imageID: - description: imageID is the Azure resource ID of a VHD - image to use to boot the Azure VMs from. + description: |- + imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. + The expected format is an Azure resource ID string. This can be a managed image or an + Azure Compute Gallery image version, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + Azure resource naming rules and restrictions. maxLength: 255 type: string type: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml index ea37b91c13af..3d0ccd8c79c6 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml @@ -837,16 +837,26 @@ spec: - Gen2 type: string offer: - description: offer specifies the name of a group of - related images created by the publisher. + description: |- + offer specifies the name of a group of related images created by the publisher. + For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + hyphens (-), underscores (_), and periods (.). + It must start with an alphanumeric character. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image offers. maxLength: 255 minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string publisher: description: |- publisher is the name of the organization that created the image. - It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + For example, "azureopenshift", "Canonical", or "RedHat". + It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image publishers. maxLength: 50 minLength: 3 pattern: ^[a-z0-9][a-z0-9-_]{2,49}$ @@ -855,7 +865,10 @@ spec: description: |- sku specifies an instance of an offer, such as a major release of a distribution. For example, 22_04-lts-gen2, 8-lvm-gen2. - The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). + The value must be between 1 and 255 characters in length, and consist of only lowercase + letters, numbers, hyphens (-), and underscores (_). + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image SKUs. maxLength: 255 minLength: 1 pattern: ^[a-z0-9-_]+$ @@ -884,8 +897,14 @@ spec: has(self.version)].filter(x, x == true).size() == 4' imageID: - description: imageID is the Azure resource ID of a VHD - image to use to boot the Azure VMs from. + description: |- + imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. + The expected format is an Azure resource ID string. This can be a managed image or an + Azure Compute Gallery image version, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + Azure resource naming rules and restrictions. maxLength: 255 type: string type: diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml index baed37846b3e..a4466840f929 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml @@ -837,16 +837,26 @@ spec: - Gen2 type: string offer: - description: offer specifies the name of a group of - related images created by the publisher. + description: |- + offer specifies the name of a group of related images created by the publisher. + For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + hyphens (-), underscores (_), and periods (.). + It must start with an alphanumeric character. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image offers. maxLength: 255 minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string publisher: description: |- publisher is the name of the organization that created the image. - It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + For example, "azureopenshift", "Canonical", or "RedHat". + It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image publishers. maxLength: 50 minLength: 3 pattern: ^[a-z0-9][a-z0-9-_]{2,49}$ @@ -855,7 +865,10 @@ spec: description: |- sku specifies an instance of an offer, such as a major release of a distribution. For example, 22_04-lts-gen2, 8-lvm-gen2. - The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). + The value must be between 1 and 255 characters in length, and consist of only lowercase + letters, numbers, hyphens (-), and underscores (_). + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image SKUs. maxLength: 255 minLength: 1 pattern: ^[a-z0-9-_]+$ @@ -884,8 +897,14 @@ spec: has(self.version)].filter(x, x == true).size() == 4' imageID: - description: imageID is the Azure resource ID of a VHD - image to use to boot the Azure VMs from. + description: |- + imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. + The expected format is an Azure resource ID string. This can be a managed image or an + Azure Compute Gallery image version, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + Azure resource naming rules and restrictions. maxLength: 255 type: string type: From 053e20c3a48c1e0c7768247fdd420e19935dd7eb Mon Sep 17 00:00:00 2001 From: OpenShift CI Bot Date: Mon, 13 Apr 2026 19:51:52 +0000 Subject: [PATCH 2/5] chore(api): regenerate CRDs and vendor for Azure Marketplace image validation - Revendor api/hypershift/v1beta1/azure.go with updated field docs - Regenerate NodePool CRD manifests (Default, CustomNoUpgrade, TechPreviewNoUpgrade) with new offer pattern and expanded descriptions Signed-off-by: OpenShift CI Bot Commit-Message-Assisted-by: Claude (via Claude Code) --- .../nodepools-CustomNoUpgrade.crd.yaml | 31 +++++++++++++++---- .../nodepools-Default.crd.yaml | 31 +++++++++++++++---- .../nodepools-TechPreviewNoUpgrade.crd.yaml | 31 +++++++++++++++---- .../api/hypershift/v1beta1/azure.go | 29 ++++++++++++----- 4 files changed, 97 insertions(+), 25 deletions(-) diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml index 055967ac4557..840a12571519 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml @@ -840,16 +840,26 @@ spec: - Gen2 type: string offer: - description: offer specifies the name of a group of - related images created by the publisher. + description: |- + offer specifies the name of a group of related images created by the publisher. + For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + hyphens (-), underscores (_), and periods (.). + It must start with an alphanumeric character. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image offers. maxLength: 255 minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string publisher: description: |- publisher is the name of the organization that created the image. - It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + For example, "azureopenshift", "Canonical", or "RedHat". + It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image publishers. maxLength: 50 minLength: 3 pattern: ^[a-z0-9][a-z0-9-_]{2,49}$ @@ -858,7 +868,10 @@ spec: description: |- sku specifies an instance of an offer, such as a major release of a distribution. For example, 22_04-lts-gen2, 8-lvm-gen2. - The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). + The value must be between 1 and 255 characters in length, and consist of only lowercase + letters, numbers, hyphens (-), and underscores (_). + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image SKUs. maxLength: 255 minLength: 1 pattern: ^[a-z0-9-_]+$ @@ -887,8 +900,14 @@ spec: has(self.version)].filter(x, x == true).size() == 4' imageID: - description: imageID is the Azure resource ID of a VHD - image to use to boot the Azure VMs from. + description: |- + imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. + The expected format is an Azure resource ID string. This can be a managed image or an + Azure Compute Gallery image version, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + Azure resource naming rules and restrictions. maxLength: 255 type: string type: diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml index d317df1b41ae..93c0334948da 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml @@ -840,16 +840,26 @@ spec: - Gen2 type: string offer: - description: offer specifies the name of a group of - related images created by the publisher. + description: |- + offer specifies the name of a group of related images created by the publisher. + For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + hyphens (-), underscores (_), and periods (.). + It must start with an alphanumeric character. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image offers. maxLength: 255 minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string publisher: description: |- publisher is the name of the organization that created the image. - It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + For example, "azureopenshift", "Canonical", or "RedHat". + It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image publishers. maxLength: 50 minLength: 3 pattern: ^[a-z0-9][a-z0-9-_]{2,49}$ @@ -858,7 +868,10 @@ spec: description: |- sku specifies an instance of an offer, such as a major release of a distribution. For example, 22_04-lts-gen2, 8-lvm-gen2. - The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). + The value must be between 1 and 255 characters in length, and consist of only lowercase + letters, numbers, hyphens (-), and underscores (_). + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image SKUs. maxLength: 255 minLength: 1 pattern: ^[a-z0-9-_]+$ @@ -887,8 +900,14 @@ spec: has(self.version)].filter(x, x == true).size() == 4' imageID: - description: imageID is the Azure resource ID of a VHD - image to use to boot the Azure VMs from. + description: |- + imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. + The expected format is an Azure resource ID string. This can be a managed image or an + Azure Compute Gallery image version, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + Azure resource naming rules and restrictions. maxLength: 255 type: string type: diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml index f86509004219..767779d04dd2 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml @@ -840,16 +840,26 @@ spec: - Gen2 type: string offer: - description: offer specifies the name of a group of - related images created by the publisher. + description: |- + offer specifies the name of a group of related images created by the publisher. + For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + hyphens (-), underscores (_), and periods (.). + It must start with an alphanumeric character. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image offers. maxLength: 255 minLength: 1 + pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string publisher: description: |- publisher is the name of the organization that created the image. - It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + For example, "azureopenshift", "Canonical", or "RedHat". + It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image publishers. maxLength: 50 minLength: 3 pattern: ^[a-z0-9][a-z0-9-_]{2,49}$ @@ -858,7 +868,10 @@ spec: description: |- sku specifies an instance of an offer, such as a major release of a distribution. For example, 22_04-lts-gen2, 8-lvm-gen2. - The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). + The value must be between 1 and 255 characters in length, and consist of only lowercase + letters, numbers, hyphens (-), and underscores (_). + See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + information on Azure Marketplace image SKUs. maxLength: 255 minLength: 1 pattern: ^[a-z0-9-_]+$ @@ -887,8 +900,14 @@ spec: has(self.version)].filter(x, x == true).size() == 4' imageID: - description: imageID is the Azure resource ID of a VHD - image to use to boot the Azure VMs from. + description: |- + imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. + The expected format is an Azure resource ID string. This can be a managed image or an + Azure Compute Gallery image version, for example: + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + Azure resource naming rules and restrictions. maxLength: 255 type: string type: diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go index c99523ceedfc..26ae5cdfa6b4 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go @@ -131,7 +131,12 @@ type AzureVMImage struct { Type AzureVMImageType `json:"type"` // imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. - // TODO: What is the valid character set for this field? What about minimum and maximum lengths? + // The expected format is an Azure resource ID string. This can be a managed image or an + // Azure Compute Gallery image version, for example: + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} + // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} + // See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for + // Azure resource naming rules and restrictions. // // +optional // +unionMember @@ -166,9 +171,11 @@ type AzureMarketplaceImage struct { ImageGeneration *AzureVMImageGeneration `json:"imageGeneration,omitempty"` // publisher is the name of the organization that created the image. - // It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). + // For example, "azureopenshift", "Canonical", or "RedHat". + // It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). // It must start with a lowercase letter or a number. - // TODO: Can we explain where a user might find this value, or provide an example of one they might want to use + // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + // information on Azure Marketplace image publishers. // // +kubebuilder:validation:Pattern=`^[a-z0-9][a-z0-9-_]{2,49}$` // +kubebuilder:validation:MinLength=3 @@ -177,8 +184,14 @@ type AzureMarketplaceImage struct { Publisher string `json:"publisher,omitempty"` // offer specifies the name of a group of related images created by the publisher. - // TODO: What is the valid character set for this field? What about minimum and maximum lengths? - // + // For example, "RHEL", "WindowsServer", or "0001-com-ubuntu-server-jammy". + // The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), + // hyphens (-), underscores (_), and periods (.). + // It must start with an alphanumeric character. + // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + // information on Azure Marketplace image offers. + // + // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9][a-zA-Z0-9._-]*$` // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=255 // +optional @@ -186,8 +199,10 @@ type AzureMarketplaceImage struct { // sku specifies an instance of an offer, such as a major release of a distribution. // For example, 22_04-lts-gen2, 8-lvm-gen2. - // The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (_). - // TODO: What about length limits? + // The value must be between 1 and 255 characters in length, and consist of only lowercase + // letters, numbers, hyphens (-), and underscores (_). + // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more + // information on Azure Marketplace image SKUs. // // +kubebuilder:validation:Pattern=`^[a-z0-9-_]+$` // +kubebuilder:validation:MinLength=1 From 8d77a86241d2268596a4b8e4e0de65ce1d66b2fa Mon Sep 17 00:00:00 2001 From: OpenShift CI Bot Date: Mon, 13 Apr 2026 19:51:57 +0000 Subject: [PATCH 3/5] test(e2e): fix whitespace alignment in karpenter ARM64 test - Correct map literal alignment for armNodeLabels in testARM64Provisioning Signed-off-by: OpenShift CI Bot Commit-Message-Assisted-by: Claude (via Claude Code) --- test/e2e/karpenter_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/karpenter_test.go b/test/e2e/karpenter_test.go index a9faf4c9d3c0..3b68c2df9fe0 100644 --- a/test/e2e/karpenter_test.go +++ b/test/e2e/karpenter_test.go @@ -209,7 +209,7 @@ func testARM64Provisioning(ctx context.Context, guestClient crclient.Client, hos armNodeLabels := map[string]string{ karpenterv1.NodePoolLabelKey: armNodePool.Name, - "kubernetes.io/arch": "arm64", + "kubernetes.io/arch": "arm64", } nodes := e2eutil.WaitForReadyNodesByLabels(t, ctx, guestClient, hostedCluster.Spec.Platform.Type, 1, armNodeLabels) From 1fd2eafa97f6631d9e4c47e137a11c17c1abfb9b Mon Sep 17 00:00:00 2001 From: OpenShift CI Bot Date: Mon, 13 Apr 2026 19:52:00 +0000 Subject: [PATCH 4/5] docs: regenerate API reference for Azure Marketplace image fields - Update api.md and aggregated-docs.md with improved field descriptions, examples, and documentation links for Azure Marketplace image types Signed-off-by: OpenShift CI Bot Commit-Message-Assisted-by: Claude (via Claude Code) --- api/hypershift/v1beta1/azure.go | 2 +- .../AAA_ungated.yaml | 2 +- .../GCPPlatform.yaml | 2 +- .../OpenStack.yaml | 2 +- .../nodepools-CustomNoUpgrade.crd.yaml | 2 +- .../nodepools-Default.crd.yaml | 2 +- .../nodepools-TechPreviewNoUpgrade.crd.yaml | 2 +- docs/content/reference/aggregated-docs.md | 26 ++++++++++++++----- docs/content/reference/api.md | 26 ++++++++++++++----- .../api/hypershift/v1beta1/azure.go | 2 +- 10 files changed, 48 insertions(+), 20 deletions(-) diff --git a/api/hypershift/v1beta1/azure.go b/api/hypershift/v1beta1/azure.go index 26ae5cdfa6b4..03c1fa56bea2 100644 --- a/api/hypershift/v1beta1/azure.go +++ b/api/hypershift/v1beta1/azure.go @@ -171,7 +171,7 @@ type AzureMarketplaceImage struct { ImageGeneration *AzureVMImageGeneration `json:"imageGeneration,omitempty"` // publisher is the name of the organization that created the image. - // For example, "azureopenshift", "Canonical", or "RedHat". + // For example, "azureopenshift", "canonical", or "redhat". // It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). // It must start with a lowercase letter or a number. // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml index 171d541e3bee..e5a855e0ee08 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml @@ -852,7 +852,7 @@ spec: publisher: description: |- publisher is the name of the organization that created the image. - For example, "azureopenshift", "Canonical", or "RedHat". + For example, "azureopenshift", "canonical", or "redhat". It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml index 3d0ccd8c79c6..3c2aae309343 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml @@ -852,7 +852,7 @@ spec: publisher: description: |- publisher is the name of the organization that created the image. - For example, "azureopenshift", "Canonical", or "RedHat". + For example, "azureopenshift", "canonical", or "redhat". It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml index a4466840f929..56d6dc59c09b 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml @@ -852,7 +852,7 @@ spec: publisher: description: |- publisher is the name of the organization that created the image. - For example, "azureopenshift", "Canonical", or "RedHat". + For example, "azureopenshift", "canonical", or "redhat". It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml index 840a12571519..b8f869feb6f9 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml @@ -855,7 +855,7 @@ spec: publisher: description: |- publisher is the name of the organization that created the image. - For example, "azureopenshift", "Canonical", or "RedHat". + For example, "azureopenshift", "canonical", or "redhat". It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml index 93c0334948da..15a12c8a8567 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml @@ -855,7 +855,7 @@ spec: publisher: description: |- publisher is the name of the organization that created the image. - For example, "azureopenshift", "Canonical", or "RedHat". + For example, "azureopenshift", "canonical", or "redhat". It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml index 767779d04dd2..66911ed40f01 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml @@ -855,7 +855,7 @@ spec: publisher: description: |- publisher is the name of the organization that created the image. - For example, "azureopenshift", "Canonical", or "RedHat". + For example, "azureopenshift", "canonical", or "redhat". It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more diff --git a/docs/content/reference/aggregated-docs.md b/docs/content/reference/aggregated-docs.md index 866b7e7edb9d..d0abf261dae5 100644 --- a/docs/content/reference/aggregated-docs.md +++ b/docs/content/reference/aggregated-docs.md @@ -33938,9 +33938,11 @@ string (Optional)

publisher is the name of the organization that created the image. -It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). +For example, “azureopenshift”, “canonical”, or “redhat”. +It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. -TODO: Can we explain where a user might find this value, or provide an example of one they might want to use

+See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more +information on Azure Marketplace image publishers.

@@ -33953,7 +33955,12 @@ string (Optional)

offer specifies the name of a group of related images created by the publisher. -TODO: What is the valid character set for this field? What about minimum and maximum lengths?

+For example, “RHEL”, “WindowsServer”, or “0001-com-ubuntu-server-jammy”. +The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), +hyphens (-), underscores (_), and periods (.). +It must start with an alphanumeric character. +See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more +information on Azure Marketplace image offers.

@@ -33967,8 +33974,10 @@ string (Optional)

sku specifies an instance of an offer, such as a major release of a distribution. For example, 2204-lts-gen2, 8-lvm-gen2. -The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (). -TODO: What about length limits?

+The value must be between 1 and 255 characters in length, and consist of only lowercase +letters, numbers, hyphens (-), and underscores (). +See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more +information on Azure Marketplace image SKUs.

@@ -34987,7 +34996,12 @@ string (Optional)

imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. -TODO: What is the valid character set for this field? What about minimum and maximum lengths?

+The expected format is an Azure resource ID string. This can be a managed image or an +Azure Compute Gallery image version, for example: +/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} +/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} +See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for +Azure resource naming rules and restrictions.

diff --git a/docs/content/reference/api.md b/docs/content/reference/api.md index 1d6c5b273a43..c7f5a342e4fe 100644 --- a/docs/content/reference/api.md +++ b/docs/content/reference/api.md @@ -3504,9 +3504,11 @@ string (Optional)

publisher is the name of the organization that created the image. -It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, and hyphens (-) and underscores (_). +For example, “azureopenshift”, “canonical”, or “redhat”. +It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). It must start with a lowercase letter or a number. -TODO: Can we explain where a user might find this value, or provide an example of one they might want to use

+See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more +information on Azure Marketplace image publishers.

@@ -3519,7 +3521,12 @@ string (Optional)

offer specifies the name of a group of related images created by the publisher. -TODO: What is the valid character set for this field? What about minimum and maximum lengths?

+For example, “RHEL”, “WindowsServer”, or “0001-com-ubuntu-server-jammy”. +The value must consist of only alphanumeric characters (a-z, A-Z, 0-9), +hyphens (-), underscores (_), and periods (.). +It must start with an alphanumeric character. +See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more +information on Azure Marketplace image offers.

@@ -3533,8 +3540,10 @@ string (Optional)

sku specifies an instance of an offer, such as a major release of a distribution. For example, 2204-lts-gen2, 8-lvm-gen2. -The value must consist only of lowercase letters, numbers, and hyphens (-) and underscores (). -TODO: What about length limits?

+The value must be between 1 and 255 characters in length, and consist of only lowercase +letters, numbers, hyphens (-), and underscores (). +See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more +information on Azure Marketplace image SKUs.

@@ -4553,7 +4562,12 @@ string (Optional)

imageID is the Azure resource ID of a VHD image to use to boot the Azure VMs from. -TODO: What is the valid character set for this field? What about minimum and maximum lengths?

+The expected format is an Azure resource ID string. This can be a managed image or an +Azure Compute Gallery image version, for example: +/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName} +/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/images/{imageDefinitionName}/versions/{imageVersionName} +See https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules for +Azure resource naming rules and restrictions.

diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go index 26ae5cdfa6b4..03c1fa56bea2 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go @@ -171,7 +171,7 @@ type AzureMarketplaceImage struct { ImageGeneration *AzureVMImageGeneration `json:"imageGeneration,omitempty"` // publisher is the name of the organization that created the image. - // For example, "azureopenshift", "Canonical", or "RedHat". + // For example, "azureopenshift", "canonical", or "redhat". // It must be between 3 and 50 characters in length, and consist of only lowercase letters, numbers, hyphens (-), and underscores (_). // It must start with a lowercase letter or a number. // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more From e1f918c46bd00ff67c7a0a0cfbc68307bb147f92 Mon Sep 17 00:00:00 2001 From: OpenShift CI Bot Date: Thu, 16 Apr 2026 13:31:04 +0000 Subject: [PATCH 5/5] fix(api): use XValidation with self.matches for offer field validation Replace kubebuilder Pattern validation with XValidation CEL rule using self.matches() for the Azure Marketplace offer field, as requested in review. This approach is consistent with other field validations in the codebase (e.g., GCP project IDs, Azure client IDs) and provides better error messages via the message parameter. Also adds envtest cases to validate the offer field character constraints: rejects invalid characters and non-alphanumeric starts, accepts valid offer strings with hyphens, underscores, and periods. Regenerated CRDs and vendor to reflect the change. Co-Authored-By: Claude Opus 4.6 --- api/hypershift/v1beta1/azure.go | 2 +- .../AAA_ungated.yaml | 6 +- .../GCPPlatform.yaml | 6 +- .../OpenStack.yaml | 6 +- .../stable.nodepools.azure.testsuite.yaml | 87 +++++++++++++++++++ .../nodepools-CustomNoUpgrade.crd.yaml | 6 +- .../nodepools-Default.crd.yaml | 6 +- .../nodepools-TechPreviewNoUpgrade.crd.yaml | 6 +- .../api/hypershift/v1beta1/azure.go | 2 +- 9 files changed, 119 insertions(+), 8 deletions(-) diff --git a/api/hypershift/v1beta1/azure.go b/api/hypershift/v1beta1/azure.go index 03c1fa56bea2..999607c90b75 100644 --- a/api/hypershift/v1beta1/azure.go +++ b/api/hypershift/v1beta1/azure.go @@ -191,7 +191,7 @@ type AzureMarketplaceImage struct { // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more // information on Azure Marketplace image offers. // - // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9][a-zA-Z0-9._-]*$` + // +kubebuilder:validation:XValidation:rule="self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$')",message="offer must consist of alphanumeric characters, hyphens, underscores, and periods, and must start with an alphanumeric character" // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=255 // +optional diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml index e5a855e0ee08..b37031672db6 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/AAA_ungated.yaml @@ -847,8 +847,12 @@ spec: information on Azure Marketplace image offers. maxLength: 255 minLength: 1 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string + x-kubernetes-validations: + - message: offer must consist of alphanumeric characters, + hyphens, underscores, and periods, and must start + with an alphanumeric character + rule: self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$') publisher: description: |- publisher is the name of the organization that created the image. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml index 3c2aae309343..0fb990c9f08c 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/GCPPlatform.yaml @@ -847,8 +847,12 @@ spec: information on Azure Marketplace image offers. maxLength: 255 minLength: 1 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string + x-kubernetes-validations: + - message: offer must consist of alphanumeric characters, + hyphens, underscores, and periods, and must start + with an alphanumeric character + rule: self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$') publisher: description: |- publisher is the name of the organization that created the image. diff --git a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml index 56d6dc59c09b..c11c44436436 100644 --- a/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml +++ b/api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/nodepools.hypershift.openshift.io/OpenStack.yaml @@ -847,8 +847,12 @@ spec: information on Azure Marketplace image offers. maxLength: 255 minLength: 1 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string + x-kubernetes-validations: + - message: offer must consist of alphanumeric characters, + hyphens, underscores, and periods, and must start + with an alphanumeric character + rule: self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$') publisher: description: |- publisher is the name of the organization that created the image. diff --git a/cmd/install/assets/crds/hypershift-operator/tests/nodepools.hypershift.openshift.io/stable.nodepools.azure.testsuite.yaml b/cmd/install/assets/crds/hypershift-operator/tests/nodepools.hypershift.openshift.io/stable.nodepools.azure.testsuite.yaml index 0258c76de04c..407b17f42c66 100644 --- a/cmd/install/assets/crds/hypershift-operator/tests/nodepools.hypershift.openshift.io/stable.nodepools.azure.testsuite.yaml +++ b/cmd/install/assets/crds/hypershift-operator/tests/nodepools.hypershift.openshift.io/stable.nodepools.azure.testsuite.yaml @@ -191,3 +191,90 @@ tests: subnetID: "/subscriptions/12345678-1234-5678-9012-123456789012/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-subnet" type: Azure expectedError: "publisher, offer, sku and version must either be all set, or all omitted" + + # --- Azure Marketplace offer field character validation --- + - name: when marketplace offer contains invalid characters it should fail + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: NodePool + spec: + arch: amd64 + clusterName: some-cluster + management: + autoRepair: false + upgradeType: Replace + release: + image: quay.io/openshift-release-dev/ocp-release:4.17.0-rc.0-x86_64 + replicas: 0 + platform: + azure: + vmSize: Standard_D4s_v5 + image: + type: AzureMarketplace + azureMarketplace: + publisher: azureopenshift + offer: "invalid offer!" + sku: aro_417_rhel8_gen2 + version: "417.94.20240701" + osDisk: + diskStorageAccountType: Premium_LRS + subnetID: "/subscriptions/12345678-1234-5678-9012-123456789012/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-subnet" + type: Azure + expectedError: "offer must consist of alphanumeric characters, hyphens, underscores, and periods, and must start with an alphanumeric character" + + - name: when marketplace offer starts with a hyphen it should fail + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: NodePool + spec: + arch: amd64 + clusterName: some-cluster + management: + autoRepair: false + upgradeType: Replace + release: + image: quay.io/openshift-release-dev/ocp-release:4.17.0-rc.0-x86_64 + replicas: 0 + platform: + azure: + vmSize: Standard_D4s_v5 + image: + type: AzureMarketplace + azureMarketplace: + publisher: azureopenshift + offer: "-invalid-start" + sku: aro_417_rhel8_gen2 + version: "417.94.20240701" + osDisk: + diskStorageAccountType: Premium_LRS + subnetID: "/subscriptions/12345678-1234-5678-9012-123456789012/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-subnet" + type: Azure + expectedError: "offer must consist of alphanumeric characters, hyphens, underscores, and periods, and must start with an alphanumeric character" + + - name: when marketplace offer has valid characters with hyphens underscores and periods it should pass + initial: | + apiVersion: hypershift.openshift.io/v1beta1 + kind: NodePool + spec: + arch: amd64 + clusterName: some-cluster + management: + autoRepair: false + upgradeType: Replace + release: + image: quay.io/openshift-release-dev/ocp-release:4.17.0-rc.0-x86_64 + replicas: 0 + platform: + azure: + vmSize: Standard_D4s_v5 + image: + type: AzureMarketplace + azureMarketplace: + publisher: azureopenshift + offer: "0001-com-ubuntu-server.jammy_2204" + sku: aro_417_rhel8_gen2 + version: "417.94.20240701" + osDisk: + diskStorageAccountType: Premium_LRS + subnetID: "/subscriptions/12345678-1234-5678-9012-123456789012/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-subnet" + type: Azure diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml index b8f869feb6f9..667a0f08a4cd 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-CustomNoUpgrade.crd.yaml @@ -850,8 +850,12 @@ spec: information on Azure Marketplace image offers. maxLength: 255 minLength: 1 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string + x-kubernetes-validations: + - message: offer must consist of alphanumeric characters, + hyphens, underscores, and periods, and must start + with an alphanumeric character + rule: self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$') publisher: description: |- publisher is the name of the organization that created the image. diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml index 15a12c8a8567..2c23f4903108 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-Default.crd.yaml @@ -850,8 +850,12 @@ spec: information on Azure Marketplace image offers. maxLength: 255 minLength: 1 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string + x-kubernetes-validations: + - message: offer must consist of alphanumeric characters, + hyphens, underscores, and periods, and must start + with an alphanumeric character + rule: self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$') publisher: description: |- publisher is the name of the organization that created the image. diff --git a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml index 66911ed40f01..30b8193da6a9 100644 --- a/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml +++ b/cmd/install/assets/crds/hypershift-operator/zz_generated.crd-manifests/nodepools-TechPreviewNoUpgrade.crd.yaml @@ -850,8 +850,12 @@ spec: information on Azure Marketplace image offers. maxLength: 255 minLength: 1 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]*$ type: string + x-kubernetes-validations: + - message: offer must consist of alphanumeric characters, + hyphens, underscores, and periods, and must start + with an alphanumeric character + rule: self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$') publisher: description: |- publisher is the name of the organization that created the image. diff --git a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go index 03c1fa56bea2..999607c90b75 100644 --- a/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go +++ b/vendor/github.com/openshift/hypershift/api/hypershift/v1beta1/azure.go @@ -191,7 +191,7 @@ type AzureMarketplaceImage struct { // See https://learn.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage for more // information on Azure Marketplace image offers. // - // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9][a-zA-Z0-9._-]*$` + // +kubebuilder:validation:XValidation:rule="self.matches('^[a-zA-Z0-9][a-zA-Z0-9._-]*$')",message="offer must consist of alphanumeric characters, hyphens, underscores, and periods, and must start with an alphanumeric character" // +kubebuilder:validation:MinLength=1 // +kubebuilder:validation:MaxLength=255 // +optional