diff --git a/config/crds/machine_v1beta1_machine.yaml b/config/crds/machine_v1beta1_machine.yaml index 35dd1f4af488..b5cc2a4714ea 100644 --- a/config/crds/machine_v1beta1_machine.yaml +++ b/config/crds/machine_v1beta1_machine.yaml @@ -6,6 +6,37 @@ metadata: controller-tools.k8s.io: "1.0" name: machines.machine.openshift.io spec: + additionalPrinterColumns: + - JSONPath: .metadata.annotations['machine\.openshift\.io/instance-state'] + description: State of 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 + - JSONPath: .metadata.creationTimestamp + description: Machine age + name: Age + type: date + - JSONPath: .status.nodeRef.name + description: Node associated with machine + name: Node + priority: 1 + type: string + - JSONPath: .spec.providerID + description: Provider ID of machine created in cloud provider + name: ProviderID + priority: 1 + type: string group: machine.openshift.io names: kind: Machine diff --git a/config/crds/machine_v1beta1_machineset.yaml b/config/crds/machine_v1beta1_machineset.yaml index 4e88e2b69488..0cbdf333b908 100644 --- a/config/crds/machine_v1beta1_machineset.yaml +++ b/config/crds/machine_v1beta1_machineset.yaml @@ -6,6 +6,27 @@ metadata: controller-tools.k8s.io: "1.0" name: machinesets.machine.openshift.io spec: + additionalPrinterColumns: + - JSONPath: .spec.replicas + description: Desired Replicas + name: Desired + type: integer + - JSONPath: .status.replicas + description: Current Replicas + name: Current + type: integer + - JSONPath: .status.readyReplicas + description: Ready Replicas + name: Ready + type: integer + - JSONPath: .status.availableReplicas + description: Observed number of available replicas + name: Available + type: string + - JSONPath: .metadata.creationTimestamp + description: Machineset age + name: Age + type: date group: machine.openshift.io names: kind: MachineSet diff --git a/pkg/apis/machine/v1beta1/machine_types.go b/pkg/apis/machine/v1beta1/machine_types.go index 62ec393376ac..0bbc48f5a768 100644 --- a/pkg/apis/machine/v1beta1/machine_types.go +++ b/pkg/apis/machine/v1beta1/machine_types.go @@ -46,6 +46,13 @@ const ( // Machine is the Schema for the machines API // +k8s:openapi-gen=true // +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".metadata.annotations['machine\.openshift\.io/instance-state']",description="State of instance" +// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".metadata.labels['machine\.openshift\.io/instance-type']",description="Type of instance" +// +kubebuilder:printcolumn:name="Region",type="string",JSONPath=".metadata.labels['machine\.openshift\.io/region']",description="Region associated with machine" +// +kubebuilder:printcolumn:name="Zone",type="string",JSONPath=".metadata.labels['machine\.openshift\.io/zone']",description="Zone associated with machine" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Machine age" +// +kubebuilder:printcolumn:name="Node",type="string",JSONPath=".status.nodeRef.name",description="Node associated with machine",priority=1 +// +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="Provider ID of machine created in cloud provider",priority=1 type Machine struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/pkg/apis/machine/v1beta1/machineset_types.go b/pkg/apis/machine/v1beta1/machineset_types.go index b4edb7a30314..413f598fe0db 100644 --- a/pkg/apis/machine/v1beta1/machineset_types.go +++ b/pkg/apis/machine/v1beta1/machineset_types.go @@ -35,6 +35,11 @@ import ( // +k8s:openapi-gen=true // +kubebuilder:subresource:status // +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.labelSelector +// +kubebuilder:printcolumn:name="Desired",type="integer",JSONPath=".spec.replicas",description="Desired Replicas" +// +kubebuilder:printcolumn:name="Current",type="integer",JSONPath=".status.replicas",description="Current Replicas" +// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Ready Replicas" +// +kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.availableReplicas",description="Observed number of available replicas" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Machineset age" type MachineSet struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/pkg/controller/machine/controller.go b/pkg/controller/machine/controller.go index f2f1711997e3..3d5f1e4122bf 100644 --- a/pkg/controller/machine/controller.go +++ b/pkg/controller/machine/controller.go @@ -49,6 +49,18 @@ const ( // ExcludeNodeDrainingAnnotation annotation explicitly skips node draining if set ExcludeNodeDrainingAnnotation = "machine.openshift.io/exclude-node-draining" + + // MachineRegionLabelName as annotation name for a machine region + MachineRegionLabelName = "machine.openshift.io/region" + + // MachineAZLabelName as annotation name for a machine AZ + MachineAZLabelName = "machine.openshift.io/zone" + + // MachineInstanceStateAnnotationName as annotation name for a machine instance state + MachineInstanceStateAnnotationName = "machine.openshift.io/instance-state" + + // MachineInstanceTypeLabelName as annotation name for a machine instance type + MachineInstanceTypeLabelName = "machine.openshift.io/instance-type" ) var DefaultActuator Actuator