From f6571423dbff221513a31822bf57aec7dc574f91 Mon Sep 17 00:00:00 2001 From: Nikolay Sivko Date: Wed, 17 Dec 2025 17:09:35 -0300 Subject: [PATCH 1/2] update clickhouse to 25.11.2 --- controller/versions.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/versions.go b/controller/versions.go index dabd8d5..3ff19d2 100644 --- a/controller/versions.go +++ b/controller/versions.go @@ -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" ) From 06457c4ec891e852c5ab0aac8c4428771797b40e Mon Sep 17 00:00:00 2001 From: Nikolay Sivko Date: Wed, 17 Dec 2025 19:14:20 -0300 Subject: [PATCH 2/2] skip Prometheus installation when `StoreMetricsInClickhouse` is enabled --- api/v1/coroot_types.go | 2 ++ config/crd/coroot.com_coroots.yaml | 4 ++++ controller/controller.go | 2 +- controller/coroot.go | 10 +++++++--- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/api/v1/coroot_types.go b/api/v1/coroot_types.go index 2df05b0..9028f8f 100644 --- a/api/v1/coroot_types.go +++ b/api/v1/coroot_types.go @@ -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"` diff --git a/config/crd/coroot.com_coroots.yaml b/config/crd/coroot.com_coroots.yaml index 826f2c9..bdebb3c 100644 --- a/config/crd/coroot.com_coroots.yaml +++ b/config/crd/coroot.com_coroots.yaml @@ -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: diff --git a/controller/controller.go b/controller/controller.go index af5255e..cb08a74 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -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)) diff --git a/controller/coroot.go b/controller/coroot.go index ce6473a..7dad00a 100644 --- a/controller/coroot.go +++ b/controller/coroot.go @@ -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 {