Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set additional machine annotations/labels to get pretty machine output
Set common machine fields so when a machine provisioned in AWS is listed through `oc get machines` all additional printer colums are properly populated. E.g. region, zone, instance type. During the provisioning stage: NAME STATE TYPE REGION ZONE AGE master-machine running m4.xlarge us-east-1 us-east-1a 38s After an instance got provisioned: NAME STATE TYPE REGION ZONE AGE master-machine running m4.xlarge us-east-1 us-east-1a 40s After a machine is requsted to be deleted: NAME STATE TYPE REGION ZONE AGE master-machine shutting-down m4.xlarge us-east-1 us-east-1a 24m In order to properly display values from all the annotations, one needs to update the machine CRD to have: spec: additionalPrinterColumns: - JSONPath: .metadata.annotations['machine\.openshift\.io/instance-state'] description: State of the AWS instance name: State type: string - JSONPath: .metadata.labels['machine\.openshift\.io/instance-type'] description: Type of instance name: Type type: string - JSONPath: .metadata.labels['machine\.openshift\.io/region'] description: Region associated with machine name: Region type: string - JSONPath: .metadata.labels['machine\.openshift.\.io/zone'] description: Zone associated with machine name: Zone type: string Be aware of all the dots being escaped. $ oc get machines -n openshift-machine-api NAME STATE TYPE REGION ZONE AGE jchaloup-kndjk-master-0 running m4.xlarge us-east-1 us-east-1a 16m jchaloup-kndjk-master-1 running m4.xlarge us-east-1 us-east-1b 16m jchaloup-kndjk-master-2 running m4.xlarge us-east-1 us-east-1c 16m jchaloup-kndjk-worker-us-east-1a-rz7fc running m4.large us-east-1 us-east-1a 15m jchaloup-kndjk-worker-us-east-1b-skcdp running m4.large us-east-1 us-east-1b 15m jchaloup-kndjk-worker-us-east-1c-x949n running m4.large us-east-1 us-east-1c 15m $ oc get machines -n openshift-machine-api -o wide NAME STATE TYPE REGION ZONE AGE NODE PROVIDERID jchaloup-kndjk-master-0 running m4.xlarge us-east-1 us-east-1a 16m ip-10-0-137-186.ec2.internal jchaloup-kndjk-master-1 running m4.xlarge us-east-1 us-east-1b 16m ip-10-0-144-222.ec2.internal jchaloup-kndjk-master-2 running m4.xlarge us-east-1 us-east-1c 16m ip-10-0-164-95.ec2.internal jchaloup-kndjk-worker-us-east-1a-rz7fc running m4.large us-east-1 us-east-1a 15m ip-10-0-131-249.ec2.internal aws:///us-east-1a/i-0d61da03d03bc6c51 jchaloup-kndjk-worker-us-east-1b-skcdp running m4.large us-east-1 us-east-1b 15m ip-10-0-149-207.ec2.internal aws:///us-east-1b/i-0dbe5a1764fa55848 jchaloup-kndjk-worker-us-east-1c-x949n running m4.large us-east-1 us-east-1c 15m ip-10-0-160-10.ec2.internal aws:///us-east-1c/i-09380f6badaad266e
- Loading branch information