Bug 1468517

Summary: Error on scaleTargetRef when re-deploying HorizontalPodAutoscaler trom template
Product: OpenShift Container Platform Reporter: Nicolas Nosenzo <nnosenzo>
Component: ocAssignee: Fabiano Franz <ffranz>
Status: CLOSED CURRENTRELEASE QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: low    
Version: 3.5.0CC: aos-bugs, jokerman, jtakvori, mmccomas, mwringe, nnosenzo
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-07-30 13:20:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Nicolas Nosenzo 2017-07-07 10:07:40 UTC
Description of problem:

When re-deploying an HPA object from a template file, it fails on time to time with error:

error: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "scaleRef"


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

Tested on oc v3.5 and v3.4.1.7

How reproducible:

Intermittent issue

Steps to Reproduce:

1. Create a template containing the HPA object:

# cat hpa-template.yaml 
kind: "Template"
apiVersion: "v1"
metadata:
  name: "template"
  annotations:
    description: "template."
labels:
  template: "template"
objects:
- apiVersion: autoscaling/v1
  kind: HorizontalPodAutoscaler
  metadata:
    name: dataservice-db-autoscaler
  spec:
    scaleTargetRef:
      kind: DeploymentConfig
      name: ruby-ex
      apiVersion: v1
      subresource: scale
    minReplicas: 1
    maxReplicas: 1
    cpuUtilization:
      targetPercentage: 100


2. Re-deploy the object processing the template file:

# for i in $(seq 1 15); do oc process -f hpa-template.yaml | oc apply -f -;done

Actual results:

horizontalpodautoscaler "dataservice-db-autoscaler" configured
error: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "scaleRef"
horizontalpodautoscaler "dataservice-db-autoscaler" configured
error: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "scaleRef"
horizontalpodautoscaler "dataservice-db-autoscaler" configured
error: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "scaleRef"
error: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "scaleRef"
error: unable to find api field in struct HorizontalPodAutoscalerSpec for the json field "scaleRef"
horizontalpodautoscaler "dataservice-db-autoscaler" configured
horizontalpodautoscaler "dataservice-db-autoscaler" configured
horizontalpodautoscaler "dataservice-db-autoscaler" configured
horizontalpodautoscaler "dataservice-db-autoscaler" configured
horizontalpodautoscaler "dataservice-db-autoscaler" configured
horizontalpodautoscaler "dataservice-db-autoscaler" configured
horizontalpodautoscaler "dataservice-db-autoscaler" configured


Expected results:

horizontalpodautoscaler should be re-configured each time without errors.

Additional info:

Comment 1 Joel Takvorian 2017-07-07 13:08:20 UTC
It looks identical to this k8s issue: https://github.com/kubernetes/kubernetes/issues/34413

Comment 2 Solly Ross 2017-10-03 19:36:44 UTC
that PR should have been included in v3.5 (but not v3.4).  Can you please make sure you're using the most recent version of v3.5 (and make sure that you're using a v3.5 version of `oc`)?

At any rate, this is a CLI issue, bouncing over to them.

Comment 3 Nicolas Nosenzo 2018-07-30 13:20:31 UTC
I'm not longer able to test/or gather information about this. If this is already fixed in 3.5 I think we can go ahead and close the ticket.