Description of problem: HPA resource is setting the averageUtilization value to 80 even though the source cluster has a different value configured. Version-Release number of selected component (if applicable): Source GCP 3.11 MTC 1.5.5 Target GCP 4.10 MTC 1.6.5 How reproducible: Always Steps to Reproduce: 1. Create a namespace $ oc new-project bug 2. Create a deplymentconfig and HPA resource in the source cluster. $ oc create -f dc.yml $ cat dc.yml apiVersion: apps.openshift.io/v1 kind: DeploymentConfig metadata: name: nginx-deployment spec: replicas: 1 template: metadata: labels: app: nginx name: nginx spec: containers: - image: docker.io/twalter/openshift-nginx name: nginx ports: - containerPort: 8081 $ oc create -f hpa.yml $ cat hpa.yml apiVersion: autoscaling/v1 kind: HorizontalPodAutoscaler metadata: name: mysql spec: maxReplicas: 7 minReplicas: 2 scaleTargetRef: apiVersion: v1 kind: DeploymentConfig name: nginx-deployment targetCPUUtilizationPercentage: 90 3. Execute migration Actual result: The HPA resource is using the averageUtilization value as 80. $ oc get hpa -o yaml spec: maxReplicas: 7 metrics: - resource: name: cpu target: averageUtilization: 80 type: Utilization type: Resource minReplicas: 2 scaleTargetRef: apiVersion: apps.openshift.io/v1 kind: DeploymentConfig name: nginx-deployment Expected results: HPA resource should use the correct values after performing migration. Additional info: We are not facing the similar issue with kind deployment.
It looks like the problem is that the new HPA plugin uses autoscaling/v2beta1 to operate on the resource, but the HPA migrated in this BZ used ahtoscaling/v1. autoscaling/v2beta1 *added* spec.metrics and *removed* spec.targetCPUUtilizationPercentage vs. v1. So the plugin conversion is losing the removed field entirely, and the added field is probably getting populated with defaults. We've got two possible solutions: 1) detect apiVersion of the HPA and marshal/unmarshal using the proper apiVersion in the plugin 2) Skip marshal/unmarshal entirely and just manipulate the unstructured resource.
The OADP Jira issue is https://issues.redhat.com/browse/OADP-536