From 2e130bfb9237e3a5db9ce3c5e1b09bad46a77615 Mon Sep 17 00:00:00 2001 From: testisnullus Date: Mon, 18 Sep 2023 14:31:09 +0300 Subject: [PATCH] Cluster's CRDs printing was petrified when kubectl get --- apis/clusters/v1beta1/cadence_types.go | 4 ++ apis/clusters/v1beta1/cassandra_types.go | 4 ++ apis/clusters/v1beta1/kafka_types.go | 4 ++ apis/clusters/v1beta1/kafkaconnect_types.go | 4 ++ apis/clusters/v1beta1/opensearch_types.go | 4 ++ apis/clusters/v1beta1/postgresql_types.go | 4 ++ apis/clusters/v1beta1/redis_types.go | 4 ++ apis/clusters/v1beta1/zookeeper_types.go | 4 ++ .../clusters.instaclustr.com_cadences.yaml | 15 ++++++- .../clusters.instaclustr.com_cassandras.yaml | 15 ++++++- ...lusters.instaclustr.com_kafkaconnects.yaml | 15 ++++++- .../clusters.instaclustr.com_kafkas.yaml | 15 ++++++- ...clusters.instaclustr.com_opensearches.yaml | 15 ++++++- .../clusters.instaclustr.com_postgresqls.yaml | 15 ++++++- .../bases/clusters.instaclustr.com_redis.yaml | 15 ++++++- .../clusters.instaclustr.com_zookeepers.yaml | 15 ++++++- config/samples/clusters_v1beta1_cadence.yaml | 2 +- .../samples/clusters_v1beta1_postgresql.yaml | 6 +-- ...i_cluster_maintenance_events_v2_service.go | 39 ++++++++++++------- 19 files changed, 173 insertions(+), 26 deletions(-) diff --git a/apis/clusters/v1beta1/cadence_types.go b/apis/clusters/v1beta1/cadence_types.go index 84229262e..96f79fb0c 100644 --- a/apis/clusters/v1beta1/cadence_types.go +++ b/apis/clusters/v1beta1/cadence_types.go @@ -131,6 +131,10 @@ type CadenceStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // Cadence is the Schema for the cadences API type Cadence struct { diff --git a/apis/clusters/v1beta1/cassandra_types.go b/apis/clusters/v1beta1/cassandra_types.go index 4899c1e99..433ec513b 100644 --- a/apis/clusters/v1beta1/cassandra_types.go +++ b/apis/clusters/v1beta1/cassandra_types.go @@ -87,6 +87,10 @@ type CassandraDataCentre struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // Cassandra is the Schema for the cassandras API type Cassandra struct { diff --git a/apis/clusters/v1beta1/kafka_types.go b/apis/clusters/v1beta1/kafka_types.go index c4540915b..cb7d7f40b 100644 --- a/apis/clusters/v1beta1/kafka_types.go +++ b/apis/clusters/v1beta1/kafka_types.go @@ -106,6 +106,10 @@ type KafkaStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // Kafka is the Schema for the kafkas API type Kafka struct { diff --git a/apis/clusters/v1beta1/kafkaconnect_types.go b/apis/clusters/v1beta1/kafkaconnect_types.go index 3b66478bb..ad7bd097c 100644 --- a/apis/clusters/v1beta1/kafkaconnect_types.go +++ b/apis/clusters/v1beta1/kafkaconnect_types.go @@ -120,6 +120,10 @@ type KafkaConnectStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // KafkaConnect is the Schema for the kafkaconnects API type KafkaConnect struct { diff --git a/apis/clusters/v1beta1/opensearch_types.go b/apis/clusters/v1beta1/opensearch_types.go index 97df48367..d22499e8a 100644 --- a/apis/clusters/v1beta1/opensearch_types.go +++ b/apis/clusters/v1beta1/opensearch_types.go @@ -488,6 +488,10 @@ type OpenSearchStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // OpenSearch is the Schema for the opensearches API type OpenSearch struct { diff --git a/apis/clusters/v1beta1/postgresql_types.go b/apis/clusters/v1beta1/postgresql_types.go index 35a6ac533..a73912b0d 100644 --- a/apis/clusters/v1beta1/postgresql_types.go +++ b/apis/clusters/v1beta1/postgresql_types.go @@ -99,6 +99,10 @@ type PgStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // PostgreSQL is the Schema for the postgresqls API type PostgreSQL struct { diff --git a/apis/clusters/v1beta1/redis_types.go b/apis/clusters/v1beta1/redis_types.go index 86a268b8a..8d8c80092 100644 --- a/apis/clusters/v1beta1/redis_types.go +++ b/apis/clusters/v1beta1/redis_types.go @@ -89,6 +89,10 @@ type RedisStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // Redis is the Schema for the redis API type Redis struct { diff --git a/apis/clusters/v1beta1/zookeeper_types.go b/apis/clusters/v1beta1/zookeeper_types.go index 8ca89009e..1cf35010e 100644 --- a/apis/clusters/v1beta1/zookeeper_types.go +++ b/apis/clusters/v1beta1/zookeeper_types.go @@ -50,6 +50,10 @@ type ZookeeperStatus struct { //+kubebuilder:object:root=true //+kubebuilder:subresource:status +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +//+kubebuilder:printcolumn:name="ID",type=string,JSONPath=`.status.id` +//+kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` +//+kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version` // Zookeeper is the Schema for the zookeepers API type Zookeeper struct { diff --git a/config/crd/bases/clusters.instaclustr.com_cadences.yaml b/config/crd/bases/clusters.instaclustr.com_cadences.yaml index ee4025880..12bfbb519 100644 --- a/config/crd/bases/clusters.instaclustr.com_cadences.yaml +++ b/config/crd/bases/clusters.instaclustr.com_cadences.yaml @@ -15,7 +15,20 @@ spec: singular: cadence scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: Cadence is the Schema for the cadences API diff --git a/config/crd/bases/clusters.instaclustr.com_cassandras.yaml b/config/crd/bases/clusters.instaclustr.com_cassandras.yaml index cf26549e0..577e54782 100644 --- a/config/crd/bases/clusters.instaclustr.com_cassandras.yaml +++ b/config/crd/bases/clusters.instaclustr.com_cassandras.yaml @@ -15,7 +15,20 @@ spec: singular: cassandra scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: Cassandra is the Schema for the cassandras API diff --git a/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml b/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml index d762b6512..a1cf9fb89 100644 --- a/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml +++ b/config/crd/bases/clusters.instaclustr.com_kafkaconnects.yaml @@ -15,7 +15,20 @@ spec: singular: kafkaconnect scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: KafkaConnect is the Schema for the kafkaconnects API diff --git a/config/crd/bases/clusters.instaclustr.com_kafkas.yaml b/config/crd/bases/clusters.instaclustr.com_kafkas.yaml index 01dd6a5d3..9f428385a 100644 --- a/config/crd/bases/clusters.instaclustr.com_kafkas.yaml +++ b/config/crd/bases/clusters.instaclustr.com_kafkas.yaml @@ -15,7 +15,20 @@ spec: singular: kafka scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: Kafka is the Schema for the kafkas API diff --git a/config/crd/bases/clusters.instaclustr.com_opensearches.yaml b/config/crd/bases/clusters.instaclustr.com_opensearches.yaml index fa871171d..f3c5049d0 100644 --- a/config/crd/bases/clusters.instaclustr.com_opensearches.yaml +++ b/config/crd/bases/clusters.instaclustr.com_opensearches.yaml @@ -15,7 +15,20 @@ spec: singular: opensearch scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: OpenSearch is the Schema for the opensearches API diff --git a/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml b/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml index 36c10018b..9f2d07a84 100644 --- a/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml +++ b/config/crd/bases/clusters.instaclustr.com_postgresqls.yaml @@ -15,7 +15,20 @@ spec: singular: postgresql scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: PostgreSQL is the Schema for the postgresqls API diff --git a/config/crd/bases/clusters.instaclustr.com_redis.yaml b/config/crd/bases/clusters.instaclustr.com_redis.yaml index 8ede95292..c261a7c33 100644 --- a/config/crd/bases/clusters.instaclustr.com_redis.yaml +++ b/config/crd/bases/clusters.instaclustr.com_redis.yaml @@ -15,7 +15,20 @@ spec: singular: redis scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: Redis is the Schema for the redis API diff --git a/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml b/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml index 0b96113b3..a1db3c505 100644 --- a/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml +++ b/config/crd/bases/clusters.instaclustr.com_zookeepers.yaml @@ -15,7 +15,20 @@ spec: singular: zookeeper scope: Namespaced versions: - - name: v1beta1 + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - jsonPath: .status.id + name: ID + type: string + - jsonPath: .status.state + name: State + type: string + - jsonPath: .spec.version + name: Version + type: string + name: v1beta1 schema: openAPIV3Schema: description: Zookeeper is the Schema for the zookeepers API diff --git a/config/samples/clusters_v1beta1_cadence.yaml b/config/samples/clusters_v1beta1_cadence.yaml index b50c5cae9..b1bbad012 100644 --- a/config/samples/clusters_v1beta1_cadence.yaml +++ b/config/samples/clusters_v1beta1_cadence.yaml @@ -40,7 +40,7 @@ spec: # - email: "rostyslp@netapp.com" privateNetworkCluster: false dataCentres: - - region: "US_EAST_1" + - region: "US_EAST_2" network: "10.12.0.0/16" # if you use multi-region mode please provide # non-overlapping CIDR block for the secondary mode cluster diff --git a/config/samples/clusters_v1beta1_postgresql.yaml b/config/samples/clusters_v1beta1_postgresql.yaml index e3c3f05c2..df08bf4af 100644 --- a/config/samples/clusters_v1beta1_postgresql.yaml +++ b/config/samples/clusters_v1beta1_postgresql.yaml @@ -42,8 +42,8 @@ spec: # - email: "rostyslp@netapp.com" # description: "test 222" slaTier: "NON_PRODUCTION" - userRef: - - namespace: default - name: postgresqluser-sample +# userRef: +# - namespace: default +# name: postgresqluser-sample privateNetworkCluster: false synchronousModeStrict: false diff --git a/pkg/instaclustr/mock/server/go/api_cluster_maintenance_events_v2_service.go b/pkg/instaclustr/mock/server/go/api_cluster_maintenance_events_v2_service.go index 0e1537eee..8302f63fb 100644 --- a/pkg/instaclustr/mock/server/go/api_cluster_maintenance_events_v2_service.go +++ b/pkg/instaclustr/mock/server/go/api_cluster_maintenance_events_v2_service.go @@ -11,8 +11,6 @@ package openapi import ( "context" - "errors" - "net/http" ) // ClusterMaintenanceEventsV2APIService is a service that implements the logic for the ClusterMaintenanceEventsV2APIServicer @@ -32,9 +30,14 @@ func (s *ClusterMaintenanceEventsV2APIService) ClusterManagementV2DataSourcesClu // Add api_cluster_maintenance_events_v2_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. // TODO: Uncomment the next line to return response Response(200, []ClusterMaintenanceEventsV2{}) or use other options such as http.Ok ... - // return Response(200, []ClusterMaintenanceEventsV2{}), nil - - return Response(http.StatusNotImplemented, nil), errors.New("ClusterManagementV2DataSourcesClusterClusterIdMaintenanceEventsV2InProgressV2Get method not implemented") + return Response(200, []ClusterMaintenanceEventsV2{{ + MaintenanceEvents: []ClusterMaintenanceEventV2{ + { + Id: CreatedID, + }, + }, + }, + }), nil } // ClusterManagementV2DataSourcesClusterClusterIdMaintenanceEventsV2PastV2Get - @@ -43,9 +46,14 @@ func (s *ClusterMaintenanceEventsV2APIService) ClusterManagementV2DataSourcesClu // Add api_cluster_maintenance_events_v2_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. // TODO: Uncomment the next line to return response Response(200, []ClusterMaintenanceEventsV2{}) or use other options such as http.Ok ... - // return Response(200, []ClusterMaintenanceEventsV2{}), nil - - return Response(http.StatusNotImplemented, nil), errors.New("ClusterManagementV2DataSourcesClusterClusterIdMaintenanceEventsV2PastV2Get method not implemented") + return Response(200, []ClusterMaintenanceEventsV2{{ + MaintenanceEvents: []ClusterMaintenanceEventV2{ + { + Id: CreatedID, + }, + }, + }, + }), nil } // ClusterManagementV2DataSourcesClusterClusterIdMaintenanceEventsV2UpcomingV2Get - @@ -54,9 +62,14 @@ func (s *ClusterMaintenanceEventsV2APIService) ClusterManagementV2DataSourcesClu // Add api_cluster_maintenance_events_v2_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. // TODO: Uncomment the next line to return response Response(200, []ClusterMaintenanceEventSchedulesV2{}) or use other options such as http.Ok ... - // return Response(200, []ClusterMaintenanceEventSchedulesV2{}), nil - - return Response(http.StatusNotImplemented, nil), errors.New("ClusterManagementV2DataSourcesClusterClusterIdMaintenanceEventsV2UpcomingV2Get method not implemented") + return Response(200, []ClusterMaintenanceEventsV2{{ + MaintenanceEvents: []ClusterMaintenanceEventV2{ + { + Id: CreatedID, + }, + }, + }, + }), nil } // ClusterManagementV2OperationsMaintenanceEventsMaintenanceEventIdV2RescheduleMaintenanceEventV2Put - Reschedule a maintenance event @@ -65,7 +78,5 @@ func (s *ClusterMaintenanceEventsV2APIService) ClusterManagementV2OperationsMain // Add api_cluster_maintenance_events_v2_service.go to the .openapi-generator-ignore to avoid overwriting this service implementation when updating open api generation. // TODO: Uncomment the next line to return response Response(200, ClusterMaintenanceEventScheduleV2{}) or use other options such as http.Ok ... - // return Response(200, ClusterMaintenanceEventScheduleV2{}), nil - - return Response(http.StatusNotImplemented, nil), errors.New("ClusterManagementV2OperationsMaintenanceEventsMaintenanceEventIdV2RescheduleMaintenanceEventV2Put method not implemented") + return Response(200, ClusterMaintenanceEventScheduleV2{}), nil }