From f34352d2301906a116069bec1ba3075737020ff9 Mon Sep 17 00:00:00 2001 From: Gabriel Saratura Date: Mon, 25 Nov 2024 16:55:46 +0100 Subject: [PATCH] Add add on billing support --- class/defaults.yml | 2 +- component/billing.jsonnet | 41 +++ .../appcat/appcat/10_function_appcat.yaml | 2 +- .../appcat/21_composition_vshn_keycloak.yaml | 2 +- .../appcat/21_composition_vshn_mariadb.yaml | 2 +- .../appcat/21_composition_vshn_nextcloud.yaml | 2 +- .../appcat/21_composition_vshn_postgres.yaml | 2 +- .../appcat/21_composition_vshn_redis.yaml | 2 +- .../appcat/apiserver/30_deployment.yaml | 2 +- .../controllers/appcat/30_deployment.yaml | 2 +- .../appcat/sla_reporter/01_cronjob.yaml | 2 +- ...appcat-sliexporter-controller-manager.yaml | 2 +- .../appcat/appcat/10_function_appcat.yaml | 2 +- .../appcat/apiserver/30_deployment.yaml | 2 +- ...appcat-sliexporter-controller-manager.yaml | 2 +- .../dev/appcat/appcat/10_function_appcat.yaml | 2 +- .../appcat/21_composition_vshn_keycloak.yaml | 2 +- .../appcat/21_composition_vshn_mariadb.yaml | 2 +- .../appcat/21_composition_vshn_nextcloud.yaml | 2 +- .../appcat/21_composition_vshn_postgres.yaml | 2 +- .../appcat/21_composition_vshn_redis.yaml | 2 +- .../appcat/apiserver/30_deployment.yaml | 2 +- .../controllers/appcat/30_deployment.yaml | 2 +- .../appcat/sla_reporter/01_cronjob.yaml | 2 +- ...appcat-sliexporter-controller-manager.yaml | 2 +- .../controllers/appcat/30_deployment.yaml | 2 +- .../appcat/appcat/10_function_appcat.yaml | 2 +- .../appcat/21_composition_vshn_keycloak.yaml | 2 +- .../appcat/21_composition_vshn_mariadb.yaml | 2 +- .../appcat/21_composition_vshn_minio.yaml | 2 +- .../appcat/21_composition_vshn_nextcloud.yaml | 2 +- .../appcat/21_composition_vshn_postgres.yaml | 2 +- .../appcat/21_composition_vshn_redis.yaml | 2 +- .../appcat/apiserver/30_deployment.yaml | 2 +- .../appcat/billing/12_backfill_addons.yaml | 347 ++++++++++++++++++ .../controllers/appcat/30_deployment.yaml | 2 +- .../appcat/sla_reporter/01_cronjob.yaml | 2 +- ...appcat-sliexporter-controller-manager.yaml | 2 +- .../appcat/appcat/10_function_appcat.yaml | 2 +- .../appcat/21_composition_vshn_keycloak.yaml | 2 +- .../appcat/21_composition_vshn_mariadb.yaml | 2 +- .../appcat/21_composition_vshn_minio.yaml | 2 +- .../appcat/21_composition_vshn_nextcloud.yaml | 2 +- .../appcat/21_composition_vshn_postgres.yaml | 2 +- .../appcat/21_composition_vshn_redis.yaml | 2 +- .../appcat/apiserver/30_deployment.yaml | 2 +- .../appcat/billing/12_backfill_addons.yaml | 345 +++++++++++++++++ .../controllers/appcat/30_deployment.yaml | 2 +- .../appcat/sla_reporter/01_cronjob.yaml | 2 +- ...appcat-sliexporter-controller-manager.yaml | 2 +- 50 files changed, 780 insertions(+), 47 deletions(-) create mode 100644 tests/golden/vshn-cloud/appcat/appcat/billing/12_backfill_addons.yaml create mode 100644 tests/golden/vshn-managed/appcat/appcat/billing/12_backfill_addons.yaml diff --git a/class/defaults.yml b/class/defaults.yml index 78e26b544..6d0400cd6 100644 --- a/class/defaults.yml +++ b/class/defaults.yml @@ -55,7 +55,7 @@ parameters: appcat: registry: ghcr.io repository: vshn/appcat - tag: v4.109.0 + tag: collabora-billing functionAppcat: registry: ${appcat:images:appcat:registry} repository: ${appcat:images:appcat:repository} diff --git a/component/billing.jsonnet b/component/billing.jsonnet index 943df0b3b..b54b631c6 100644 --- a/component/billing.jsonnet +++ b/component/billing.jsonnet @@ -12,6 +12,8 @@ local paramsBilling = params.billing; local formatImage = function(ref) '%(registry)s/%(repository)s:%(tag)s' % ref; +local addOns = [ 'nextcloud-office' ]; + // escape any non-valid characters and replace them with - local escape = function(str) std.join('', @@ -153,6 +155,43 @@ local backfillCJ = function(name, query, sla, type) }, }; +local getManagedQuery = function(queryName) + 'sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name!="APPUiO"}[59m:1m])/60'; + +local getCloudQuery = function(queryName) + 'sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name="APPUiO"}[59m:1m])/60 * on(label_appuio_io_organization) group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, "label_appuio_io_organization", "$1", "organization", "(.*)")'; + +local getPermutations = function(cloudQuery, managedQuery) + [ + { + query: cloudQuery % 'besteffort', + sla: 'besteffort', + type: 'cloud', + }, + { + query: cloudQuery % 'guaranteed', + sla: 'guaranteed', + type: 'cloud', + }, + { + query: managedQuery % 'besteffort', + sla: 'besteffort', + type: 'managed', + }, + { + query: managedQuery % 'guaranteed', + sla: 'guaranteed', + type: 'managed', + }, + ]; + +local generateAddOnsCloudAndManaged = function(name) + local queryName = if name == 'postgres' then name + 'ql' else name; + local managedQuery = getManagedQuery(queryName); + local cloudQuery = getCloudQuery(queryName); + local permutations = getPermutations(cloudQuery, managedQuery); + std.flatMap(function(r) [ backfillCJ(name, r.query, r.sla, r.type) ], permutations); + local generateCloudAndManaged = function(name) // For postgresql we have a missmatch between the label and the name in our definition. @@ -188,11 +227,13 @@ local generateCloudAndManaged = function(name) local vshnServices = common.FilterServiceByBoolean('billing'); local billingCronjobs = std.flattenArrays(std.flatMap(function(r) [ generateCloudAndManaged(r.name) ], vshnServices)); +local billingAddOnsCronjobs = std.flattenArrays(std.flatMap(function(addOn) [ generateAddOnsCloudAndManaged(addOn) ], addOns)); if paramsBilling.vshn.enableCronjobs then { [if std.length(std.filter(function(name) paramsBilling.network_policies.target_namespaces[name] == true, std.objectFields(paramsBilling.network_policies.target_namespaces))) > 0 then 'billing/01_netpol']: netPol.Policies, 'billing/10_odoo_secret': odooSecret, 'billing/11_backfill': billingCronjobs, + 'billing/12_backfill_addons': billingAddOnsCronjobs, [if paramsBilling.monitoring.enabled then 'billing/50_alerts']: alerts.Alerts, } else {} diff --git a/tests/golden/control-plane/appcat/appcat/10_function_appcat.yaml b/tests/golden/control-plane/appcat/appcat/10_function_appcat.yaml index 655454f96..b8bac9bd2 100644 --- a/tests/golden/control-plane/appcat/appcat/10_function_appcat.yaml +++ b/tests/golden/control-plane/appcat/appcat/10_function_appcat.yaml @@ -6,6 +6,6 @@ metadata: argocd.argoproj.io/sync-wave: '-40' name: function-appcat spec: - package: ghcr.io/vshn/appcat:v4.109.0-func + package: ghcr.io/vshn/appcat:collabora-billing-func runtimeConfigRef: name: function-appcat diff --git a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_keycloak.yaml b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_keycloak.yaml index 53da9b51e..4be1fb2d3 100644 --- a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_keycloak.yaml +++ b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_keycloak.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | nginx.ingress.kubernetes.io/backend-protocol: HTTPS cert-manager.io/cluster-issuer: letsencrypt-staging diff --git a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_mariadb.yaml b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_mariadb.yaml index f046b1ea0..e8442bbd4 100644 --- a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_mariadb.yaml +++ b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_mariadb.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'false' maintenanceSA: helm-based-service-maintenance mode: standalone diff --git a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_nextcloud.yaml b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_nextcloud.yaml index dfca3982a..625e4946d 100644 --- a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_nextcloud.yaml +++ b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_nextcloud.yaml @@ -45,7 +45,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | cert-manager.io/cluster-issuer: letsencrypt-staging nginx.ingress.kubernetes.io/enable-cors: "true" diff --git a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_postgres.yaml b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_postgres.yaml index 06640f15f..62fec0962 100644 --- a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_postgres.yaml +++ b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_postgres.yaml @@ -41,7 +41,7 @@ spec: emailAlertingSmtpUsername: appcat@appuio.cloud externalDatabaseConnectionsEnabled: 'true' ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing initContainers: '{"clusterReconciliationCycle": {"limits": {"cpu": "300m", "memory": "200Mi"}, "requests": {"cpu": "100m", "memory": "100Mi"}}, "pgbouncerAuthFile": {"limits": {"cpu": "300m", "memory": "500Mi"}, "requests": {"cpu": "100m", diff --git a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_redis.yaml b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_redis.yaml index 940b653eb..c75195800 100644 --- a/tests/golden/control-plane/appcat/appcat/21_composition_vshn_redis.yaml +++ b/tests/golden/control-plane/appcat/appcat/21_composition_vshn_redis.yaml @@ -597,7 +597,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'false' maintenanceSA: helm-based-service-maintenance ownerGroup: vshn.appcat.vshn.io diff --git a/tests/golden/control-plane/appcat/appcat/apiserver/30_deployment.yaml b/tests/golden/control-plane/appcat/appcat/apiserver/30_deployment.yaml index d56058477..ec9541d96 100644 --- a/tests/golden/control-plane/appcat/appcat/apiserver/30_deployment.yaml +++ b/tests/golden/control-plane/appcat/appcat/apiserver/30_deployment.yaml @@ -29,7 +29,7 @@ spec: - --secure-port=9443 - --tls-cert-file=/apiserver.local.config/certificates/tls.crt - --tls-private-key-file=/apiserver.local.config/certificates/tls.key - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: failureThreshold: 3 httpGet: diff --git a/tests/golden/control-plane/appcat/appcat/controllers/appcat/30_deployment.yaml b/tests/golden/control-plane/appcat/appcat/controllers/appcat/30_deployment.yaml index a030a0930..1900f8d72 100644 --- a/tests/golden/control-plane/appcat/appcat/controllers/appcat/30_deployment.yaml +++ b/tests/golden/control-plane/appcat/appcat/controllers/appcat/30_deployment.yaml @@ -23,7 +23,7 @@ spec: env: - name: PLANS_NAMESPACE value: syn-appcat - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/control-plane/appcat/appcat/sla_reporter/01_cronjob.yaml b/tests/golden/control-plane/appcat/appcat/sla_reporter/01_cronjob.yaml index 05bad427e..a2097f5f5 100644 --- a/tests/golden/control-plane/appcat/appcat/sla_reporter/01_cronjob.yaml +++ b/tests/golden/control-plane/appcat/appcat/sla_reporter/01_cronjob.yaml @@ -30,7 +30,7 @@ spec: envFrom: - secretRef: name: appcat-sla-reports-creds - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing name: sla-reporter resources: limits: diff --git a/tests/golden/control-plane/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml b/tests/golden/control-plane/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml index fdb130218..10db89b3d 100644 --- a/tests/golden/control-plane/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml +++ b/tests/golden/control-plane/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml @@ -36,7 +36,7 @@ spec: value: 'true' - name: APPCAT_SLI_VSHNMARIADB value: 'true' - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/defaults/appcat/appcat/10_function_appcat.yaml b/tests/golden/defaults/appcat/appcat/10_function_appcat.yaml index 655454f96..b8bac9bd2 100644 --- a/tests/golden/defaults/appcat/appcat/10_function_appcat.yaml +++ b/tests/golden/defaults/appcat/appcat/10_function_appcat.yaml @@ -6,6 +6,6 @@ metadata: argocd.argoproj.io/sync-wave: '-40' name: function-appcat spec: - package: ghcr.io/vshn/appcat:v4.109.0-func + package: ghcr.io/vshn/appcat:collabora-billing-func runtimeConfigRef: name: function-appcat diff --git a/tests/golden/defaults/appcat/appcat/apiserver/30_deployment.yaml b/tests/golden/defaults/appcat/appcat/apiserver/30_deployment.yaml index d56058477..ec9541d96 100644 --- a/tests/golden/defaults/appcat/appcat/apiserver/30_deployment.yaml +++ b/tests/golden/defaults/appcat/appcat/apiserver/30_deployment.yaml @@ -29,7 +29,7 @@ spec: - --secure-port=9443 - --tls-cert-file=/apiserver.local.config/certificates/tls.crt - --tls-private-key-file=/apiserver.local.config/certificates/tls.key - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: failureThreshold: 3 httpGet: diff --git a/tests/golden/defaults/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml b/tests/golden/defaults/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml index 59e97fca3..dc82c7a85 100644 --- a/tests/golden/defaults/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml +++ b/tests/golden/defaults/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml @@ -36,7 +36,7 @@ spec: value: 'false' - name: APPCAT_SLI_VSHNMARIADB value: 'false' - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/dev/appcat/appcat/10_function_appcat.yaml b/tests/golden/dev/appcat/appcat/10_function_appcat.yaml index 655454f96..b8bac9bd2 100644 --- a/tests/golden/dev/appcat/appcat/10_function_appcat.yaml +++ b/tests/golden/dev/appcat/appcat/10_function_appcat.yaml @@ -6,6 +6,6 @@ metadata: argocd.argoproj.io/sync-wave: '-40' name: function-appcat spec: - package: ghcr.io/vshn/appcat:v4.109.0-func + package: ghcr.io/vshn/appcat:collabora-billing-func runtimeConfigRef: name: function-appcat diff --git a/tests/golden/dev/appcat/appcat/21_composition_vshn_keycloak.yaml b/tests/golden/dev/appcat/appcat/21_composition_vshn_keycloak.yaml index 30dd37628..3b85698a1 100644 --- a/tests/golden/dev/appcat/appcat/21_composition_vshn_keycloak.yaml +++ b/tests/golden/dev/appcat/appcat/21_composition_vshn_keycloak.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | nginx.ingress.kubernetes.io/backend-protocol: HTTPS cert-manager.io/cluster-issuer: letsencrypt-staging diff --git a/tests/golden/dev/appcat/appcat/21_composition_vshn_mariadb.yaml b/tests/golden/dev/appcat/appcat/21_composition_vshn_mariadb.yaml index dda2563d9..df1d1a0f0 100644 --- a/tests/golden/dev/appcat/appcat/21_composition_vshn_mariadb.yaml +++ b/tests/golden/dev/appcat/appcat/21_composition_vshn_mariadb.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'false' maintenanceSA: helm-based-service-maintenance mode: standalone diff --git a/tests/golden/dev/appcat/appcat/21_composition_vshn_nextcloud.yaml b/tests/golden/dev/appcat/appcat/21_composition_vshn_nextcloud.yaml index 417981e19..1568837da 100644 --- a/tests/golden/dev/appcat/appcat/21_composition_vshn_nextcloud.yaml +++ b/tests/golden/dev/appcat/appcat/21_composition_vshn_nextcloud.yaml @@ -45,7 +45,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | cert-manager.io/cluster-issuer: letsencrypt-staging isOpenshift: 'false' diff --git a/tests/golden/dev/appcat/appcat/21_composition_vshn_postgres.yaml b/tests/golden/dev/appcat/appcat/21_composition_vshn_postgres.yaml index 76baea027..58cbe1abe 100644 --- a/tests/golden/dev/appcat/appcat/21_composition_vshn_postgres.yaml +++ b/tests/golden/dev/appcat/appcat/21_composition_vshn_postgres.yaml @@ -41,7 +41,7 @@ spec: emailAlertingSmtpUsername: appcat@appuio.cloud externalDatabaseConnectionsEnabled: 'true' ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing initContainers: '{"clusterReconciliationCycle": {"limits": {"cpu": "300m", "memory": "200Mi"}, "requests": {"cpu": "100m", "memory": "100Mi"}}, "pgbouncerAuthFile": {"limits": {"cpu": "300m", "memory": "500Mi"}, "requests": {"cpu": "100m", diff --git a/tests/golden/dev/appcat/appcat/21_composition_vshn_redis.yaml b/tests/golden/dev/appcat/appcat/21_composition_vshn_redis.yaml index 9e5c01b18..0bff1c021 100644 --- a/tests/golden/dev/appcat/appcat/21_composition_vshn_redis.yaml +++ b/tests/golden/dev/appcat/appcat/21_composition_vshn_redis.yaml @@ -597,7 +597,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'false' maintenanceSA: helm-based-service-maintenance ownerGroup: vshn.appcat.vshn.io diff --git a/tests/golden/dev/appcat/appcat/apiserver/30_deployment.yaml b/tests/golden/dev/appcat/appcat/apiserver/30_deployment.yaml index d56058477..ec9541d96 100644 --- a/tests/golden/dev/appcat/appcat/apiserver/30_deployment.yaml +++ b/tests/golden/dev/appcat/appcat/apiserver/30_deployment.yaml @@ -29,7 +29,7 @@ spec: - --secure-port=9443 - --tls-cert-file=/apiserver.local.config/certificates/tls.crt - --tls-private-key-file=/apiserver.local.config/certificates/tls.key - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: failureThreshold: 3 httpGet: diff --git a/tests/golden/dev/appcat/appcat/controllers/appcat/30_deployment.yaml b/tests/golden/dev/appcat/appcat/controllers/appcat/30_deployment.yaml index a030a0930..1900f8d72 100644 --- a/tests/golden/dev/appcat/appcat/controllers/appcat/30_deployment.yaml +++ b/tests/golden/dev/appcat/appcat/controllers/appcat/30_deployment.yaml @@ -23,7 +23,7 @@ spec: env: - name: PLANS_NAMESPACE value: syn-appcat - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/dev/appcat/appcat/sla_reporter/01_cronjob.yaml b/tests/golden/dev/appcat/appcat/sla_reporter/01_cronjob.yaml index 05bad427e..a2097f5f5 100644 --- a/tests/golden/dev/appcat/appcat/sla_reporter/01_cronjob.yaml +++ b/tests/golden/dev/appcat/appcat/sla_reporter/01_cronjob.yaml @@ -30,7 +30,7 @@ spec: envFrom: - secretRef: name: appcat-sla-reports-creds - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing name: sla-reporter resources: limits: diff --git a/tests/golden/dev/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml b/tests/golden/dev/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml index 1f74b4740..4b6c829c2 100644 --- a/tests/golden/dev/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml +++ b/tests/golden/dev/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml @@ -36,7 +36,7 @@ spec: value: 'true' - name: APPCAT_SLI_VSHNMARIADB value: 'true' - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/service-cluster/appcat/appcat/controllers/appcat/30_deployment.yaml b/tests/golden/service-cluster/appcat/appcat/controllers/appcat/30_deployment.yaml index 3c7fd02a8..7b2653511 100644 --- a/tests/golden/service-cluster/appcat/appcat/controllers/appcat/30_deployment.yaml +++ b/tests/golden/service-cluster/appcat/appcat/controllers/appcat/30_deployment.yaml @@ -31,7 +31,7 @@ spec: name: vcluster-kubeconfig - name: PLANS_NAMESPACE value: syn-appcat - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/vshn-cloud/appcat/appcat/10_function_appcat.yaml b/tests/golden/vshn-cloud/appcat/appcat/10_function_appcat.yaml index 655454f96..b8bac9bd2 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/10_function_appcat.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/10_function_appcat.yaml @@ -6,6 +6,6 @@ metadata: argocd.argoproj.io/sync-wave: '-40' name: function-appcat spec: - package: ghcr.io/vshn/appcat:v4.109.0-func + package: ghcr.io/vshn/appcat:collabora-billing-func runtimeConfigRef: name: function-appcat diff --git a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_keycloak.yaml b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_keycloak.yaml index e38d6a021..2c8c242b8 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_keycloak.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_keycloak.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | nginx.ingress.kubernetes.io/backend-protocol: HTTPS cert-manager.io/cluster-issuer: letsencrypt-staging diff --git a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_mariadb.yaml b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_mariadb.yaml index 229c17a33..6753188f5 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_mariadb.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_mariadb.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'true' maintenanceSA: helm-based-service-maintenance mode: standalone diff --git a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_minio.yaml b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_minio.yaml index 3f349f595..a03b145d2 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_minio.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_minio.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'true' maintenanceSA: helm-based-service-maintenance minioChartRepository: https://charts.min.io diff --git a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_nextcloud.yaml b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_nextcloud.yaml index 65f7bc166..be5635ef9 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_nextcloud.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_nextcloud.yaml @@ -45,7 +45,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | cert-manager.io/cluster-issuer: letsencrypt-staging isOpenshift: 'true' diff --git a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_postgres.yaml b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_postgres.yaml index c4e14b109..a9a96aeac 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_postgres.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_postgres.yaml @@ -41,7 +41,7 @@ spec: emailAlertingSmtpUsername: appcat@appuio.cloud externalDatabaseConnectionsEnabled: 'true' ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing initContainers: '{"clusterReconciliationCycle": {"limits": {"cpu": "300m", "memory": "200Mi"}, "requests": {"cpu": "100m", "memory": "100Mi"}}, "pgbouncerAuthFile": {"limits": {"cpu": "300m", "memory": "500Mi"}, "requests": {"cpu": "100m", diff --git a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_redis.yaml b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_redis.yaml index 1478c7e7a..5995ade2b 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_redis.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/21_composition_vshn_redis.yaml @@ -597,7 +597,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'true' maintenanceSA: helm-based-service-maintenance ownerGroup: vshn.appcat.vshn.io diff --git a/tests/golden/vshn-cloud/appcat/appcat/apiserver/30_deployment.yaml b/tests/golden/vshn-cloud/appcat/appcat/apiserver/30_deployment.yaml index 9b624a68a..6165013b9 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/apiserver/30_deployment.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/apiserver/30_deployment.yaml @@ -29,7 +29,7 @@ spec: - --secure-port=9443 - --tls-cert-file=/apiserver.local.config/certificates/tls.crt - --tls-private-key-file=/apiserver.local.config/certificates/tls.key - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: failureThreshold: 3 httpGet: diff --git a/tests/golden/vshn-cloud/appcat/appcat/billing/12_backfill_addons.yaml b/tests/golden/vshn-cloud/appcat/appcat/billing/12_backfill_addons.yaml new file mode 100644 index 000000000..032cb5b3e --- /dev/null +++ b/tests/golden/vshn-cloud/appcat/appcat/billing/12_backfill_addons.yaml @@ -0,0 +1,347 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-besteffort-cloud + name: appcat-vshn-nextcloud-office-besteffort-cloud + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-besteffort-cloud + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-cloud-metering-c-appuio-cloudscale-lpg-2|appuio-cloud-metering-c-appuio-exoscale-ch-gva-2-0 + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-besteffort + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="besteffort", + tenant_name="APPUiO"}[59m:1m])/60 * on(label_appuio_io_organization) + group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, + "label_appuio_io_organization", "$1", "organization", "(.*)") + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Cloud - Zone: + Kind - Local Test 0 / Namespace: %(label_appcat_vshn_io_claim_namespace)s" + % labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-guaranteed-cloud + name: appcat-vshn-nextcloud-office-guaranteed-cloud + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-guaranteed-cloud + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-cloud-metering-c-appuio-cloudscale-lpg-2|appuio-cloud-metering-c-appuio-exoscale-ch-gva-2-0 + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-guaranteed + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="guaranteed", + tenant_name="APPUiO"}[59m:1m])/60 * on(label_appuio_io_organization) + group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, + "label_appuio_io_organization", "$1", "organization", "(.*)") + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Cloud - Zone: + Kind - Local Test 0 / Namespace: %(label_appcat_vshn_io_claim_namespace)s" + % labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-besteffort-managed + name: appcat-vshn-nextcloud-office-besteffort-managed + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-besteffort-managed + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-managed-openshift-billing + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-besteffort + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="besteffort", + tenant_name!="APPUiO"}[59m:1m])/60 + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Managed - Cluster: + kind / Namespace: %(label_appcat_vshn_io_claim_namespace)s" % + labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-guaranteed-managed + name: appcat-vshn-nextcloud-office-guaranteed-managed + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-guaranteed-managed + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-managed-openshift-billing + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-guaranteed + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="guaranteed", + tenant_name!="APPUiO"}[59m:1m])/60 + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Managed - Cluster: + kind / Namespace: %(label_appcat_vshn_io_claim_namespace)s" % + labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 diff --git a/tests/golden/vshn-cloud/appcat/appcat/controllers/appcat/30_deployment.yaml b/tests/golden/vshn-cloud/appcat/appcat/controllers/appcat/30_deployment.yaml index a030a0930..1900f8d72 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/controllers/appcat/30_deployment.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/controllers/appcat/30_deployment.yaml @@ -23,7 +23,7 @@ spec: env: - name: PLANS_NAMESPACE value: syn-appcat - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/vshn-cloud/appcat/appcat/sla_reporter/01_cronjob.yaml b/tests/golden/vshn-cloud/appcat/appcat/sla_reporter/01_cronjob.yaml index 05bad427e..a2097f5f5 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/sla_reporter/01_cronjob.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/sla_reporter/01_cronjob.yaml @@ -30,7 +30,7 @@ spec: envFrom: - secretRef: name: appcat-sla-reports-creds - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing name: sla-reporter resources: limits: diff --git a/tests/golden/vshn-cloud/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml b/tests/golden/vshn-cloud/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml index 5bc2736fb..10eb82d4d 100644 --- a/tests/golden/vshn-cloud/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml +++ b/tests/golden/vshn-cloud/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml @@ -36,7 +36,7 @@ spec: value: 'true' - name: APPCAT_SLI_VSHNMARIADB value: 'true' - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/vshn-managed/appcat/appcat/10_function_appcat.yaml b/tests/golden/vshn-managed/appcat/appcat/10_function_appcat.yaml index 655454f96..b8bac9bd2 100644 --- a/tests/golden/vshn-managed/appcat/appcat/10_function_appcat.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/10_function_appcat.yaml @@ -6,6 +6,6 @@ metadata: argocd.argoproj.io/sync-wave: '-40' name: function-appcat spec: - package: ghcr.io/vshn/appcat:v4.109.0-func + package: ghcr.io/vshn/appcat:collabora-billing-func runtimeConfigRef: name: function-appcat diff --git a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_keycloak.yaml b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_keycloak.yaml index 544d13d9a..acb210727 100644 --- a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_keycloak.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_keycloak.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | nginx.ingress.kubernetes.io/backend-protocol: HTTPS cert-manager.io/cluster-issuer: letsencrypt-staging diff --git a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_mariadb.yaml b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_mariadb.yaml index 63c9d45a0..668ba656d 100644 --- a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_mariadb.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_mariadb.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'true' maintenanceSA: helm-based-service-maintenance mode: standalone diff --git a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_minio.yaml b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_minio.yaml index c6f971ec3..963d84173 100644 --- a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_minio.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_minio.yaml @@ -40,7 +40,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'true' maintenanceSA: helm-based-service-maintenance minioChartRepository: https://charts.min.io diff --git a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_nextcloud.yaml b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_nextcloud.yaml index 00bab62e2..be6a10172 100644 --- a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_nextcloud.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_nextcloud.yaml @@ -45,7 +45,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing ingress_annotations: | cert-manager.io/cluster-issuer: letsencrypt-staging isOpenshift: 'true' diff --git a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_postgres.yaml b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_postgres.yaml index fc6dd5bcc..b3822a9ed 100644 --- a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_postgres.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_postgres.yaml @@ -41,7 +41,7 @@ spec: emailAlertingSmtpUsername: appcat@appuio.cloud externalDatabaseConnectionsEnabled: 'true' ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing initContainers: '{"clusterReconciliationCycle": {"limits": {"cpu": "300m", "memory": "200Mi"}, "requests": {"cpu": "100m", "memory": "100Mi"}}, "pgbouncerAuthFile": {"limits": {"cpu": "300m", "memory": "500Mi"}, "requests": {"cpu": "100m", diff --git a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_redis.yaml b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_redis.yaml index f3c378357..786a9f0c3 100644 --- a/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_redis.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/21_composition_vshn_redis.yaml @@ -597,7 +597,7 @@ spec: emailAlertingSmtpHost: smtp.eu.mailgun.org:465 emailAlertingSmtpUsername: appcat@appuio.cloud ignoreNamespaceForBilling: vshn-test - imageTag: v4.109.0 + imageTag: collabora-billing isOpenshift: 'true' maintenanceSA: helm-based-service-maintenance ownerGroup: vshn.appcat.vshn.io diff --git a/tests/golden/vshn-managed/appcat/appcat/apiserver/30_deployment.yaml b/tests/golden/vshn-managed/appcat/appcat/apiserver/30_deployment.yaml index 9b624a68a..6165013b9 100644 --- a/tests/golden/vshn-managed/appcat/appcat/apiserver/30_deployment.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/apiserver/30_deployment.yaml @@ -29,7 +29,7 @@ spec: - --secure-port=9443 - --tls-cert-file=/apiserver.local.config/certificates/tls.crt - --tls-private-key-file=/apiserver.local.config/certificates/tls.key - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: failureThreshold: 3 httpGet: diff --git a/tests/golden/vshn-managed/appcat/appcat/billing/12_backfill_addons.yaml b/tests/golden/vshn-managed/appcat/appcat/billing/12_backfill_addons.yaml new file mode 100644 index 000000000..639353ec4 --- /dev/null +++ b/tests/golden/vshn-managed/appcat/appcat/billing/12_backfill_addons.yaml @@ -0,0 +1,345 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-besteffort-cloud + name: appcat-vshn-nextcloud-office-besteffort-cloud + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-besteffort-cloud + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-cloud-metering-c-appuio-cloudscale-lpg-2|appuio-cloud-metering-c-appuio-exoscale-ch-gva-2-0 + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-besteffort + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="besteffort", + tenant_name="APPUiO"}[59m:1m])/60 * on(label_appuio_io_organization) + group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, + "label_appuio_io_organization", "$1", "organization", "(.*)") + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Cloud - Zone: / + Namespace: %(label_appcat_vshn_io_claim_namespace)s" % labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-guaranteed-cloud + name: appcat-vshn-nextcloud-office-guaranteed-cloud + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-guaranteed-cloud + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-cloud-metering-c-appuio-cloudscale-lpg-2|appuio-cloud-metering-c-appuio-exoscale-ch-gva-2-0 + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-guaranteed + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="guaranteed", + tenant_name="APPUiO"}[59m:1m])/60 * on(label_appuio_io_organization) + group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, + "label_appuio_io_organization", "$1", "organization", "(.*)") + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Cloud - Zone: / + Namespace: %(label_appcat_vshn_io_claim_namespace)s" % labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-besteffort-managed + name: appcat-vshn-nextcloud-office-besteffort-managed + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-besteffort + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-besteffort-managed + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-managed-openshift-billing + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-besteffort + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="besteffort", + tenant_name!="APPUiO"}[59m:1m])/60 + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Managed - Cluster: + kind / Namespace: %(label_appcat_vshn_io_claim_namespace)s" % + labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + name: appcat-vshn-nextcloud-office-guaranteed-managed + name: appcat-vshn-nextcloud-office-guaranteed-managed + namespace: syn-appcat +spec: + failedJobsHistoryLimit: 3 + jobTemplate: + metadata: + annotations: + product-id: appcat-vshn-nextcloud-office-guaranteed + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + cron-job-name: appcat-vshn-nextcloud-office-guaranteed-managed + spec: + template: + metadata: + labels: + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: appuio-reporting + app.kubernetes.io/part-of: syn + spec: + containers: + - args: + - appuio-reporting report --timerange 1h --begin=$(date -d "now -3 + hours" -u +"%Y-%m-%dT%H:00:00Z") --repeat-until=$(date -u +"%Y-%m-%dT%H:00:00Z") + command: + - sh + - -c + env: + - name: AR_ODOO_OAUTH_TOKEN_URL + valueFrom: + secretKeyRef: + key: token_endpoint + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_ID + valueFrom: + secretKeyRef: + key: client_id + name: odoo-credentials + - name: AR_ODOO_OAUTH_CLIENT_SECRET + valueFrom: + secretKeyRef: + key: client_secret + name: odoo-credentials + - name: AR_ODOO_URL + value: https://test.central.vshn.ch/api/v2/product_usage_report_POST + - name: AR_PROM_URL + value: http://prometheus-operated.prometheus-system:9090/prometheus + - name: AR_ORG_ID + value: appuio-managed-openshift-billing + - name: AR_PRODUCT_ID + value: appcat-vshn-nextcloud-office-guaranteed + - name: AR_QUERY + value: sum_over_time(appcat:metering{label_appuio_io_billing_name="appcat-nextcloud-office",label_appcat_vshn_io_sla="guaranteed", + tenant_name!="APPUiO"}[59m:1m])/60 + - name: AR_INSTANCE_JSONNET + value: local labels = std.extVar("labels"); "%(cluster_id)s/%(label_appcat_vshn_io_claim_namespace)s/%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_ITEM_GROUP_DESCRIPTION_JSONNET + value: 'local labels = std.extVar("labels"); "APPUiO Managed - Cluster: + kind / Namespace: %(label_appcat_vshn_io_claim_namespace)s" % + labels' + - name: AR_ITEM_DESCRIPTION_JSONNET + value: local labels = std.extVar("labels"); "%(label_appcat_vshn_io_claim_name)s" + % labels + - name: AR_UNIT_ID + value: uom_uom_45_1e112771 + image: ghcr.io/appuio/appuio-reporting:v0.2.1 + name: backfill + resources: {} + initContainers: [] + restartPolicy: OnFailure + schedule: 30 * * * * + startingDeadlineSeconds: 180 + successfulJobsHistoryLimit: 0 diff --git a/tests/golden/vshn-managed/appcat/appcat/controllers/appcat/30_deployment.yaml b/tests/golden/vshn-managed/appcat/appcat/controllers/appcat/30_deployment.yaml index a030a0930..1900f8d72 100644 --- a/tests/golden/vshn-managed/appcat/appcat/controllers/appcat/30_deployment.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/controllers/appcat/30_deployment.yaml @@ -23,7 +23,7 @@ spec: env: - name: PLANS_NAMESPACE value: syn-appcat - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz diff --git a/tests/golden/vshn-managed/appcat/appcat/sla_reporter/01_cronjob.yaml b/tests/golden/vshn-managed/appcat/appcat/sla_reporter/01_cronjob.yaml index 05bad427e..a2097f5f5 100644 --- a/tests/golden/vshn-managed/appcat/appcat/sla_reporter/01_cronjob.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/sla_reporter/01_cronjob.yaml @@ -30,7 +30,7 @@ spec: envFrom: - secretRef: name: appcat-sla-reports-creds - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing name: sla-reporter resources: limits: diff --git a/tests/golden/vshn-managed/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml b/tests/golden/vshn-managed/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml index 5bc2736fb..10eb82d4d 100644 --- a/tests/golden/vshn-managed/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml +++ b/tests/golden/vshn-managed/appcat/appcat/sli_exporter/apps_v1_deployment_appcat-sliexporter-controller-manager.yaml @@ -36,7 +36,7 @@ spec: value: 'true' - name: APPCAT_SLI_VSHNMARIADB value: 'true' - image: ghcr.io/vshn/appcat:v4.109.0 + image: ghcr.io/vshn/appcat:collabora-billing livenessProbe: httpGet: path: /healthz