From 6f85a2cfb5901a7e7bd2565d5a0e760ffe3d0c91 Mon Sep 17 00:00:00 2001 From: Gabriel Saratura Date: Fri, 25 Oct 2024 11:56:52 +0200 Subject: [PATCH] Remove legacy prom rule billing --- component/main.jsonnet | 24 ------ component/promql/appcat.promql | 67 --------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- ..._appcat_legacy_billing_recording_rule.yaml | 84 ------------------- 15 files changed, 1183 deletions(-) delete mode 100644 component/promql/appcat.promql delete mode 100644 tests/golden/apiserver/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/billing/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/cloudscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/controllers/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/defaults/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/exoscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/exoscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/minio/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/openshift/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml delete mode 100644 tests/golden/vshn/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml diff --git a/component/main.jsonnet b/component/main.jsonnet index 715650716..66428d7ec 100644 --- a/component/main.jsonnet +++ b/component/main.jsonnet @@ -109,29 +109,6 @@ local tenant = { [if !params.appuioManaged then 'label']: 'label_appuio_io_organization=~".+",', }; -local promQueryTemplate = importstr 'promql/appcat.promql'; -local promQueryWithLabel = std.strReplace(promQueryTemplate, '{{ORGLABEL}}', tenant.label); -local promQuery = std.strReplace(promQueryWithLabel, '{{TENANT_REPLACE}}', tenant.replace); - -local legacyBillingRule = std.prune(kube._Object('monitoring.coreos.com/v1', 'PrometheusRule', 'appcat-billing') { - metadata+: { - namespace: params.namespace, - }, - spec: { - groups: [ - { - name: 'appcat-billing-rules', - rules: [ - { - expr: promQuery, - record: 'appcat:billing', - }, - ], - }, - ], - }, -}); - local mockOrgInfo = kube._Object('monitoring.coreos.com/v1', 'PrometheusRule', 'mock-org-info') { metadata+: { namespace: params.namespace, @@ -260,7 +237,6 @@ local haPrometheusRule = { [if isOpenshift then '10_clusterrole_finalizer']: finalizerRole, '10_clusterrole_services_read': readServices, '10_appcat_namespace': ns, - '10_appcat_legacy_billing_recording_rule': legacyBillingRule, '10_appcat_backup_monitoring': backupPrometheusRule, '10_appcat_ha_monitoring': haPrometheusRule, [if params.services.vshn.enabled && params.services.emailAlerting.enabled then '10_mailgun_secret']: emailSecret, diff --git a/component/promql/appcat.promql b/component/promql/appcat.promql deleted file mode 100644 index 48270c2bf..000000000 --- a/component/promql/appcat.promql +++ /dev/null @@ -1,67 +0,0 @@ -sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( -# Sum values over one hour and get mean -sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{{{ORGLABEL}} label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - {{TENANT_REPLACE}} - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] -)/60 ) diff --git a/tests/golden/apiserver/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/apiserver/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/apiserver/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/billing/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/billing/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/billing/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/cloudscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/cloudscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index dd3f62ad8..000000000 --- a/tests/golden/cloudscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{label_appuio_io_organization=~".+", label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "$1", - "label_appuio_io_organization", - "(.*)" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/controllers/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/controllers/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/controllers/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/defaults/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/defaults/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/defaults/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/exoscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/exoscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index dd3f62ad8..000000000 --- a/tests/golden/exoscale/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{label_appuio_io_organization=~".+", label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "$1", - "label_appuio_io_organization", - "(.*)" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/minio/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/minio/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/minio/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/openshift/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/openshift/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index 9c91b8400..000000000 --- a/tests/golden/openshift/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "t-silent-test-1234", - "", - "" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing diff --git a/tests/golden/vshn/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml b/tests/golden/vshn/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml deleted file mode 100644 index dd3f62ad8..000000000 --- a/tests/golden/vshn/appcat/appcat/10_appcat_legacy_billing_recording_rule.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PrometheusRule -metadata: - labels: - name: appcat-billing - name: appcat-billing - namespace: syn-appcat -spec: - groups: - - name: appcat-billing-rules - rules: - - expr: | - sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( - # Sum values over one hour and get mean - sum_over_time( - # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture - label_join( - # Add label category: $provider:$claim_namespace - label_join( - # Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla - label_replace( - # Add label provider: vshn - label_replace( - # Add label product: postgres - label_replace( - # Default appcat.vshn.io/sla to besteffort if it is not set - label_replace( - # Copy label appcat.vshn.io/namespace to label claim_namespace - label_replace( - # Populate tenant_id - label_replace( - # Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" - kube_namespace_labels{label_appuio_io_organization=~".+", label_appuio_io_billing_name=~"appcat-.+"} * - on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) - (kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}), - "tenant_id", - "$1", - "label_appuio_io_organization", - "(.*)" - - ), - "claim_namespace", - "$1", - "label_appcat_vshn_io_claim_namespace", - "(.*)" - ), - "label_appcat_vshn_io_sla", - "besteffort", - "label_appcat_vshn_io_sla", - "^$" - ), - "product", - "appcat_$1", - "label_appuio_io_billing_name", - "appcat-(.+)" - ), - "provider", - "vshn", - "", - "" - ), - "sla", - "$1", - "label_appcat_vshn_io_sla", - "(.*)" - ), - "category", - ":", - "provider", - "claim_namespace" - ), - "product", - ":", - "product", - "provider", - "tenant_id", - "claim_namespace", - "sla" - # other billing queries have [59m:1m] here. This is due to some - # obscure discrepancies between how the cloud-reporting evaluates the query - # and how the GUI/recording rules evaluate the query. - )[60m:1m] - )/60 ) - record: appcat:billing