Skip to content

Commit

Permalink
Update component
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Saratura committed Dec 5, 2023
1 parent 4fb4f61 commit 1898198
Show file tree
Hide file tree
Showing 53 changed files with 236 additions and 269 deletions.
2 changes: 1 addition & 1 deletion component/Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ COMPONENT_SUBDIR ?= $(shell basename ${PWD})
compiled_path ?= compiled/$(COMPONENT_NAME)/$(COMPONENT_NAME)
root_volume ?= -v "$${PWD}/../:/$(COMPONENT_NAME)"
compiled_volume ?= -v "$${PWD}/$(compiled_path):/$(COMPONENT_NAME)"
commodore_args ?= --search-paths . -n $(COMPONENT_NAME) --alias $(instance)
commodore_args ?= --search-paths . -n $(COMPONENT_NAME)

ifneq "$(shell which docker 2>/dev/null)" ""
DOCKER_CMD ?= $(shell which docker)
Expand Down
2 changes: 1 addition & 1 deletion component/class/billing-collector-cloudservices.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ parameters:
- ${_base_directory}/component/main.jsonnet
input_type: jsonnet
output_type: yaml
output_path: ${_instance}
output_path: billing-collector-cloudservices/
20 changes: 10 additions & 10 deletions component/class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ parameters:
exoscale:
credentials:
stringData:
EXOSCALE_API_KEY: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/${_instance}/exoscale-key}"
EXOSCALE_API_SECRET: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/${_instance}/exoscale-secret}"
EXOSCALE_API_KEY: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/exoscale-key}"
EXOSCALE_API_SECRET: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/exoscale-secret}"
KUBERNETES_SERVER_URL: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/cluster-server}"
KUBERNETES_SERVER_TOKEN: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/cluster-token}"
cloudscale:
credentials:
stringData:
CLOUDSCALE_API_TOKEN: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/${_instance}/token}"
CLOUDSCALE_API_TOKEN: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/cloudscale-token}"
KUBERNETES_SERVER_URL: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/cluster-server}"
KUBERNETES_SERVER_TOKEN: "?{vaultkv:${cluster:tenant}/${cluster:name}/billing-collector-cloudservices/cluster-token}"
images:
collector:
registry: 'ghcr.io'
repository: 'vshn/billing-collector-cloudservices'
tag: change_exporter
tag: new-billing-cloud

appuioManaged:
enabled: false
tenant: ${cluster:tenant}
salesOrder: ""

appuioCloud:
enabled: true
promUrl: localhost:9090
salesOrder: "" #Update once the fact is available in Leutenant

promUrl: localhost:9090
clusterId: ${cluster:name}

odoo:
Expand Down
4 changes: 2 additions & 2 deletions component/component/app.jsonnet
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
local kap = import 'lib/kapitan.libjsonnet';
local inv = kap.inventory();
local argocd = import 'lib/argocd.libjsonnet';
local instance = inv.parameters._instance;
local params = inv.parameters.billing_collector_cloudservices;
local argocd = import 'lib/argocd.libjsonnet';

local instance = 'billing-collector-cloudservices';
local app = argocd.App(instance, params.namespace);

{
Expand Down
6 changes: 4 additions & 2 deletions component/component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local kube = import 'lib/kube.libjsonnet';
local com = import 'lib/commodore.libjsonnet';
local collectorImage = '%(registry)s/%(repository)s:%(tag)s' % params.images.collector;
local component_name = 'billing-collector-cloudservices';
local appuioManaged = params.appuioManaged.enabled;

local labels = {
'app.kubernetes.io/name': component_name,
Expand Down Expand Up @@ -161,12 +162,13 @@ local config(name, extraConfig) = kube.ConfigMap(name) {
ODOO_URL: std.toString(params.odoo.url),
ODOO_OAUTH_TOKEN_URL: std.toString(params.odoo.tokenUrl),
CLUSTER_ID: std.toString(params.clusterId),
APPUIO_MANAGED_SALES_ORDER: if params.appuioManaged.enabled then std.toString(params.appuioManaged.salesOrder) else '',
PROM_URL: if params.appuioCloud.enabled then std.toString(params.appuioCloud.promUrl) else '',
APPUIO_MANAGED_SALES_ORDER: if appuioManaged then std.toString(params.appuioManaged.salesOrder) else '',
PROM_URL: if !appuioManaged then std.toString(params.promUrl) else '',
},
} + extraConfig;

({

local odoo = params.secrets.odoo,
assert odoo.credentials != null : 'odoo.credentials must be set.',
assert odoo.credentials.stringData != null : 'odoo.credentials.stringData must be set.',
Expand Down
9 changes: 3 additions & 6 deletions component/tests/cloudscale-metrics-collector-cloud.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
applications:
- appuio-cloud-reporting

parameters:
billing_collector_cloudservices:
appuioCloud:
enabled: true
promUrl: localhost:9090
appuioManaged:
enabled: false
promUrl: localhost:9090
cloudscale:
enabled: true
4 changes: 0 additions & 4 deletions component/tests/cloudscale-metrics-collector-managed.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
applications:
- appuio-cloud-reporting

parameters:
billing_collector_cloudservices:
appuioManaged:
enabled: true
tenant: ${cluster:name}
salesOrder: "12345"
cloudscale:
enabled: true
6 changes: 3 additions & 3 deletions component/tests/exoscale-metrics-collector-cloud.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
parameters:
billing_collector_cloudservices:
appuioCloud:
enabled: true
promUrl: localhost:9090
appuioManaged:
enabled: false
promUrl: localhost:9090
exoscale:
enabled: true
dbaas:
Expand Down
2 changes: 1 addition & 1 deletion component/tests/exoscale-metrics-collector-managed.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
parameters:
billing_collector_cloudservices:
namespace: appuio-cloud-reporting
appuioManaged:
enabled: true
tenant: ${cluster:name}
salesOrder: "12345"
exoscale:
enabled: true
Expand Down
9 changes: 1 addition & 8 deletions component/tests/fromenv.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
applications:
- metrics-collector as cloudscale
- metrics-collector as exoscale
parameters:
billing_collector_cloudservices:

appuioManaged:
enabled: true
tenant: ${cluster:name}
salesOrder: "12345"

appuioCloud:
enabled: false
promUrl: localhost:9090
promUrl: localhost:9090

clusterId: ${cluster:name}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ data:
BILLING_HOUR: '6'
CLUSTER_ID: c-green-test-1234
COLLECT_INTERVAL: '23'
DAYS: '1'
ODOO_OAUTH_TOKEN_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
ODOO_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
PROM_URL: localhost:9090
TENANT_ID: ''
kind: ConfigMap
metadata:
name: cloudscale-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale
name: cloudscale
namespace: appuio-cloud-reporting
Expand All @@ -19,7 +18,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale
strategy:
rollingUpdate:
Expand All @@ -33,7 +31,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale
spec:
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ metadata:
name: credentials-cloudscale
namespace: appuio-cloud-reporting
stringData:
CLOUDSCALE_API_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-metrics-collector-managed/token
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-metrics-collector-managed/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-metrics-collector-managed/odoo-oauth-client-secret
CLOUDSCALE_API_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-token
KUBERNETES_SERVER_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-token
KUBERNETES_SERVER_URL: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-server
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-secret
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ data:
BILLING_HOUR: '6'
CLUSTER_ID: c-green-test-1234
COLLECT_INTERVAL: '23'
DAYS: '1'
ODOO_OAUTH_TOKEN_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
ODOO_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
PROM_URL: localhost:9090
TENANT_ID: c-green-test-1234
PROM_URL: ''
kind: ConfigMap
metadata:
name: cloudscale-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale
name: cloudscale
namespace: appuio-cloud-reporting
Expand All @@ -19,7 +18,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale
strategy:
rollingUpdate:
Expand All @@ -33,7 +31,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale
spec:
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ metadata:
name: credentials-cloudscale
namespace: appuio-cloud-reporting
stringData:
CLOUDSCALE_API_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-metrics-collector-cloud/token
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-metrics-collector-cloud/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-metrics-collector-cloud/odoo-oauth-client-secret
CLOUDSCALE_API_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cloudscale-token
KUBERNETES_SERVER_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-token
KUBERNETES_SERVER_URL: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-server
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-secret
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ data:
ODOO_OAUTH_TOKEN_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
ODOO_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
PROM_URL: localhost:9090
TENANT_ID: ''
kind: ConfigMap
metadata:
name: exoscale-dbaas-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-dbaas
name: exoscale-dbaas
namespace: appuio-cloud-reporting
Expand All @@ -19,7 +18,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-dbaas
strategy:
rollingUpdate:
Expand All @@ -33,7 +31,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-dbaas
spec:
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ metadata:
name: credentials-exoscale-dbaas
namespace: appuio-cloud-reporting
stringData:
EXOSCALE_API_KEY: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/exoscale-key
EXOSCALE_API_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/exoscale-secret
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/odoo-oauth-client-secret
EXOSCALE_API_KEY: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-key
EXOSCALE_API_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-secret
KUBERNETES_SERVER_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-token
KUBERNETES_SERVER_URL: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-server
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-secret
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ data:
ODOO_OAUTH_TOKEN_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
ODOO_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
PROM_URL: localhost:9090
TENANT_ID: ''
kind: ConfigMap
metadata:
name: exoscale-objectstorage-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-objectstorage
name: exoscale-objectstorage
namespace: appuio-cloud-reporting
Expand All @@ -19,7 +18,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-objectstorage
strategy:
rollingUpdate:
Expand All @@ -33,7 +31,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-objectstorage
spec:
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ metadata:
name: credentials-exoscale-objectstorage
namespace: appuio-cloud-reporting
stringData:
EXOSCALE_API_KEY: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/exoscale-key
EXOSCALE_API_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/exoscale-secret
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-managed/odoo-oauth-client-secret
EXOSCALE_API_KEY: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-key
EXOSCALE_API_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-secret
KUBERNETES_SERVER_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-token
KUBERNETES_SERVER_URL: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-server
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-secret
type: Opaque
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ data:
COLLECT_INTERVAL: '1'
ODOO_OAUTH_TOKEN_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
ODOO_URL: https://test.central.vshn.ch/api/v2/authentication/oauth2/token
PROM_URL: localhost:9090
TENANT_ID: c-green-test-1234
PROM_URL: ''
kind: ConfigMap
metadata:
name: exoscale-dbaas-env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ metadata:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-dbaas
name: exoscale-dbaas
namespace: appuio-cloud-reporting
Expand All @@ -19,7 +18,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-dbaas
strategy:
rollingUpdate:
Expand All @@ -33,7 +31,6 @@ spec:
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-dbaas
spec:
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ metadata:
name: credentials-exoscale-dbaas
namespace: appuio-cloud-reporting
stringData:
EXOSCALE_API_KEY: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-cloud/exoscale-key
EXOSCALE_API_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-cloud/exoscale-secret
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-cloud/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-metrics-collector-cloud/odoo-oauth-client-secret
EXOSCALE_API_KEY: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-key
EXOSCALE_API_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/exoscale-secret
KUBERNETES_SERVER_TOKEN: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-token
KUBERNETES_SERVER_URL: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/cluster-server
ODOO_OAUTH_CLIENT_ID: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-id
ODOO_OAUTH_CLIENT_SECRET: t-silent-test-1234/c-green-test-1234/billing-collector-cloudservices/odoo-oauth-client-secret
type: Opaque
Loading

0 comments on commit 1898198

Please sign in to comment.