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
2 changes: 2 additions & 0 deletions api/v1/coroot_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ type CorootSpec struct {
GRPC GRPCSpec `json:"grpc,omitempty"`
// TLS settings (enables TLS for gRPC if defined).
TLS *TLSSpec `json:"tls,omitempty"`
// Store metrics in ClickHouse. If enabled, Prometheus will not be installed.
StoreMetricsInClickhouse bool `json:"storeMetricsInClickhouse,omitempty"`
// Environment variables for Coroot.
Env []corev1.EnvVar `json:"env,omitempty"`

Expand Down
4 changes: 4 additions & 0 deletions config/crd/coroot.com_coroots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8126,6 +8126,10 @@ spec:
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
type: object
storeMetricsInClickhouse:
description: Store metrics in ClickHouse. If enabled, Prometheus will
not be installed.
type: boolean
tls:
description: TLS settings (enables TLS for gRPC if defined).
properties:
Expand Down
2 changes: 1 addition & 1 deletion controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (r *CorootReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctr
}
r.CreateOrUpdateIngress(ctx, cr, r.corootIngress(cr), cr.Spec.Ingress == nil)

if cr.Spec.ExternalPrometheus == nil {
if cr.Spec.ExternalPrometheus == nil && !cr.Spec.StoreMetricsInClickhouse {
r.CreateOrUpdateServiceAccount(ctx, cr, "prometheus", sccNonroot)
r.CreateOrUpdatePVC(ctx, cr, r.prometheusPVC(cr), cr.Spec.Prometheus.Storage.ReclaimPolicy)
r.CreateOrUpdateDeployment(ctx, cr, r.prometheusDeployment(cr))
Expand Down
10 changes: 7 additions & 3 deletions controller/coroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,13 @@ func (r *CorootReconciler) corootStatefulSet(cr *corootv1.Coroot, configEnvs Con
env = append(env, corev1.EnvVar{Name: "GLOBAL_PROMETHEUS_REMOTE_WRITE_URL", Value: ep.RemoteWriteUrl})
}
} else {
env = append(env,
corev1.EnvVar{Name: "GLOBAL_PROMETHEUS_URL", Value: fmt.Sprintf("http://%s-prometheus.%s:9090", cr.Name, cr.Namespace)},
)
if cr.Spec.StoreMetricsInClickhouse {
env = append(env, corev1.EnvVar{Name: "GLOBAL_PROMETHEUS_USE_CLICKHOUSE", Value: "true"})
} else {
env = append(env,
corev1.EnvVar{Name: "GLOBAL_PROMETHEUS_URL", Value: fmt.Sprintf("http://%s-prometheus.%s:9090", cr.Name, cr.Namespace)},
)
}
}

if ec := cr.Spec.ExternalClickhouse; ec != nil {
Expand Down
2 changes: 1 addition & 1 deletion controller/versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
CorootImageRegistry = "ghcr.io/coroot"

ClickhouseImage = "clickhouse:25.1.3-ubi9-0"
ClickhouseImage = "clickhouse:25.11.2-ubi9-0"
PrometheusImage = "prometheus:2.55.1-ubi9-0"
KubeStateMetricsImage = "kube-state-metrics:2.15.0-ubi9-0"
)
Expand Down