Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
}
Expand Down
12 changes: 1 addition & 11 deletions apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions config/crd/resources/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -20533,8 +20527,6 @@ spec:
maximum: 65535
minimum: 0
type: integer
storeKeyPrefix:
type: string
template:
properties:
activeDeadlineSeconds:
Expand Down Expand Up @@ -27746,10 +27738,6 @@ spec:
type: object
meta:
properties:
etcdEndpoints:
items:
type: string
type: array
maintenanceMode:
type: boolean
readyReplicas:
Expand Down
8 changes: 6 additions & 2 deletions controllers/greptimedbcluster/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions controllers/greptimedbcluster/deployers/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 0 additions & 4 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,7 @@ _Appears in:_
| `rpcPort` _integer_ | RPCPort is the gRPC port of the meta. | | Maximum: 65535 <br />Minimum: 0 <br /> |
| `httpPort` _integer_ | HTTPPort is the HTTP port of the meta. | | Maximum: 65535 <br />Minimum: 0 <br /> |
| `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. | | |


Expand All @@ -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. | | |


Expand Down
12 changes: 0 additions & 12 deletions manifests/bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -20539,8 +20533,6 @@ spec:
maximum: 65535
minimum: 0
type: integer
storeKeyPrefix:
type: string
template:
properties:
activeDeadlineSeconds:
Expand Down Expand Up @@ -27752,10 +27744,6 @@ spec:
type: object
meta:
properties:
etcdEndpoints:
items:
type: string
type: array
maintenanceMode:
type: boolean
readyReplicas:
Expand Down
12 changes: 0 additions & 12 deletions manifests/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -20532,8 +20526,6 @@ spec:
maximum: 65535
minimum: 0
type: integer
storeKeyPrefix:
type: string
template:
properties:
activeDeadlineSeconds:
Expand Down Expand Up @@ -27745,10 +27737,6 @@ spec:
type: object
meta:
properties:
etcdEndpoints:
items:
type: string
type: array
maintenanceMode:
type: boolean
readyReplicas:
Expand Down
9 changes: 0 additions & 9 deletions pkg/dbconfig/meta_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Loading