Browse Source

feat: additional columns for kubectl output (#1359)

Gareth Evans 3 years ago
parent
commit
7eff8db532

+ 6 - 2
apis/externalsecrets/v1beta1/clusterexternalsecret_types.go

@@ -76,10 +76,14 @@ type ClusterExternalSecretStatus struct {
 	Conditions []ClusterExternalSecretStatusCondition `json:"conditions,omitempty"`
 	Conditions []ClusterExternalSecretStatusCondition `json:"conditions,omitempty"`
 }
 }
 
 
-//+kubebuilder:object:root=true
+// +kubebuilder:object:root=true
 // +kubebuilder:storageversion
 // +kubebuilder:storageversion
 // +kubebuilder:resource:scope=Cluster,categories={externalsecrets},shortName=ces
 // +kubebuilder:resource:scope=Cluster,categories={externalsecrets},shortName=ces
-//+kubebuilder:subresource:status
+// +kubebuilder:subresource:status
+// +kubebuilder:printcolumn:name="Store",type=string,JSONPath=`.spec.secretStoreRef.name`
+// +kubebuilder:printcolumn:name="Refresh Interval",type=string,JSONPath=`.spec.refreshInterval`
+// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
+// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
 // ClusterExternalSecret is the Schema for the clusterexternalsecrets API.
 // ClusterExternalSecret is the Schema for the clusterexternalsecrets API.
 type ClusterExternalSecret struct {
 type ClusterExternalSecret struct {
 	metav1.TypeMeta   `json:",inline"`
 	metav1.TypeMeta   `json:",inline"`

+ 1 - 0
apis/externalsecrets/v1beta1/externalsecret_types.go

@@ -332,6 +332,7 @@ type ExternalSecretStatus struct {
 // +kubebuilder:printcolumn:name="Store",type=string,JSONPath=`.spec.secretStoreRef.name`
 // +kubebuilder:printcolumn:name="Store",type=string,JSONPath=`.spec.secretStoreRef.name`
 // +kubebuilder:printcolumn:name="Refresh Interval",type=string,JSONPath=`.spec.refreshInterval`
 // +kubebuilder:printcolumn:name="Refresh Interval",type=string,JSONPath=`.spec.refreshInterval`
 // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
 // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
+// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
 type ExternalSecret struct {
 type ExternalSecret struct {
 	metav1.TypeMeta   `json:",inline"`
 	metav1.TypeMeta   `json:",inline"`
 	metav1.ObjectMeta `json:"metadata,omitempty"`
 	metav1.ObjectMeta `json:"metadata,omitempty"`

+ 3 - 0
apis/externalsecrets/v1beta1/secretstore_types.go

@@ -149,6 +149,7 @@ type SecretStoreStatus struct {
 // SecretStore represents a secure external location for storing secrets, which can be referenced as part of `storeRef` fields.
 // SecretStore represents a secure external location for storing secrets, which can be referenced as part of `storeRef` fields.
 // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
 // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
 // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
 // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
+// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
 // +kubebuilder:subresource:status
 // +kubebuilder:subresource:status
 // +kubebuilder:resource:scope=Namespaced,categories={externalsecrets},shortName=ss
 // +kubebuilder:resource:scope=Namespaced,categories={externalsecrets},shortName=ss
 type SecretStore struct {
 type SecretStore struct {
@@ -173,6 +174,8 @@ type SecretStoreList struct {
 
 
 // ClusterSecretStore represents a secure external location for storing secrets, which can be referenced as part of `storeRef` fields.
 // ClusterSecretStore represents a secure external location for storing secrets, which can be referenced as part of `storeRef` fields.
 // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
 // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
+// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].reason`
+// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
 // +kubebuilder:subresource:status
 // +kubebuilder:subresource:status
 // +kubebuilder:resource:scope=Cluster,categories={externalsecrets},shortName=css
 // +kubebuilder:resource:scope=Cluster,categories={externalsecrets},shortName=css
 type ClusterSecretStore struct {
 type ClusterSecretStore struct {

+ 14 - 1
config/crds/bases/external-secrets.io_clusterexternalsecrets.yaml

@@ -18,7 +18,20 @@ spec:
     singular: clusterexternalsecret
     singular: clusterexternalsecret
   scope: Cluster
   scope: Cluster
   versions:
   versions:
-  - name: v1beta1
+  - additionalPrinterColumns:
+    - jsonPath: .spec.secretStoreRef.name
+      name: Store
+      type: string
+    - jsonPath: .spec.refreshInterval
+      name: Refresh Interval
+      type: string
+    - jsonPath: .status.conditions[?(@.type=="Ready")].reason
+      name: Status
+      type: string
+    - jsonPath: .status.conditions[?(@.type=="Ready")].status
+      name: Ready
+      type: string
+    name: v1beta1
     schema:
     schema:
       openAPIV3Schema:
       openAPIV3Schema:
         description: ClusterExternalSecret is the Schema for the clusterexternalsecrets
         description: ClusterExternalSecret is the Schema for the clusterexternalsecrets

+ 6 - 0
config/crds/bases/external-secrets.io_clustersecretstores.yaml

@@ -1387,6 +1387,12 @@ spec:
     - jsonPath: .metadata.creationTimestamp
     - jsonPath: .metadata.creationTimestamp
       name: AGE
       name: AGE
       type: date
       type: date
+    - jsonPath: .status.conditions[?(@.type=="Ready")].reason
+      name: Status
+      type: string
+    - jsonPath: .status.conditions[?(@.type=="Ready")].status
+      name: Ready
+      type: string
     name: v1beta1
     name: v1beta1
     schema:
     schema:
       openAPIV3Schema:
       openAPIV3Schema:

+ 3 - 0
config/crds/bases/external-secrets.io_externalsecrets.yaml

@@ -272,6 +272,9 @@ spec:
     - jsonPath: .status.conditions[?(@.type=="Ready")].reason
     - jsonPath: .status.conditions[?(@.type=="Ready")].reason
       name: Status
       name: Status
       type: string
       type: string
+    - jsonPath: .status.conditions[?(@.type=="Ready")].status
+      name: Ready
+      type: string
     name: v1beta1
     name: v1beta1
     schema:
     schema:
       openAPIV3Schema:
       openAPIV3Schema:

+ 3 - 0
config/crds/bases/external-secrets.io_secretstores.yaml

@@ -1390,6 +1390,9 @@ spec:
     - jsonPath: .status.conditions[?(@.type=="Ready")].reason
     - jsonPath: .status.conditions[?(@.type=="Ready")].reason
       name: Status
       name: Status
       type: string
       type: string
+    - jsonPath: .status.conditions[?(@.type=="Ready")].status
+      name: Ready
+      type: string
     name: v1beta1
     name: v1beta1
     schema:
     schema:
       openAPIV3Schema:
       openAPIV3Schema:

+ 26 - 1
deploy/crds/bundle.yaml

@@ -18,7 +18,20 @@ spec:
     singular: clusterexternalsecret
     singular: clusterexternalsecret
   scope: Cluster
   scope: Cluster
   versions:
   versions:
-    - name: v1beta1
+    - additionalPrinterColumns:
+        - jsonPath: .spec.secretStoreRef.name
+          name: Store
+          type: string
+        - jsonPath: .spec.refreshInterval
+          name: Refresh Interval
+          type: string
+        - jsonPath: .status.conditions[?(@.type=="Ready")].reason
+          name: Status
+          type: string
+        - jsonPath: .status.conditions[?(@.type=="Ready")].status
+          name: Ready
+          type: string
+      name: v1beta1
       schema:
       schema:
         openAPIV3Schema:
         openAPIV3Schema:
           description: ClusterExternalSecret is the Schema for the clusterexternalsecrets API.
           description: ClusterExternalSecret is the Schema for the clusterexternalsecrets API.
@@ -1370,6 +1383,12 @@ spec:
         - jsonPath: .metadata.creationTimestamp
         - jsonPath: .metadata.creationTimestamp
           name: AGE
           name: AGE
           type: date
           type: date
+        - jsonPath: .status.conditions[?(@.type=="Ready")].reason
+          name: Status
+          type: string
+        - jsonPath: .status.conditions[?(@.type=="Ready")].status
+          name: Ready
+          type: string
       name: v1beta1
       name: v1beta1
       schema:
       schema:
         openAPIV3Schema:
         openAPIV3Schema:
@@ -2746,6 +2765,9 @@ spec:
         - jsonPath: .status.conditions[?(@.type=="Ready")].reason
         - jsonPath: .status.conditions[?(@.type=="Ready")].reason
           name: Status
           name: Status
           type: string
           type: string
+        - jsonPath: .status.conditions[?(@.type=="Ready")].status
+          name: Ready
+          type: string
       name: v1beta1
       name: v1beta1
       schema:
       schema:
         openAPIV3Schema:
         openAPIV3Schema:
@@ -4050,6 +4072,9 @@ spec:
         - jsonPath: .status.conditions[?(@.type=="Ready")].reason
         - jsonPath: .status.conditions[?(@.type=="Ready")].reason
           name: Status
           name: Status
           type: string
           type: string
+        - jsonPath: .status.conditions[?(@.type=="Ready")].status
+          name: Ready
+          type: string
       name: v1beta1
       name: v1beta1
       schema:
       schema:
         openAPIV3Schema:
         openAPIV3Schema: