Bug 2090637 - [MTC] HPA resource is setting the averageUtilization value to 80 after performing migration [OADP-BL]
Summary: [MTC] HPA resource is setting the averageUtilization value to 80 after perfor...
Keywords:
Status: ASSIGNED
Alias: None
Product: Migration Toolkit for Containers
Classification: Red Hat
Component: Velero
Version: 1.6.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 1.7.z
Assignee: John Matthews
QA Contact: ssingla
Richard Hoch
URL: https://issues.redhat.com/browse/OADP...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-26 08:10 UTC by Prasad Joshi
Modified: 2022-10-01 04:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Prasad Joshi 2022-05-26 08:10:26 UTC
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.

Comment 1 Scott Seago 2022-05-26 19:09:34 UTC
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.

Comment 2 Jason Montleon 2022-05-26 19:13:26 UTC
The OADP Jira issue is https://issues.redhat.com/browse/OADP-536


Note You need to log in before you can comment on or make changes to this bug.