Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add datahome configure #119

Merged
Merged
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
2 changes: 1 addition & 1 deletion apis/v1alpha1/defaulting.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
// The default storage settings for datanode.
defaultDataNodeStorageName = "datanode"
defaultDataNodeStorageSize = "10Gi"
defaultDataNodeStorageMountPath = "/tmp/greptimedb"
defaultDataNodeStorageMountPath = "/data/greptimedb"
defaultStorageRetainPolicyType = RetainStorageRetainPolicyTypeRetain

defaultInitializer = "greptime/greptimedb-initializer:latest"
Expand Down
14 changes: 12 additions & 2 deletions apis/v1alpha1/greptimedbcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ type S3StorageProvider struct {
// The S3 directory path.
// +optional
Root string `json:"root,omitempty"`

// The datahome directory
// +optional
// +kubebuilder:default:="/data/greptimedb"
DataHome string `json:"dataHome,omitempty"`
}

type OSSStorageProvider struct {
Expand All @@ -440,14 +445,19 @@ type OSSStorageProvider struct {
// +optional
SecretName string `json:"secretName,omitempty"`

// The S3 directory path.
// The OSS directory path.
// +optional
Root string `json:"root,omitempty"`

// The datahome directory
// +optional
// +kubebuilder:default:="/data/greptimedb"
DataHome string `json:"dataHome,omitempty"`
}

type LocalStorageProvider struct {
// The local directory to store the data.
Directory string `json:"directory,omitempty"`
DataHome string `json:"dataHome,omitempty"`
}

// GreptimeDBClusterSpec defines the desired state of GreptimeDBCluster
Expand Down
8 changes: 7 additions & 1 deletion config/crd/bases/greptime.io_greptimedbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10724,13 +10724,16 @@ spec:
type: string
local:
properties:
directory:
dataHome:
type: string
type: object
oss:
properties:
bucket:
type: string
dataHome:
default: /data/greptimedb
type: string
endpoint:
type: string
region:
Expand All @@ -10744,6 +10747,9 @@ spec:
properties:
bucket:
type: string
dataHome:
default: /data/greptimedb
type: string
endpoint:
type: string
region:
Expand Down
8 changes: 7 additions & 1 deletion manifests/greptimedb-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10723,13 +10723,16 @@ spec:
type: string
local:
properties:
directory:
dataHome:
type: string
type: object
oss:
properties:
bucket:
type: string
dataHome:
default: /data/greptimedb
type: string
endpoint:
type: string
region:
Expand All @@ -10743,6 +10746,9 @@ spec:
properties:
bucket:
type: string
dataHome:
default: /data/greptimedb
type: string
endpoint:
type: string
region:
Expand Down
8 changes: 7 additions & 1 deletion manifests/greptimedb-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10730,13 +10730,16 @@ spec:
type: string
local:
properties:
directory:
dataHome:
type: string
type: object
oss:
properties:
bucket:
type: string
dataHome:
default: /data/greptimedb
type: string
endpoint:
type: string
region:
Expand All @@ -10750,6 +10753,9 @@ spec:
properties:
bucket:
type: string
dataHome:
default: /data/greptimedb
type: string
endpoint:
type: string
region:
Expand Down
5 changes: 4 additions & 1 deletion pkg/dbconfig/datanode_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (c *DatanodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster)
if cluster.Spec.StorageProvider != nil {
if cluster.Spec.StorageProvider.Local != nil {
c.Storage.Type = "File"
c.Storage.DataHome = cluster.Spec.StorageProvider.Local.Directory
c.Storage.DataHome = cluster.Spec.StorageProvider.Local.DataHome
} else if cluster.Spec.StorageProvider.S3 != nil {
if cluster.Spec.StorageProvider.S3.SecretName != "" {
accessKeyID, secretAccessKey, err := c.getOCSCredentials(cluster.Namespace, cluster.Spec.StorageProvider.S3.SecretName)
Expand All @@ -174,6 +174,8 @@ func (c *DatanodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster)
c.Storage.Root = cluster.Spec.StorageProvider.S3.Root
c.Storage.Endpoint = cluster.Spec.StorageProvider.S3.Endpoint
c.Storage.Region = cluster.Spec.StorageProvider.S3.Region
c.Storage.DataHome = cluster.Spec.StorageProvider.S3.DataHome

} else if cluster.Spec.StorageProvider.OSS != nil {
if cluster.Spec.StorageProvider.OSS.SecretName != "" {
accessKeyID, secretAccessKey, err := c.getOCSCredentials(cluster.Namespace, cluster.Spec.StorageProvider.OSS.SecretName)
Expand All @@ -189,6 +191,7 @@ func (c *DatanodeConfig) ConfigureByCluster(cluster *v1alpha1.GreptimeDBCluster)
c.Storage.Root = cluster.Spec.StorageProvider.OSS.Root
c.Storage.Endpoint = cluster.Spec.StorageProvider.OSS.Endpoint
c.Storage.Region = cluster.Spec.StorageProvider.OSS.Region
c.Storage.DataHome = cluster.Spec.StorageProvider.OSS.DataHome
}
}

Expand Down
Loading