Bug 1664600

Summary: [cloud-CA] Shouldn't be allowed to create more than one clusterautoscaler resource
Product: OpenShift Container Platform Reporter: sunzhaohua <zhsun>
Component: Cloud ComputeAssignee: Brad Ison <brad.ison>
Status: CLOSED ERRATA QA Contact: sunzhaohua <zhsun>
Severity: low Docs Contact:
Priority: low    
Version: 4.1.0CC: agarcial, jhou
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:27:41 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 sunzhaohua 2019-01-09 09:26:30 UTC
Description of problem:
ClusterAutoscaler is a singleton resource, only one should be allowed to create. If the resource name is not "default",there should be a prompt.

Version-Release number of selected component (if applicable):
$ oc get clusterversion
NAME      VERSION                           AVAILABLE   PROGRESSING   SINCE     STATUS
version   4.0.0-0.alpha-2019-01-09-005354   True        False         3h        Cluster version is 4.0.0-0.alpha-2019-01-09-005354

How reproducible:
Always

Steps to Reproduce:
1. Create a clusterautoscaler named "default"
$ oc get clusterautoscaler default -o yaml
apiVersion: "autoscaling.openshift.io/v1alpha1"
kind: "ClusterAutoscaler"
metadata:
  name: "default"
spec:
  scaleDown:
    enabled: true
    delayAfterAdd: 10s
    delayAfterDelete: 10s
    delayAfterFailure: 10s
    
2. Create a clusterautoscaler named "default1"
$ oc get clusterautoscaler default1 -o yaml
apiVersion: "autoscaling.openshift.io/v1alpha1"
kind: "ClusterAutoscaler"
metadata:
  name: "default1"
spec:
  scaleDown:
    enabled: true
    delayAfterAdd: 10s
    delayAfterDelete: 10s
    delayAfterFailure: 10s
3. $ oc logs -f cluster-autoscaler-operator-58d4c9cfc4-lzfzd
I0109 05:32:21.329716       1 clusterautoscaler_controller.go:114] Reconciling ClusterAutoscaler default
W0109 05:32:43.431104       1 clusterautoscaler_controller.go:167] Not processing ClusterAutoscaler default1

Actual results:
Two clusterautoscalers were created, the resource named "default" triggered the deployment of autoscaler.

Expected results:
Only the clusterautoscaler resource named "default" could be created.

Additional info:

Comment 1 Brad Ison 2019-01-10 15:24:35 UTC
This will require an admission webhook, which definitely isn't going to make it in before the 4.0 feature freeze. The operator will only actually deploy the autoscaler for the resource named "default" -- but yes, you can create additional ClusterAutoscaler resources at the moment unfortunately, they just have no effect.

Not sure what the appropriate status for this bug is.

Comment 3 sunzhaohua 2019-07-26 03:32:40 UTC
Verified 
clusterversion: 4.2.0-0.nightly-2019-07-25-053632

$ oc create -f clusterautoscaler.yml 
Error from server (Name "default1" is invalid, only "default" is allowed): error when creating "clusterautoscaler.yml": admission webhook "clusterautoscalers.autoscaling.openshift.io" denied the request: Name "default1" is invalid, only "default" is allowed

Comment 5 errata-xmlrpc 2019-10-16 06:27:41 UTC
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, 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/RHBA-2019:2922