Document URL: https://docs.openshift.com/container-platform/3.11/dev_guide/pod_autoscaling.html Section Number and Name: Example 1. Horizontal Pod Autoscaler Object Definition Describe the issue: In the example provided, the spec.scaleTargetRef field refers to a DeploymentConfig object that should have an apiVersion's value of 'apps.openshift.io/v1' instead of 'apps/v1'. Suggestions for improvement: Replace 'apps/v1' by 'apps.openshift.io/v1' in spec.scaleTargetRef.apiVersion field.
In Example 1. Horizontal Pod Autoscaler Object Definition, replaced 'apps/v1' with 'apps.openshift.io/v1' in the spec.scaleTargetRef.apiVersion field in BOTH VERSIONS of this example (the primary and alternate methods). PR: https://github.com/openshift/openshift-docs/pull/14458
`apiVersion: apps/v1` should be updated to `apiVersion: apps.openshift.io/v1 ` HPA can't get the DC and calculate the current usage with apiVersion: apps/v1. $ oc get hpa hpa-resource-metrics-memory NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE hpa-resource-metrics-memory DeploymentConfig/httpd-24-rhel7 <unknown>/80% 1 2 0 15h $ oc describe hpa hpa-resource-metrics-memory Name: hpa-resource-metrics-memory Namespace: test Labels: <none> Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"hpa-resource-metrics-memory","namespace":"tes... CreationTimestamp: Thu, 25 Oct 2018 09:43:06 +0900 Reference: DeploymentConfig/httpd-24-rhel7 Metrics: ( current / target ) resource memory on pods (as a percentage of request): <unknown> / 50% Min replicas: 1 Max replicas: 4 DeploymentConfig pods: 0 current / 0 desired Events: <none> [cloud-user@master ~]$ oc describe hpa hpa-resource-metrics-memory Name: hpa-resource-metrics-memory Namespace: test Labels: <none> Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"hpa-resource-metrics-memory","namespace":"tes... CreationTimestamp: Thu, 25 Oct 2018 09:43:06 +0900 Reference: DeploymentConfig/httpd-24-rhel7 Metrics: ( current / target ) resource memory on pods (as a percentage of request): <unknown> / 50% Min replicas: 1 Max replicas: 4 DeploymentConfig pods: 0 current / 0 desired Events: <none> HPA succeeded retrieving the DC and calculating the current usage after replacing apiVersion: apps/v1 with apps.openshift.io/v1. $ oc get hpa hpa-resource-metrics-memory NAME REFERENCE TARGETS MINPODS MAXPODS REPLICAS AGE hpa-resource-metrics-memory DeploymentConfig/httpd-24-rhel7 1%/50% 1 4 1 6m $ oc describe hpa hpa-resource-metrics-memory Name: hpa-resource-metrics-memory Namespace: test Labels: <none> Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"autoscaling/v2beta1","kind":"HorizontalPodAutoscaler","metadata":{"annotations":{},"name":"hpa-resource-metrics-memory","namespace":"tes... CreationTimestamp: Thu, 25 Oct 2018 09:51:26 +0900 Reference: DeploymentConfig/httpd-24-rhel7 Metrics: ( current / target ) resource memory on pods (as a percentage of request): 1% (10084352) / 50% Min replicas: 1 Max replicas: 4 DeploymentConfig pods: 1 current / 1 desired Conditions: Type Status Reason Message ---- ------ ------ ------- AbleToScale True ReadyForNewScale the last scale time was sufficiently old as to warrant a new scale ScalingActive True ValidMetricFound the HPA was able to successfully calculate a replica count from memory resource utilization (percentage of request) ScalingLimited False DesiredWithinRange the desired count is within the acceptable range Events: <none>
Re: Zhou's comment: I checked with the `apiVersion: apps/v1` and `apiVersion: apps.openshift.io/v1 ` , all could create the HPA succeed, not sure which is effective , need jhou's team to verify. Jhou, can someone from your team confirm? Thanks Bob
(In reply to Bob from comment #4) > Re: Zhou's comment: I checked with the `apiVersion: apps/v1` and > `apiVersion: apps.openshift.io/v1 ` , all could create the HPA succeed, not > sure which is effective , need jhou's team to verify. > > Jhou, can someone from your team confirm? > > Thanks > > Bob Hi Bob, Please refer to comment 3. Both can create HPA successfully, but only one works, is that okay we use `apiVersion: apps.openshift.io/v1 `?
Thanks Weinan, We just needed to know which to recommend. I will clarify apiVersion: apps.openshift.io/v1 in the 4.1 release. Bob
Thanks Kathryn, I changed the version to 4.1 and left it in assigned state so I'll followup and ensure the correct content. Bob
I changed the API version to the string that has been tested to work in all instances for this topic, `apiVersion: apps.openshift.io/v1`. Please verify: Preview: http://file.bos.redhat.com/bgaydos/071219/dev_guide/pod_autoscaling.html PR: https://github.com/openshift/openshift-docs/pull/15864/files Thanks, Bob
Disregard my mention of 4.1 release above. I meant *3.11*.
Verified this change is in 3.11 live docs.