From c61b5d4f457aa179cd4441868eed061074a5e6df Mon Sep 17 00:00:00 2001 From: petar-cvit Date: Wed, 2 Apr 2025 14:16:37 +0200 Subject: [PATCH] crd additional printer columns --- cyclops-ctrl/api/v1alpha1/module_types.go | 7 +++ .../api/v1alpha1/template_auth_rule_types.go | 2 + .../api/v1alpha1/template_store_types.go | 5 ++ .../crd/bases/cyclops-ui.com_modules.yaml | 28 +++++++++- .../cyclops-ui.com_templateauthrules.yaml | 9 ++- .../bases/cyclops-ui.com_templatestores.yaml | 19 ++++++- install/cyclops-install.yaml | 56 ++++++++++++++++++- 7 files changed, 120 insertions(+), 6 deletions(-) diff --git a/cyclops-ctrl/api/v1alpha1/module_types.go b/cyclops-ctrl/api/v1alpha1/module_types.go index aedf4831c..e1719d45a 100644 --- a/cyclops-ctrl/api/v1alpha1/module_types.go +++ b/cyclops-ctrl/api/v1alpha1/module_types.go @@ -121,6 +121,13 @@ type HistoryEntry struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="Target Namespace",type=string,JSONPath=`.spec.targetNamespace`,priority=1 +//+kubebuilder:printcolumn:name="Template",type=string,JSONPath=`.spec.template.repo` +//+kubebuilder:printcolumn:name="Template path",type=string,JSONPath=`.spec.template.path`,priority=1 +//+kubebuilder:printcolumn:name="Template version",type=string,JSONPath=`.spec.template.version`,priority=1 +//+kubebuilder:printcolumn:name="Template resolved version",type=string,JSONPath=`.status.templateResolvedVersion`,priority=1 +//+kubebuilder:printcolumn:name="Reconciliation Status",type=string,JSONPath=`.status.reconciliationStatus.status` // Module is the Schema for the modules API type Module struct { diff --git a/cyclops-ctrl/api/v1alpha1/template_auth_rule_types.go b/cyclops-ctrl/api/v1alpha1/template_auth_rule_types.go index 61b48f5ca..2e57afc46 100644 --- a/cyclops-ctrl/api/v1alpha1/template_auth_rule_types.go +++ b/cyclops-ctrl/api/v1alpha1/template_auth_rule_types.go @@ -37,6 +37,8 @@ type TemplateAuthRuleSpec struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="Repository",type=string,JSONPath=`.spec.repo` // TemplateAuthRule is the Schema for the modules API type TemplateAuthRule struct { diff --git a/cyclops-ctrl/api/v1alpha1/template_store_types.go b/cyclops-ctrl/api/v1alpha1/template_store_types.go index fa3518e5f..b2991a499 100644 --- a/cyclops-ctrl/api/v1alpha1/template_store_types.go +++ b/cyclops-ctrl/api/v1alpha1/template_store_types.go @@ -26,6 +26,11 @@ import ( const IconURLAnnotation = "cyclops-ui.com/icon" //+kubebuilder:object:root=true +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="Type",type=string,JSONPath=`.spec.sourceType` +//+kubebuilder:printcolumn:name="Repository",type=string,JSONPath=`.spec.repo` +//+kubebuilder:printcolumn:name="Path",type=string,JSONPath=`.spec.path` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // TemplateStore holds reference to a template that can be offered as a starting point type TemplateStore struct { diff --git a/cyclops-ctrl/config/crd/bases/cyclops-ui.com_modules.yaml b/cyclops-ctrl/config/crd/bases/cyclops-ui.com_modules.yaml index f4c3e7986..f840e80d3 100644 --- a/cyclops-ctrl/config/crd/bases/cyclops-ui.com_modules.yaml +++ b/cyclops-ctrl/config/crd/bases/cyclops-ui.com_modules.yaml @@ -14,7 +14,33 @@ spec: singular: module scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.targetNamespace + name: Target Namespace + priority: 1 + type: string + - jsonPath: .spec.template.repo + name: Template + type: string + - jsonPath: .spec.template.path + name: Template path + priority: 1 + type: string + - jsonPath: .spec.template.version + name: Template version + priority: 1 + type: string + - jsonPath: .status.templateResolvedVersion + name: Template resolved version + priority: 1 + type: string + - jsonPath: .status.reconciliationStatus.status + name: Reconciliation Status + type: string + name: v1alpha1 schema: openAPIV3Schema: description: Module is the Schema for the modules API diff --git a/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templateauthrules.yaml b/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templateauthrules.yaml index 293e73e79..14098af44 100644 --- a/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templateauthrules.yaml +++ b/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templateauthrules.yaml @@ -14,7 +14,14 @@ spec: singular: templateauthrule scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.repo + name: Repository + type: string + name: v1alpha1 schema: openAPIV3Schema: description: TemplateAuthRule is the Schema for the modules API diff --git a/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templatestores.yaml b/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templatestores.yaml index f97bb441e..dc0a5cac5 100644 --- a/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templatestores.yaml +++ b/cyclops-ctrl/config/crd/bases/cyclops-ui.com_templatestores.yaml @@ -14,7 +14,23 @@ spec: singular: templatestore scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.sourceType + name: Type + type: string + - jsonPath: .spec.repo + name: Repository + type: string + - jsonPath: .spec.path + name: Path + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha1 schema: openAPIV3Schema: description: TemplateStore holds reference to a template that can be offered @@ -59,3 +75,4 @@ spec: type: object served: true storage: true + subresources: {} diff --git a/install/cyclops-install.yaml b/install/cyclops-install.yaml index 97a7116c4..0924a8e71 100644 --- a/install/cyclops-install.yaml +++ b/install/cyclops-install.yaml @@ -13,7 +13,33 @@ spec: singular: module scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.targetNamespace + name: Target Namespace + priority: 1 + type: string + - jsonPath: .spec.template.repo + name: Template + type: string + - jsonPath: .spec.template.path + name: Template path + priority: 1 + type: string + - jsonPath: .spec.template.version + name: Template version + priority: 1 + type: string + - jsonPath: .status.templateResolvedVersion + name: Template resolved version + priority: 1 + type: string + - jsonPath: .status.reconciliationStatus.status + name: Reconciliation Status + type: string + name: v1alpha1 schema: openAPIV3Schema: description: Module is the Schema for the modules API @@ -160,7 +186,14 @@ spec: singular: templateauthrule scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.repo + name: Repository + type: string + name: v1alpha1 schema: openAPIV3Schema: description: TemplateAuthRule is the Schema for the modules API @@ -263,7 +296,23 @@ spec: singular: templatestore scope: Namespaced versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .spec.sourceType + name: Type + type: string + - jsonPath: .spec.repo + name: Repository + type: string + - jsonPath: .spec.path + name: Path + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1alpha1 schema: openAPIV3Schema: description: TemplateStore holds reference to a template that can be offered @@ -308,6 +357,7 @@ spec: type: object served: true storage: true + subresources: {} --- apiVersion: v1 kind: Namespace