Skip to content

Commit

Permalink
feat(remote-wal): integrate kafka remote wal (#146)
Browse files Browse the repository at this point in the history
* feat(remote-wal): integrate kafka remote wal

* fix: e2e error for upstream breaking change
  • Loading branch information
zyy17 authored Apr 12, 2024
1 parent 2924637 commit 718e5a6
Show file tree
Hide file tree
Showing 17 changed files with 227 additions and 128 deletions.
12 changes: 12 additions & 0 deletions apis/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,18 @@ type StorageSpec struct {
DataHome string `json:"dataHome,omitempty"`
}

// RemoteWalProvider defines the remote wal provider for the cluster.
type RemoteWalProvider struct {
// +optional
KafkaRemoteWal *KafkaRemoteWal `json:"kafka,omitempty"`
}

// KafkaRemoteWal is the specification for remote WAL that uses Kafka.
type KafkaRemoteWal struct {
// +optional
BrokerEndpoints []string `json:"brokerEndpoints,omitempty"`
}

type ServiceSpec struct {
// type determines how the Service is exposed.
// +optional
Expand Down
28 changes: 13 additions & 15 deletions apis/v1alpha1/defaulting.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,13 @@ func (in *GreptimeDBCluster) SetDefaults() error {
},
},
},
Initializer: &InitializerSpec{Image: defaultInitializer},
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
PrometheusServicePort: int32(defaultPrometheusServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: defaultVersion,
Initializer: &InitializerSpec{Image: defaultInitializer},
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: defaultVersion,
}

if in.Spec.Version == "" &&
Expand Down Expand Up @@ -206,13 +205,12 @@ func (in *GreptimeDBStandalone) SetDefaults() error {
},
},
},
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
PrometheusServicePort: int32(defaultPrometheusServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: defaultVersion,
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: defaultVersion,
LocalStorage: &StorageSpec{
Name: defaultStandaloneStorageName,
StorageSize: defaultDataNodeStorageSize,
Expand Down
39 changes: 18 additions & 21 deletions apis/v1alpha1/defaulting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,12 @@ func TestSetDefaults(t *testing.T) {
DataHome: defaultDataNodeStorageMountPath,
},
},
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
PrometheusServicePort: int32(defaultPrometheusServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: "latest",
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: "latest",
},
},
},
Expand Down Expand Up @@ -381,13 +380,12 @@ func TestSetDefaults(t *testing.T) {
},
},

HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
PrometheusServicePort: int32(defaultPrometheusServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: "latest",
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: "latest",
},
},
},
Expand Down Expand Up @@ -551,13 +549,12 @@ func TestSetDefaults(t *testing.T) {
},
},

HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
PrometheusServicePort: int32(defaultPrometheusServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: "latest",
HTTPServicePort: int32(defaultHTTPServicePort),
GRPCServicePort: int32(defaultGRPCServicePort),
MySQLServicePort: int32(defaultMySQLServicePort),
PostgresServicePort: int32(defaultPostgresServicePort),
OpenTSDBServicePort: int32(defaultOpenTSDBServicePort),
Version: "latest",
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ type GreptimeDBClusterSpec struct {
// +optional
OpenTSDBServicePort int32 `json:"openTSDBServicePort,omitempty"`

// +optional
PrometheusServicePort int32 `json:"prometheusServicePort,omitempty"`

// +optional
EnableInfluxDBProtocol bool `json:"enableInfluxDBProtocol,omitempty"`

Expand All @@ -139,6 +136,9 @@ type GreptimeDBClusterSpec struct {
// +optional
ObjectStorageProvider *ObjectStorageProvider `json:"objectStorage,omitempty"`

// +optional
RemoteWalProvider *RemoteWalProvider `json:"remoteWal,omitempty"`

// More cluster settings can be added here.
}

Expand Down
6 changes: 3 additions & 3 deletions apis/v1alpha1/greptimedbstandalone_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ type GreptimeDBStandaloneSpec struct {
// +optional
OpenTSDBServicePort int32 `json:"openTSDBServicePort,omitempty"`

// +optional
PrometheusServicePort int32 `json:"prometheusServicePort,omitempty"`

// +optional
EnableInfluxDBProtocol bool `json:"enableInfluxDBProtocol,omitempty"`

Expand All @@ -68,6 +65,9 @@ type GreptimeDBStandaloneSpec struct {
// +optional
LocalStorage *StorageSpec `json:"localStorage,omitempty"`

// +optional
RemoteWalProvider *RemoteWalProvider `json:"remoteWal,omitempty"`

// +optional
Config string `json:"config,omitempty"`
}
Expand Down
50 changes: 50 additions & 0 deletions apis/v1alpha1/zz_generated.deepcopy.go

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

13 changes: 10 additions & 3 deletions config/crd/resources/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10743,9 +10743,16 @@ spec:
type: string
type: object
type: object
prometheusServicePort:
format: int32
type: integer
remoteWal:
properties:
kafka:
properties:
brokerEndpoints:
items:
type: string
type: array
type: object
type: object
version:
type: string
type: object
Expand Down
13 changes: 10 additions & 3 deletions config/crd/resources/greptime.io_greptimedbstandalones.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2765,9 +2765,16 @@ spec:
type: string
type: object
type: object
prometheusServicePort:
format: int32
type: integer
remoteWal:
properties:
kafka:
properties:
brokerEndpoints:
items:
type: string
type: array
type: object
type: object
service:
properties:
annotations:
Expand Down
21 changes: 21 additions & 0 deletions config/samples/kafka-remote-wal/cluster.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: greptime.io/v1alpha1
kind: GreptimeDBCluster
metadata:
name: my-cluster
namespace: default
spec:
base:
main:
image: greptime/greptimedb:latest
frontend:
replicas: 1
meta:
replicas: 1
etcdEndpoints:
- "etcd.default:2379"
datanode:
replicas: 3
remoteWal:
kafka:
brokerEndpoints:
- "my-cluster-kafka-bootstrap.kafka:9092"
26 changes: 20 additions & 6 deletions manifests/greptimedb-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10742,9 +10742,16 @@ spec:
type: string
type: object
type: object
prometheusServicePort:
format: int32
type: integer
remoteWal:
properties:
kafka:
properties:
brokerEndpoints:
items:
type: string
type: array
type: object
type: object
version:
type: string
type: object
Expand Down Expand Up @@ -13592,9 +13599,16 @@ spec:
type: string
type: object
type: object
prometheusServicePort:
format: int32
type: integer
remoteWal:
properties:
kafka:
properties:
brokerEndpoints:
items:
type: string
type: array
type: object
type: object
service:
properties:
annotations:
Expand Down
26 changes: 20 additions & 6 deletions manifests/greptimedb-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10749,9 +10749,16 @@ spec:
type: string
type: object
type: object
prometheusServicePort:
format: int32
type: integer
remoteWal:
properties:
kafka:
properties:
brokerEndpoints:
items:
type: string
type: array
type: object
type: object
version:
type: string
type: object
Expand Down Expand Up @@ -13599,9 +13606,16 @@ spec:
type: string
type: object
type: object
prometheusServicePort:
format: int32
type: integer
remoteWal:
properties:
kafka:
properties:
brokerEndpoints:
items:
type: string
type: array
type: object
type: object
service:
properties:
annotations:
Expand Down
Loading

0 comments on commit 718e5a6

Please sign in to comment.