From 14e09ead3c9737889e3b29cdd36e749c14e56410 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20B=C3=A4hler?= Date: Mon, 6 Oct 2025 19:21:01 +0200 Subject: [PATCH] feat: pre-release correctures (#1682) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(metrics): cleanup emitted metrics Signed-off-by: Oliver Bähler * chore(ci): bump kind 1.34 Signed-off-by: Oliver Bähler * feat(chart): specific crd names for job rbac Signed-off-by: Oliver Bähler --------- Signed-off-by: Oliver Bähler --- Makefile | 2 +- charts/capsule/README.md | 2 +- .../templates/configuration-default.yaml | 1 - .../capsule/templates/crd-lifecycle/rbac.yaml | 8 +++++++ charts/capsule/values.yaml | 2 +- controllers/tenant/metrics.go | 13 ---------- pkg/metrics/tenant_recorder.go | 24 +++++-------------- 7 files changed, 17 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 4b8caa05..82738920 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ CAPSULE_IMG ?= $(REGISTRY)/$(IMG_BASE) CLUSTER_NAME ?= capsule ## Kubernetes Version Support -KUBERNETES_SUPPORTED_VERSION ?= "v1.33.0" +KUBERNETES_SUPPORTED_VERSION ?= "v1.34.0" ## Tool Binaries KUBECTL ?= kubectl diff --git a/charts/capsule/README.md b/charts/capsule/README.md index 6f55e0fc..2067978a 100644 --- a/charts/capsule/README.md +++ b/charts/capsule/README.md @@ -135,7 +135,7 @@ The following Values have changed key or Value: | monitoring.dashboards.labels | object | `{}` | Labels for dashboard configmaps | | monitoring.dashboards.namespace | string | `""` | Custom namespace for dashboard configmaps | | monitoring.dashboards.operator.allowCrossNamespaceImport | bool | `true` | Allow the Operator to match this resource with Grafanas outside the current namespace | -| monitoring.dashboards.operator.enabled | bool | `true` | Enable Operator Resources (GrafanaDashboard) | +| monitoring.dashboards.operator.enabled | bool | `false` | Enable Operator Resources (GrafanaDashboard) | | monitoring.dashboards.operator.folder | string | `""` | folder assignment for dashboard | | monitoring.dashboards.operator.instanceSelector | object | `{}` | Selects Grafana instances for import | | monitoring.dashboards.operator.resyncPeriod | string | `"10m"` | How often the resource is synced, defaults to 10m0s if not set | diff --git a/charts/capsule/templates/configuration-default.yaml b/charts/capsule/templates/configuration-default.yaml index c8e55c32..792257d9 100644 --- a/charts/capsule/templates/configuration-default.yaml +++ b/charts/capsule/templates/configuration-default.yaml @@ -24,7 +24,6 @@ spec: ignoreUserWithGroups: {{- toYaml .Values.manager.options.ignoreUserWithGroups | nindent 4 }} protectedNamespaceRegex: {{ .Values.manager.options.protectedNamespaceRegex | quote }} - defaultRegistry: {{ .Values.manager.options.defaultRegistry }} {{- with .Values.manager.options.nodeMetadata }} nodeMetadata: {{- toYaml . | nindent 4 }} diff --git a/charts/capsule/templates/crd-lifecycle/rbac.yaml b/charts/capsule/templates/crd-lifecycle/rbac.yaml index b4a138a6..5e21bae9 100644 --- a/charts/capsule/templates/crd-lifecycle/rbac.yaml +++ b/charts/capsule/templates/crd-lifecycle/rbac.yaml @@ -23,11 +23,19 @@ rules: - apiextensions.k8s.io resources: - customresourcedefinitions + resourceNames: + - capsuleconfigurations.capsule.clastix.io + - resourcepoolclaims.capsule.clastix.io + - resourcepools.capsule.clastix.io + - tenantresources.capsule.clastix.io + - globaltenantresources.capsule.clastix.io + - tenants.capsule.clastix.io verbs: - create - delete - get - patch + - update --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/charts/capsule/values.yaml b/charts/capsule/values.yaml index d7cbdea9..31fc3bb1 100644 --- a/charts/capsule/values.yaml +++ b/charts/capsule/values.yaml @@ -314,7 +314,7 @@ monitoring: # Grafana Operator operator: # -- Enable Operator Resources (GrafanaDashboard) - enabled: true + enabled: false # -- Allow the Operator to match this resource with Grafanas outside the current namespace allowCrossNamespaceImport: true # -- How often the resource is synced, defaults to 10m0s if not set diff --git a/controllers/tenant/metrics.go b/controllers/tenant/metrics.go index a4a11411..3d2f1c4e 100644 --- a/controllers/tenant/metrics.go +++ b/controllers/tenant/metrics.go @@ -12,8 +12,6 @@ import ( // Exposing Status Metrics for tenant. func (r *Manager) syncTenantStatusMetrics(tenant *capsulev1beta2.Tenant) { - var cordoned float64 = 0 - // Expose namespace-tenant relationship for _, ns := range tenant.Status.Namespaces { r.Metrics.TenantNamespaceRelationshipGauge.WithLabelValues(tenant.GetName(), ns).Set(1) @@ -22,10 +20,6 @@ func (r *Manager) syncTenantStatusMetrics(tenant *capsulev1beta2.Tenant) { // Expose cordoned status r.Metrics.TenantNamespaceCounterGauge.WithLabelValues(tenant.Name).Set(float64(tenant.Status.Size)) - if tenant.Spec.Cordoned { - cordoned = 1 - } - // Expose Status Metrics for _, status := range []string{meta.ReadyCondition, meta.CordonedCondition} { var value float64 @@ -43,13 +37,6 @@ func (r *Manager) syncTenantStatusMetrics(tenant *capsulev1beta2.Tenant) { r.Metrics.TenantConditionGauge.WithLabelValues(tenant.GetName(), status).Set(value) } - - // Expose the namespace counter (Deprecated) - if tenant.Spec.Cordoned { - cordoned = 1 - } - - r.Metrics.TenantCordonedStatusGauge.WithLabelValues(tenant.Name).Set(cordoned) } // Exposing Status Metrics for tenant. diff --git a/pkg/metrics/tenant_recorder.go b/pkg/metrics/tenant_recorder.go index 4cf76ecf..0c34bf2c 100644 --- a/pkg/metrics/tenant_recorder.go +++ b/pkg/metrics/tenant_recorder.go @@ -12,7 +12,6 @@ type TenantRecorder struct { TenantNamespaceRelationshipGauge *prometheus.GaugeVec TenantNamespaceConditionGauge *prometheus.GaugeVec TenantConditionGauge *prometheus.GaugeVec - TenantCordonedStatusGauge *prometheus.GaugeVec TenantNamespaceCounterGauge *prometheus.GaugeVec TenantResourceUsageGauge *prometheus.GaugeVec TenantResourceLimitGauge *prometheus.GaugeVec @@ -32,14 +31,14 @@ func NewTenantRecorder() *TenantRecorder { Namespace: metricsPrefix, Name: "tenant_namespace_relationship", Help: "Mapping metric showing namespace to tenant relationships", - }, []string{"tenant", "namespace"}, + }, []string{"tenant", "target_namespace"}, ), TenantNamespaceConditionGauge: prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: metricsPrefix, Name: "tenant_namespace_condition", Help: "Provides per namespace within a tenant condition status for each condition", - }, []string{"tenant", "namespace", "condition"}, + }, []string{"tenant", "target_namespace", "condition"}, ), TenantConditionGauge: prometheus.NewGaugeVec( @@ -49,13 +48,6 @@ func NewTenantRecorder() *TenantRecorder { Help: "Provides per tenant condition status for each condition", }, []string{"tenant", "condition"}, ), - TenantCordonedStatusGauge: prometheus.NewGaugeVec( - prometheus.GaugeOpts{ - Namespace: metricsPrefix, - Name: "tenant_status", - Help: "DEPRECATED: Tenant cordon state indicating if tenant operations are restricted (1) or allowed (0) for resource creation and modification", - }, []string{"tenant"}, - ), TenantNamespaceCounterGauge: prometheus.NewGaugeVec( prometheus.GaugeOpts{ Namespace: metricsPrefix, @@ -85,7 +77,6 @@ func (r *TenantRecorder) Collectors() []prometheus.Collector { r.TenantNamespaceRelationshipGauge, r.TenantNamespaceConditionGauge, r.TenantConditionGauge, - r.TenantCordonedStatusGauge, r.TenantNamespaceCounterGauge, r.TenantResourceUsageGauge, r.TenantResourceLimitGauge, @@ -100,20 +91,20 @@ func (r *TenantRecorder) DeleteAllMetricsForNamespace(namespace string) { // DeleteCondition deletes the condition metrics for the ref. func (r *TenantRecorder) DeleteNamespaceRelationshipMetrics(namespace string) { r.TenantNamespaceRelationshipGauge.DeletePartialMatch(map[string]string{ - "namespace": namespace, + "target_namespace": namespace, }) } func (r *TenantRecorder) DeleteTenantNamespaceConditionMetrics(namespace string) { r.TenantNamespaceConditionGauge.DeletePartialMatch(map[string]string{ - "namespace": namespace, + "target_namespace": namespace, }) } func (r *TenantRecorder) DeleteTenantNamespaceConditionMetricByType(namespace string, condition string) { r.TenantNamespaceConditionGauge.DeletePartialMatch(map[string]string{ - "namespace": namespace, - "condition": condition, + "target_namespace": namespace, + "condition": condition, }) } @@ -152,9 +143,6 @@ func (r *TenantRecorder) DeleteTenantStatusMetrics(tenant string) { r.TenantNamespaceCounterGauge.DeletePartialMatch(map[string]string{ "tenant": tenant, }) - r.TenantCordonedStatusGauge.DeletePartialMatch(map[string]string{ - "tenant": tenant, - }) r.TenantNamespaceRelationshipGauge.DeletePartialMatch(map[string]string{ "tenant": tenant, })