diff --git a/apis/v1alpha1/greptimedbcluster_types.go b/apis/v1alpha1/greptimedbcluster_types.go index 277afd48..99379198 100644 --- a/apis/v1alpha1/greptimedbcluster_types.go +++ b/apis/v1alpha1/greptimedbcluster_types.go @@ -64,25 +64,10 @@ type MetaSpec struct { // +optional BackendStorage *BackendStorage `json:"backendStorage,omitempty"` - // EtcdEndpoints is the endpoints of the etcd cluster. - // +optional - // +kubebuilder:deprecatedversion:warning="EtcdEndpoints is deprecated and will be removed in a future version. Please use BackendStorage instead." - EtcdEndpoints []string `json:"etcdEndpoints,omitempty"` - - // EnableCheckEtcdService indicates whether to check etcd cluster health when starting meta. - // +optional - // +kubebuilder:deprecatedversion:warning="EnableCheckEtcdService is deprecated and will be removed in a future version. Please use BackendStorage instead." - EnableCheckEtcdService bool `json:"enableCheckEtcdService,omitempty"` - // EnableRegionFailover indicates whether to enable region failover. // +optional EnableRegionFailover *bool `json:"enableRegionFailover,omitempty"` - // StoreKeyPrefix is the prefix of the key in the etcd. We can use it to isolate the data of different clusters. - // +optional - // +kubebuilder:deprecatedversion:warning="StoreKeyPrefix is deprecated and will be removed in a future version. Please use BackendStorage instead." - StoreKeyPrefix string `json:"storeKeyPrefix,omitempty"` - // RollingUpdate is the rolling update configuration. We always use `RollingUpdate` strategyt. // +optional RollingUpdate *appsv1.RollingUpdateDeployment `json:"rollingUpdate,omitempty"` @@ -290,24 +275,6 @@ func (in *MetaSpec) IsEnableRegionFailover() bool { return in != nil && in.EnableRegionFailover != nil && *in.EnableRegionFailover } -func (in *MetaSpec) GetStoreKeyPrefix() string { - if in != nil { - return in.StoreKeyPrefix - } - return "" -} - -func (in *MetaSpec) GetEtcdEndpoints() []string { - if in != nil { - return in.EtcdEndpoints - } - return nil -} - -func (in *MetaSpec) IsEnableCheckEtcdService() bool { - return in != nil && in.EnableCheckEtcdService -} - // FrontendSpec is the specification for frontend component. type FrontendSpec struct { ComponentSpec `json:",inline"` @@ -1009,10 +976,6 @@ type MetaStatus struct { // ReadyReplicas is the number of ready replicas of the meta. ReadyReplicas int32 `json:"readyReplicas"` - // EtcdEndpoints is the endpoints of the etcd cluster. - // +optional - EtcdEndpoints []string `json:"etcdEndpoints,omitempty"` - // MaintenanceMode is the maintenance mode of the meta. MaintenanceMode bool `json:"maintenanceMode"` } diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index a91d0e34..b76e7682 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -539,7 +539,7 @@ func (in *GreptimeDBClusterSpec) DeepCopy() *GreptimeDBClusterSpec { func (in *GreptimeDBClusterStatus) DeepCopyInto(out *GreptimeDBClusterStatus) { *out = *in out.Frontend = in.Frontend - in.Meta.DeepCopyInto(&out.Meta) + out.Meta = in.Meta out.Datanode = in.Datanode out.Flownode = in.Flownode out.Monitoring = in.Monitoring @@ -992,11 +992,6 @@ func (in *MetaSpec) DeepCopyInto(out *MetaSpec) { *out = new(BackendStorage) (*in).DeepCopyInto(*out) } - if in.EtcdEndpoints != nil { - in, out := &in.EtcdEndpoints, &out.EtcdEndpoints - *out = make([]string, len(*in)) - copy(*out, *in) - } if in.EnableRegionFailover != nil { in, out := &in.EnableRegionFailover, &out.EnableRegionFailover *out = new(bool) @@ -1022,11 +1017,6 @@ func (in *MetaSpec) DeepCopy() *MetaSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetaStatus) DeepCopyInto(out *MetaStatus) { *out = *in - if in.EtcdEndpoints != nil { - in, out := &in.EtcdEndpoints, &out.EtcdEndpoints - *out = make([]string, len(*in)) - copy(*out, *in) - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetaStatus. diff --git a/config/crd/resources/greptime.io_greptimedbclusters.yaml b/config/crd/resources/greptime.io_greptimedbclusters.yaml index 5eaa6f5f..d8e1f147 100644 --- a/config/crd/resources/greptime.io_greptimedbclusters.yaml +++ b/config/crd/resources/greptime.io_greptimedbclusters.yaml @@ -20473,14 +20473,8 @@ spec: type: object config: type: string - enableCheckEtcdService: - type: boolean enableRegionFailover: type: boolean - etcdEndpoints: - items: - type: string - type: array httpPort: format: int32 maximum: 65535 @@ -20533,8 +20527,6 @@ spec: maximum: 65535 minimum: 0 type: integer - storeKeyPrefix: - type: string template: properties: activeDeadlineSeconds: @@ -27746,10 +27738,6 @@ spec: type: object meta: properties: - etcdEndpoints: - items: - type: string - type: array maintenanceMode: type: boolean readyReplicas: diff --git a/controllers/greptimedbcluster/controller_test.go b/controllers/greptimedbcluster/controller_test.go index b7f95f33..e47e69a1 100644 --- a/controllers/greptimedbcluster/controller_test.go +++ b/controllers/greptimedbcluster/controller_test.go @@ -133,8 +133,12 @@ func createCluster(name, namespace string) *v1alpha1.GreptimeDBCluster { ComponentSpec: v1alpha1.ComponentSpec{ Replicas: ptr.To(int32(1)), }, - EtcdEndpoints: []string{ - "etcd.default:2379", + BackendStorage: &v1alpha1.BackendStorage{ + EtcdStorage: &v1alpha1.EtcdStorage{ + Endpoints: []string{ + "etcd.default:2379", + }, + }, }, }, Datanode: &v1alpha1.DatanodeSpec{ diff --git a/controllers/greptimedbcluster/deployers/meta.go b/controllers/greptimedbcluster/deployers/meta.go index f5204c01..62dd9d70 100644 --- a/controllers/greptimedbcluster/deployers/meta.go +++ b/controllers/greptimedbcluster/deployers/meta.go @@ -136,7 +136,6 @@ func (d *MetaDeployer) CheckAndUpdateStatus(ctx context.Context, highLevelObject cluster.Status.Meta.Replicas = *deployment.Spec.Replicas cluster.Status.Meta.ReadyReplicas = deployment.Status.ReadyReplicas - cluster.Status.Meta.EtcdEndpoints = cluster.Spec.Meta.EtcdEndpoints ready := k8sutil.IsDeploymentReady(deployment) @@ -167,16 +166,17 @@ func (d *MetaDeployer) checkEtcdService(ctx context.Context, crdObject client.Ob return err } - if cluster.Spec.Meta == nil || !cluster.Spec.Meta.EnableCheckEtcdService { + if cluster.Spec.Meta == nil || cluster.Spec.Meta.BackendStorage == nil || + cluster.Spec.Meta.BackendStorage.EtcdStorage == nil || !cluster.Spec.Meta.BackendStorage.EtcdStorage.EnableCheckEtcdService { return nil } - maintainer, err := d.etcdMaintenanceBuilder(cluster.Spec.Meta.EtcdEndpoints) + maintainer, err := d.etcdMaintenanceBuilder(cluster.Spec.Meta.BackendStorage.EtcdStorage.Endpoints) if err != nil { return err } - rsp, err := maintainer.Status(ctx, strings.Join(cluster.Spec.Meta.EtcdEndpoints, ",")) + rsp, err := maintainer.Status(ctx, strings.Join(cluster.Spec.Meta.BackendStorage.EtcdStorage.Endpoints, ",")) if err != nil { return err } diff --git a/docs/api-references/docs.md b/docs/api-references/docs.md index acd72a8b..61333b89 100644 --- a/docs/api-references/docs.md +++ b/docs/api-references/docs.md @@ -745,10 +745,7 @@ _Appears in:_ | `rpcPort` _integer_ | RPCPort is the gRPC port of the meta. | | Maximum: 65535
Minimum: 0
| | `httpPort` _integer_ | HTTPPort is the HTTP port of the meta. | | Maximum: 65535
Minimum: 0
| | `backendStorage` _[BackendStorage](#backendstorage)_ | BackendStorage is the specification for the backend storage for meta. | | | -| `etcdEndpoints` _string array_ | EtcdEndpoints is the endpoints of the etcd cluster. | | | -| `enableCheckEtcdService` _boolean_ | EnableCheckEtcdService indicates whether to check etcd cluster health when starting meta. | | | | `enableRegionFailover` _boolean_ | EnableRegionFailover indicates whether to enable region failover. | | | -| `storeKeyPrefix` _string_ | StoreKeyPrefix is the prefix of the key in the etcd. We can use it to isolate the data of different clusters. | | | | `rollingUpdate` _[RollingUpdateDeployment](https://kubernetes.io/docs/reference/generated/kubernetes-api/v/#rollingupdatedeployment-v1-apps)_ | RollingUpdate is the rolling update configuration. We always use `RollingUpdate` strategyt. | | | @@ -767,7 +764,6 @@ _Appears in:_ | --- | --- | --- | --- | | `replicas` _integer_ | Replicas is the number of replicas of the meta. | | | | `readyReplicas` _integer_ | ReadyReplicas is the number of ready replicas of the meta. | | | -| `etcdEndpoints` _string array_ | EtcdEndpoints is the endpoints of the etcd cluster. | | | | `maintenanceMode` _boolean_ | MaintenanceMode is the maintenance mode of the meta. | | | diff --git a/manifests/bundle.yaml b/manifests/bundle.yaml index 594e021b..20cf9980 100644 --- a/manifests/bundle.yaml +++ b/manifests/bundle.yaml @@ -20479,14 +20479,8 @@ spec: type: object config: type: string - enableCheckEtcdService: - type: boolean enableRegionFailover: type: boolean - etcdEndpoints: - items: - type: string - type: array httpPort: format: int32 maximum: 65535 @@ -20539,8 +20533,6 @@ spec: maximum: 65535 minimum: 0 type: integer - storeKeyPrefix: - type: string template: properties: activeDeadlineSeconds: @@ -27752,10 +27744,6 @@ spec: type: object meta: properties: - etcdEndpoints: - items: - type: string - type: array maintenanceMode: type: boolean readyReplicas: diff --git a/manifests/crds.yaml b/manifests/crds.yaml index c26e52a8..64ae4210 100644 --- a/manifests/crds.yaml +++ b/manifests/crds.yaml @@ -20472,14 +20472,8 @@ spec: type: object config: type: string - enableCheckEtcdService: - type: boolean enableRegionFailover: type: boolean - etcdEndpoints: - items: - type: string - type: array httpPort: format: int32 maximum: 65535 @@ -20532,8 +20526,6 @@ spec: maximum: 65535 minimum: 0 type: integer - storeKeyPrefix: - type: string template: properties: activeDeadlineSeconds: @@ -27745,10 +27737,6 @@ spec: type: object meta: properties: - etcdEndpoints: - items: - type: string - type: array maintenanceMode: type: boolean readyReplicas: diff --git a/pkg/dbconfig/meta_config.go b/pkg/dbconfig/meta_config.go index 6304ffd6..968c9bee 100644 --- a/pkg/dbconfig/meta_config.go +++ b/pkg/dbconfig/meta_config.go @@ -145,15 +145,6 @@ func (c *MetaConfig) configureBackendStorage(spec *v1alpha1.MetaSpec, namespace c.MetaElectionLockID = ptr.To(postgresql.ElectionLockID) } - // Compatibility with the old api version. - if len(spec.EtcdEndpoints) > 0 { - c.Backend = ptr.To("etcd_store") - c.StoreAddrs = spec.EtcdEndpoints - if prefix := spec.GetStoreKeyPrefix(); prefix != "" { - c.StoreKeyPrefix = ptr.To(prefix) - } - } - return nil }