Skip to content
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
10 changes: 7 additions & 3 deletions api/v1/coroot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,12 @@ type ExternalClickhouseSpec struct {
Database string `json:"database,omitempty"`
// Password for accessing the external ClickHouse (plain-text, not recommended).
Password string `json:"password,omitempty"`
// Secret containing password for accessing the external ClickHouse.
// Secret containing a password for accessing the external ClickHouse.
PasswordSecret *corev1.SecretKeySelector `json:"passwordSecret,omitempty"`
// Whether to enable TLS for the connection to ClickHouse.
TLSEnabled bool `json:"tlsEnabled,omitempty"`
// Whether to skip verification of the ClickHouse server's TLS certificate.
TLSSkipVerify bool `json:"tlsSkipVerify,omitempty"`
}

type PostgresSpec struct {
Expand All @@ -192,7 +196,7 @@ type PostgresSpec struct {
Database string `json:"database,omitempty"`
// Password for accessing postgres (plain-text, not recommended).
Password string `json:"password,omitempty"`
// Secret containing password for accessing postgres.
// Secret containing a password for accessing postgres.
PasswordSecret *corev1.SecretKeySelector `json:"passwordSecret,omitempty"`
// Extra parameters, e.g., sslmode and connect_timeout.
Params map[string]string `json:"params,omitempty"`
Expand Down Expand Up @@ -234,7 +238,7 @@ type TLSSpec struct {
// Secret containing TLS certificate.
// +kubebuilder:validation:Required
CertSecret *corev1.SecretKeySelector `json:"certSecret,omitempty"`
// Secret containing TLS private key.
// Secret containing a TLS private key.
// +kubebuilder:validation:Required
KeySecret *corev1.SecretKeySelector `json:"keySecret,omitempty"`
}
Expand Down
9 changes: 8 additions & 1 deletion config/crd/coroot.com_coroots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4908,7 +4908,7 @@ spec:
not recommended).
type: string
passwordSecret:
description: Secret containing password for accessing the external
description: Secret containing a password for accessing the external
ClickHouse.
properties:
key:
Expand All @@ -4932,6 +4932,13 @@ spec:
- key
type: object
x-kubernetes-map-type: atomic
tlsEnabled:
description: Whether to enable TLS for the connection to ClickHouse.
type: boolean
tlsSkipVerify:
description: Whether to skip verification of the ClickHouse server's
TLS certificate.
type: boolean
user:
description: Username for accessing the external ClickHouse.
type: string
Expand Down
6 changes: 6 additions & 0 deletions controller/coroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,12 @@ func (r *CorootReconciler) corootStatefulSet(cr *corootv1.Coroot, configEnvs Con
corev1.EnvVar{Name: "GLOBAL_CLICKHOUSE_INITIAL_DATABASE", Value: ec.Database},
)
env = append(env, envVarFromSecret("GLOBAL_CLICKHOUSE_PASSWORD", ec.PasswordSecret, ec.Password))
if ec.TLSEnabled {
env = append(env, corev1.EnvVar{Name: "GLOBAL_CLICKHOUSE_TLS_ENABLED", Value: "true"})
if ec.TLSSkipVerify {
env = append(env, corev1.EnvVar{Name: "GLOBAL_CLICKHOUSE_TLS_SKIP_VERIFY", Value: "true"})
}
}
} else {
env = append(env,
corev1.EnvVar{
Expand Down