# Description of problem: An error will be returned when trying to deploy using `oc new-app` CLI and a `Template` with `HorizontalPodAutoscaler` `autoscaling/v2beta2` on the `Template` object list: ~~~ error: no kind is registered for the type v2beta2.HorizontalPodAutoscaler in scheme "github.com/openshift/oc/pkg/cli/newapp/scheme.go:23" ~~~ Example `Template`: ~~~ kind: Template apiVersion: template.openshift.io/v1 metadata: name: template-ubi objects: - kind: DeploymentConfig apiVersion: apps.openshift.io/v1 metadata: name: hpa-deploymentconfig spec: selector: app_name: hpa-deploymentconfig deploymentconfig: hpa-deploymentconfig template: metadata: labels: app_name: hpa-deploymentconfig deploymentconfig: hpa-deploymentconfig name: hpa-deploymentconfig spec: containers: - image: registry.access.redhat.com/ubi8/ubi:8.5-226 name: hpa-deploymentconfig - apiVersion: autoscaling/v2beta2 kind: HorizontalPodAutoscaler metadata: name: hpa-test-hpa-resource-metrics-memory spec: scaleTargetRef: apiVersion: apps.openshift.io/v1 kind: DeploymentConfig name: hpa-deploymentconfig minReplicas: 1 maxReplicas: 10 metrics: - type: Resource resource: name: memory target: type: Utilization averageUtilization: 70 ~~~ API `autoscaling/v2beta2` it's required to be used for autoscaling based on memory utilization according to [Creating a horizontal pod autoscaler object for memory utilization by using the CLI [1] [1] https://docs.openshift.com/container-platform/4.6/nodes/pods/nodes-pods-autoscaling.html#nodes-pods-autoscaling-creating-memory_nodes-pods-autoscaling # Version-Release number of selected component (if applicable): - Tested with OpenShift 4.6.42 and 4.9.19 # How reproducible: - Always # Steps to Reproduce: 1.Create a `Template` with above shared info 2.Try to run with `dry-run` and error will be returned: ~~~ $ oc new-app -f templatefull.yaml --dry-run --> Deploying template "test02/template-ubi" for "templatefull.yaml" to project test02 --> Creating resources ... deploymentconfig.apps.openshift.io "hpa-deploymentconfig" created (dry run) error: no kind is registered for the type v2beta2.HorizontalPodAutoscaler in scheme "github.com/openshift/oc/pkg/cli/newapp/scheme.go:23" --> Failed (dry run) ~~~ # Expected results: - `oc new-app` should deploy items with success. # Additional info: - The workaround it's to decouple `HorizontalPodAutoscaler` from `Template` object list and apply it after as standalone. - If `apiVersion: autoscaling/v2beta1` it's used instead of `apiVersion: autoscaling/v2beta2` it will deploy successfully
We still need to bump the api in oc.
Done recently in https://github.com/openshift/oc/pull/1092
can't reproduce the issue now : oc new-app -f /tmp/templatefull.yaml --dry-run --> Deploying template "zhouyt/template-ubi" for "/tmp/templatefull.yaml" to project zhouyt --> Creating resources ... deploymentconfig.apps.openshift.io "hpa-deploymentconfig" created (dry run) horizontalpodautoscaler.autoscaling "hpa-test-hpa-resource-metrics-memory" created (dry run) --> Success (dry run) [root@localhost ~]# oc version Client Version: 4.11.0-0.nightly-2022-05-26-013101 Kustomize Version: v4.5.4
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Important: OpenShift Container Platform 4.11.0 bug fix and security update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2022:5069