Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-63613

`--image-generation Gen1` set not work even without marketplace flags

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • None
    • None
    • In Progress
    • Release Note Not Required
    • Hide
      Cause: The CLI's GenerateNodePools() function set AzureMarketplace to nil when users specified --image-generation without marketplace flags, discarding the user's image generation preference. Additionally, the nodepool controller's getAzureMarketplaceMetadata() function did not set ImageGeneration when creating marketplace images from the release payload, causing images to default to Gen2.

      Consequence: When users created Azure hosted clusters with --image-generation Gen1, the NodePools were incorrectly created with Gen2 images, ignoring the user's explicit preference.

      Fix: Modified the CLI to preserve the user's ImageGeneration preference by creating an AzureMarketplaceImage struct with the ImageGeneration field set according to the user's flag, instead of setting it to nil. Also modified the nodepool controller to explicitly set ImageGeneration on marketplace images created from the release payload (Gen1 for HyperVGen1 images, Gen2 for HyperVGen2 images).

      Result: The --image-generation flag is now respected during Azure hosted cluster creation. Users can specify --image-generation Gen1 to use Gen1 images or --image-generation Gen2 to use Gen2 images, and the created NodePools will correctly reflect their preference.
      Show
      Cause: The CLI's GenerateNodePools() function set AzureMarketplace to nil when users specified --image-generation without marketplace flags, discarding the user's image generation preference. Additionally, the nodepool controller's getAzureMarketplaceMetadata() function did not set ImageGeneration when creating marketplace images from the release payload, causing images to default to Gen2. Consequence: When users created Azure hosted clusters with --image-generation Gen1, the NodePools were incorrectly created with Gen2 images, ignoring the user's explicit preference. Fix: Modified the CLI to preserve the user's ImageGeneration preference by creating an AzureMarketplaceImage struct with the ImageGeneration field set according to the user's flag, instead of setting it to nil. Also modified the nodepool controller to explicitly set ImageGeneration on marketplace images created from the release payload (Gen1 for HyperVGen1 images, Gen2 for HyperVGen2 images). Result: The --image-generation flag is now respected during Azure hosted cluster creation. Users can specify --image-generation Gen1 to use Gen1 images or --image-generation Gen2 to use Gen2 images, and the created NodePools will correctly reflect their preference.
    • None
    • None
    • None
    • None

      Description of problem:

      When create the HostedCluster and set image-generation==Gen1 without marketplace flags, the new created hosted cluster still use 'Gen2'. 

      Version-Release number of selected component (if applicable):

      4.21, 4.20
          

      How reproducible:

      always
          

      Steps to Reproduce:

       1. Clone latest hypershift repo and build hypershift client and operators images;
       2. with 4.21 nightly build and image-generation as 'Gen1' to create the hosted cluster : 
      
       echo ${RELEASE_IMAGE}
      registry.ci.openshift.org/ocp/release:4.21.0-0.nightly-2025-10-27-085201
      
      ./hypershift create cluster azure     --name "$CLUSTER_NAME" \
         --namespace "$CLUSTER_NAMESPACE"  \
         --azure-creds $AZURE_CREDS \
         --location ${LOCATION} \
         --node-pool-replicas 2 \
         --base-domain $PARENT_DNS_ZONE \
         --pull-secret $PULL_SECRET \
         --generate-ssh \
         --release-image ${RELEASE_IMAGE} \
         --external-dns-domain ${DNS_ZONE_NAME} \
         --resource-group-name "${MANAGED_RG_NAME}" \
         --vnet-id "${GetVnetID}" \
         --subnet-id "${GetSubnetID}" \
         --network-security-group-id "${GetNsgID}" \
         --sa-token-issuer-private-key-path "${SA_TOKEN_ISSUER_PRIVATE_KEY_PATH}" \
         --oidc-issuer-url "${OIDC_ISSUER_URL}" \
         --dns-zone-rg-name ${PERSISTENT_RG_NAME}  \
         --assign-service-principal-roles  \
         --workload-identities-file ./workload-identities.json  \
         --diagnostics-storage-account-type Managed \
         --control-plane-operator-image=quay.io/zhouying7780/hypershift-control-plane:latest        \
         --image-generation Gen1

      Actual results:

      1. ./hypershift -v 
      hypershift version openshift/hypershift: 7a63e46b0d154786852592eb5a01a79b82df0afe. Latest supported OCP: 4.21.0
      
      git log 7a63e46b0d154786852592eb5a01a79b82df0afe |grep "#6904"
          Merge pull request #6904 from bryan-cox/CNTRLPLANE-475
      
      2.The new created hosted cluster still set as 'Gen2':
      
      oc get np yinzhou-hc-sm   -n clusters -o jsonpath='{.spec.platform.azure}' |json_reformat
      {
          "diagnostics": {
              "storageAccountType": "Managed"
          },
          "encryptionAtHost": "Enabled",
          "image": {
              "azureMarketplace": {
                  "imageGeneration": "Gen2",
                  "offer": "aro4",
                  "publisher": "azureopenshift",
                  "sku": "419-v2",
                  "version": "419.6.20250523"
              },
              "type": "AzureMarketplace"
          },
          "osDisk": {
              "diskStorageAccountType": "Premium_LRS",
              "sizeGiB": 120
          },
          "subnetID": "/subscriptions/53b8f551-f0fc-4bea-8cba-6d1fefd54c8a/resourceGroups/yinzhou-customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/yinzhou-customer-vnet/subnets/yinzhou-customer-subnet-1",
          "vmSize": "Standard_D4s_v3"
      }
      
      

      Expected results:

      The hosted cluster should be "imageGeneration": "Gen1"

      Additional info:

          

              rh-ee-brcox Bryan Cox
              yinzhou@redhat.com Ying Zhou
              None
              None
              Ying Zhou Ying Zhou
              None
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: