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

CGU error when only Image or Version is provided for OCP precache

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None

      Description of problem:

      when only .spec.desiredUpdate.version is provided in policy: "platform image defined but value is missing" 
      
      when only .spec.desiredUpdate.image is provided in policy: "unable to find version on update graph on url https://api.openshift.com/api/upgrades_info/v1/graph?channel=stable-4.11"

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

      from Nov 15th -- quay.io/openshift-kni/cluster-group-upgrades-operator:latest

      How reproducible:

       

      Steps to Reproduce:

      1. Apply the CRs (Version only case)
      apiVersion: v1alpha1
      kind: ClusterGroupUpgrade
      metadata:
        creationTimestamp: null
        name: generated-cgu-disk-full
        namespace: talm-test
      spec:
        actions:
          afterCompletion: {}
          beforeEnable: {}
        clusters:
        - cnfdf05
        enable: true
        managedPolicies:
        - generated-policy-disk-full
        remediationStrategy:
          maxConcurrency: 1
          timeout: 250
      status:
        status:
          completedAt: null
          currentBatchStartedAt: null
          startedAt: null
      
      apiVersion: v1
      kind: Policy
      metadata:
        creationTimestamp: null
        name: generated-policy-disk-full
        namespace: talm-test
      spec:
        disabled: false
        policy-templates:
        - objectDefinition:
            apiVersion: policy.open-cluster-management.io/v1
            kind: ConfigurationPolicy
            metadata:
              creationTimestamp: null
              name: generated-policy-disk-full-config
            spec:
              evaluationInterval:
                compliant: 10s
                noncompliant: 10s
              namespaceSelector:
                exclude:
                - '*'
                include:
                - kube-*
              object-templates:
              - complianceType: Musthave
                objectDefinition:
                  apiVersion: config.openshift.io/v1
                  kind: ClusterVersion
                  metadata:
                    creationTimestamp: null
                    name: version
                  spec:
                    channel: stable-4.11
                    clusterID: ""
                    desiredUpdate:
                      force: false
                      image: ""
                      version: 4.11.12
                    upstream: https://api.openshift.com/api/upgrades_info/v1/graph
                  status:
                    availableUpdates: null
                    capabilities: {}
                    desired:
                      image: ""
                      version: ""
                    observedGeneration: 0
                    versionHash: ""
              remediationAction: Inform
              severity: low
            status: {}
        remediationAction: Inform
      status: {}
      
      apiVersion: v1beta1
      kind: PolicySet
      metadata:
        creationTimestamp: null
        name: generated-policyset-disk-full
        namespace: talm-test
      spec:
        policies:
        - generated-policy-disk-full
      status: {}
      
      apiVersion: v1
      kind: PlacementRule
      metadata:
        creationTimestamp: null
        name: generated-placementrule-disk-full
        namespace: talm-test
      spec:
        clusterSelector: {}
        clusters:
        - name: cnfdf05
      status: {}
      
      apiVersion: v1
      kind: PlacementBinding
      metadata:
        creationTimestamp: null
        name: generated-placementbinding-disk-full
        namespace: talm-test
      placementRef:
        apiGroup: apps.open-cluster-management.io
        kind: PlacementRule
        name: generated-placementrule-disk-full
      status: {}
      subjects:
      - apiGroup: policy.open-cluster-management.io
        kind: PolicySet
        name: generated-policyset-disk-full 

       

      2. See error in CGU
      

      Actual results:

      Error under "Description of problem"

      Expected results:

      No errors for when only Version or Image is provided (it was working in the previous version btw (I think 4.11?))

      Additional info:

      desiredUpdate:                 
        force: false                 
        image: ""                 
        version: 4.11.12
      
      The image has "" as value because the CR was generated in Go and the underlying code is initiated with a default value (in this case "" for string)
      
      Go for completeness" 
      clusterVersion := configv1.ClusterVersion{
         TypeMeta: metav1.TypeMeta{
            Kind:       "ClusterVersion",
            APIVersion: "config.openshift.io/v1",
         },
         ObjectMeta: metav1.ObjectMeta{
            Name: "version",
         },
         Spec: configv1.ClusterVersionSpec{
            DesiredUpdate: &configv1.Update{
               Version: version,
               Force:   false,
            },
            Upstream: configv1.URL(helper.Config.Ran.OcpUpgradeUpstreamURL),
            Channel:  GetClusterChannel(spokeclient),
         },
      }
      

            npathan@redhat.com Nahian Pathan
            npathan@redhat.com Nahian Pathan
            Yang Liu Yang Liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: