Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
renamed to billing-collector-cloudservices
  • Loading branch information
mweibel committed Jan 19, 2023
1 parent accbad1 commit fe8faf9
Show file tree
Hide file tree
Showing 35 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/.github/release-notes.md

# Build
/metrics-collector
/billing-collector-cloudservices
*.out
/component/compiled
/component/vendor
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN \
ca-certificates \
tzdata

ENTRYPOINT ["metrics-collector"]
COPY metrics-collector /usr/bin/
ENTRYPOINT ["billing-collector-cloudservices"]
COPY billing-collector-cloudservices /usr/bin/

USER 65536:0
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## These are some common variables for Make

PROJECT_ROOT_DIR = .
PROJECT_NAME ?= metrics-collector
PROJECT_NAME ?= billing-collector-cloudservices
PROJECT_OWNER ?= vshn

## BUILD:go
Expand Down
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# exoscale-metrics-collector
# billing-collector-cloudservices

[![Build](https://img.shields.io/github/workflow/status/vshn/exoscale-metrics-collector/Test)][build]
![Go version](https://img.shields.io/github/go-mod/go-version/vshn/exoscale-metrics-collector)
[![Version](https://img.shields.io/github/v/release/vshn/exoscale-metrics-collector)][releases]
[![GitHub downloads](https://img.shields.io/github/downloads/vshn/exoscale-metrics-collector/total)][releases]
[![Build](https://img.shields.io/github/workflow/status/vshn/billing-collector-cloudservices/Test)][build]
![Go version](https://img.shields.io/github/go-mod/go-version/vshn/billing-collector-cloudservices)
[![Version](https://img.shields.io/github/v/release/vshn/billing-collector-cloudservices)][releases]
[![GitHub downloads](https://img.shields.io/github/downloads/vshn/billing-collector-cloudservices/total)][releases]

[build]: https://github.com/vshn/exoscale-metrics-collector/actions?query=workflow%3ATest
[releases]: https://github.com/vshn/exoscale-metrics-collector/releases
[build]: https://github.com/vshn/billing-collector-cloudservices/actions?query=workflow%3ATest
[releases]: https://github.com/vshn/billing-collector-cloudservices/releases

Batch job to sync usage data from the Exoscale and Cloudscale API to the [APPUiO Cloud reporting](https://github.com/appuio/appuio-cloud-reporting/) database.

Metrics are collected taking into account product (e.g. `object-storage-storage:exoscale`), source (e.g. `exoscale:namespace`), tenant (as organization) and date time.

See the [component documentation](https://hub.syn.tools/exoscale-metrics-collector/index.html) for more information.
See the [component documentation](https://hub.syn.tools/billing-collector-cloudservices/index.html) for more information.

## Getting started for developers

Expand Down Expand Up @@ -42,12 +42,12 @@ Then, run one of the available commands:

* Object Storage:
```
$ ./metrics-collector exoscale objectstorage
$ ./billing-collector-cloudservices exoscale objectstorage
```

* DBaaS (runs metrics collector for all supported databases):
```
$ ./metrics-collector exoscale dbaas
$ ./billing-collector-cloudservices exoscale dbaas
```

### Billing Database
Expand Down Expand Up @@ -85,7 +85,7 @@ spec:

Once the database is created and `Ready`, you can run locally the command:
```
$ ./metrics-collector exoscale dbaas
$ ./billing-collector-cloudservices exoscale dbaas
```

The same works for other resources. Just apply the right claim and run the proper command.
Expand All @@ -106,21 +106,21 @@ The commands assume that you are logged in to the Kubernetes cluster you want to

Instructions for OpenShift >=4.11:
```
$ cd exoscale-metrics-collector
$ cd billing-collector-cloudservices
$ oc -n default --as cluster-admin apply -f clusterrole.yaml
$ oc -n default --as cluster-admin create serviceaccount vshn-exoscale-metrics-collector
$ oc --as cluster-admin adm policy add-cluster-role-to-user vshn-exoscale-metrics-collector system:serviceaccount:default:vshn-exoscale-metrics-collector
$ oc -n default --as cluster-admin create serviceaccount vshn-billing-collector-cloudservices
$ oc --as cluster-admin adm policy add-cluster-role-to-user vshn-billing-collector-cloudservices system:serviceaccount:default:vshn-billing-collector-cloudservices
$ oc -n default --as cluster-admin apply -f clusterrole-secret.yaml
$ oc -n default --as cluster-admin get secret vshn-exoscale-metrics-collector-secret -o jsonpath='{.data.token}' | base64 -d
$ oc -n default --as cluster-admin get secret vshn-billing-collector-cloudservices-secret -o jsonpath='{.data.token}' | base64 -d
```

Instructions for OpenShift <=4.10:
```
$ cd exoscale-metrics-collector
$ cd billing-collector-cloudservices
$ oc -n default --as cluster-admin apply -f clusterrole.yaml
$ oc -n default --as cluster-admin create serviceaccount vshn-exoscale-metrics-collector
$ oc --as cluster-admin adm policy add-cluster-role-to-user vshn-exoscale-metrics-collector system:serviceaccount:default:vshn-exoscale-metrics-collector
$ oc -n default --as cluster-admin serviceaccounts get-token vshn-exoscale-metrics-collector
$ oc -n default --as cluster-admin create serviceaccount vshn-billing-collector-cloudservices
$ oc --as cluster-admin adm policy add-cluster-role-to-user vshn-billing-collector-cloudservices system:serviceaccount:default:vshn-billing-collector-cloudservices
$ oc -n default --as cluster-admin serviceaccounts get-token vshn-billing-collector-cloudservices
```

The last command will print out your token without trailing newline; be sure to copy the correct part of the output.
Expand All @@ -146,5 +146,5 @@ EXOSCALE_CRDS_PATH="$(go list -f '{{.Dir}}' -m github.com/vshn/provider-exoscale
CLOUDSCALE_CRDS_PATH="$(go list -f '{{.Dir}}' -m github.com/vshn/provider-cloudscale)/package/crds)"

# make sure to run make target `test-integration` first to have everything setup correctly.
KUBEBUILDER_ASSETS="$(/path/to/exoscale-metrics-collector/.work/bin/setup-envtest --bin-dir "/path/to/exoscale-metrics-collector/.work/bin" use -i -p path '1.24.x!')"
KUBEBUILDER_ASSETS="$(/path/to/billing-collector-cloudservices/.work/bin/setup-envtest --bin-dir "/path/to/billing-collector-cloudservices/.work/bin" use -i -p path '1.24.x!')"
```
4 changes: 2 additions & 2 deletions clusterrole-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: vshn-exoscale-metrics-collector-secret
name: vshn-billing-collector-cloudservices-secret
annotations:
kubernetes.io/service-account.name: vshn-exoscale-metrics-collector
kubernetes.io/service-account.name: vshn-billing-collector-cloudservices
2 changes: 1 addition & 1 deletion clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: 'vshn-exoscale-metrics-collector'
name: 'vshn-billing-collector-cloudservices'
rules:
- apiGroups:
- '*'
Expand Down
4 changes: 2 additions & 2 deletions component/Makefile.vars.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Commodore takes the root dir name as the component name
COMPONENT_NAME ?= metrics-collector
COMPONENT_NAME ?= billing-collector-cloudservices
COMPONENT_SUBDIR ?= $(shell basename ${PWD})

compiled_path ?= compiled/$(COMPONENT_NAME)/$(COMPONENT_NAME)
Expand Down Expand Up @@ -43,5 +43,5 @@ KUBENT_ARGS ?= -c=false --helm2=false --helm3=false -e
KUBENT_IMAGE ?= docker.io/projectsyn/kubent:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= metrics-collector
instance ?= billing-collector-cloudservices
test_instances = tests/exoscale-metrics-collector.yml tests/collector-cloudscale-lpg-2.yml tests/cloudscale-metrics-collector.yml
File renamed without changes.
6 changes: 3 additions & 3 deletions component/class/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
metrics_collector:
billing_collector_cloudservices:
=_metadata:
multi_instance: true

Expand All @@ -20,8 +20,8 @@ parameters:
images:
collector:
registry: 'ghcr.io'
repository: 'vshn/metrics-collector'
tag: 'refactored-collectors'
repository: 'vshn/billing-collector-cloudservices'
tag: 'v1.0.0'

exoscale:
enabled: false
Expand Down
6 changes: 3 additions & 3 deletions component/component/main.jsonnet
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
local kap = import 'lib/kapitan.libjsonnet';
local inv = kap.inventory();
local params = inv.parameters.metrics_collector;
local params = inv.parameters.billing_collector_cloudservices;
local paramsACR = inv.parameters.appuio_cloud_reporting;
local kube = import 'lib/kube.libjsonnet';
local com = import 'lib/commodore.libjsonnet';
local collectorImage = '%(registry)s/%(repository)s:%(tag)s' % params.images.collector;
local alias = inv.parameters._instance;
local alias_suffix = '-' + alias;
local credentials_secret_name = 'credentials' + alias_suffix;
local component_name = 'metrics-collector';
local component_name = 'billing-collector-cloudservices';


local labels = {
Expand Down Expand Up @@ -46,7 +46,7 @@ local cronjob(name, subcommand, schedule) = {
restartPolicy: 'OnFailure',
containers: [
{
name: 'metrics-collector-backfill',
name: 'billing-collector-cloudservices-backfill',
image: collectorImage,
args: [
subcommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
parameters: 'sslmode=disable'
password: 'passw0rd'
port: 5432
metrics_collector:
billing_collector_cloudservices:
exoscale:
enabled: true
dbaas:
Expand Down
2 changes: 1 addition & 1 deletion component/tests/cloudscale-metrics-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
parameters: 'sslmode=disable'
password: 'passw0rd'
port: 5432
metrics_collector:
billing_collector_cloudservices:
cloudscale:
enabled: true
objectStorage:
Expand Down
2 changes: 1 addition & 1 deletion component/tests/collector-cloudscale-lpg-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ parameters:
parameters: 'sslmode=disable'
password: 'passw0rd'
port: 5432
metrics_collector:
billing_collector_cloudservices:
exoscale:
enabled: true
2 changes: 1 addition & 1 deletion component/tests/exoscale-metrics-collector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
parameters: 'sslmode=disable'
password: 'passw0rd'
port: 5432
metrics_collector:
billing_collector_cloudservices:
exoscale:
enabled: true
dbaas:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: batch/v1
kind: CronJob
metadata:
labels:
app.kubernetes.io/component: metrics-collector
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: metrics-collector
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: cloudscale-metrics-collector-objectstorage
namespace: appuio-cloud-reporting
Expand Down Expand Up @@ -34,8 +34,8 @@ spec:
envFrom:
- secretRef:
name: credentials-cloudscale-metrics-collector
image: ghcr.io/vshn/metrics-collector:refactored-collectors
name: metrics-collector-backfill
image: ghcr.io/vshn/billing-collector-cloudservices:v1.0.0
name: billing-collector-cloudservices-backfill
resources: {}
restartPolicy: OnFailure
schedule: 10 4,10,16 * * *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: batch/v1
kind: CronJob
metadata:
labels:
app.kubernetes.io/component: metrics-collector
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: metrics-collector
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: collector-cloudscale-lpg-2-objectstorage
namespace: appuio-cloud-reporting
Expand Down Expand Up @@ -34,8 +34,8 @@ spec:
envFrom:
- secretRef:
name: credentials-collector-cloudscale-lpg-2
image: ghcr.io/vshn/metrics-collector:refactored-collectors
name: metrics-collector-backfill
image: ghcr.io/vshn/billing-collector-cloudservices:v1.0.0
name: billing-collector-cloudservices-backfill
resources: {}
restartPolicy: OnFailure
schedule: 10 10,16,20 * * *
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: batch/v1
kind: CronJob
metadata:
labels:
app.kubernetes.io/component: metrics-collector
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: metrics-collector
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-metrics-collector-dbaas
namespace: appuio-cloud-reporting
Expand Down Expand Up @@ -34,8 +34,8 @@ spec:
envFrom:
- secretRef:
name: credentials-exoscale-metrics-collector
image: ghcr.io/vshn/metrics-collector:refactored-collectors
name: metrics-collector-backfill
image: ghcr.io/vshn/billing-collector-cloudservices:v1.0.0
name: billing-collector-cloudservices-backfill
resources: {}
restartPolicy: OnFailure
schedule: '*/15 * * * *'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ apiVersion: batch/v1
kind: CronJob
metadata:
labels:
app.kubernetes.io/component: metrics-collector
app.kubernetes.io/component: billing-collector-cloudservices
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: metrics-collector
app.kubernetes.io/name: billing-collector-cloudservices
app.kubernetes.io/part-of: appuio-cloud-reporting
name: exoscale-metrics-collector-objectstorage
namespace: appuio-cloud-reporting
Expand Down Expand Up @@ -34,8 +34,8 @@ spec:
envFrom:
- secretRef:
name: credentials-exoscale-metrics-collector
image: ghcr.io/vshn/metrics-collector:refactored-collectors
name: metrics-collector-backfill
image: ghcr.io/vshn/billing-collector-cloudservices:v1.0.0
name: billing-collector-cloudservices-backfill
resources: {}
restartPolicy: OnFailure
schedule: 10 10,16,20 * * *
Expand Down
4 changes: 2 additions & 2 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: exoscale-metrics-collector
title: exoscale-metrics-collector
name: billing-collector-cloudservices
title: billing-collector-cloudservices
version: master
start_page: ROOT:index.adoc
nav:
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/how-tos/installation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The access to the desired cluster from where the metrics should be collected has
[source,yaml]
----
applications:
- metrics-collector
- billing-collector-cloudservices
parameters:
metrics_collector:
Expand Down
8 changes: 4 additions & 4 deletions docs/modules/ROOT/pages/how-tos/multi-instance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This guide provides an example how to deploy multiple instances of this componen
[source,yaml]
----
applications:
- metrics-collector as collector-exoscale-ch-gva-2 <1>
- metrics-collector as collector-cloudscale-rma-0 <2>
- billing-collector-cloudservices as collector-exoscale-ch-gva-2 <1>
- billing-collector-cloudservices as collector-cloudscale-rma-0 <2>
parameters:
appuio_cloud_reporting:
namespace: 'appuio-cloud-reporting'
Expand All @@ -34,8 +34,8 @@ parent="clusters/kv/${TENANT_ID}/${CLUSTER_ID}"
instance_1="collector-exoscale-ch-gva-2"
instance_2="collector-cloudscale-rma-0"
vault kv put "${parent}/exoscale-metrics-collector/${instance_1}" exoscale-key=<key-1> exoscale-secret=<secret-1> cluster-server=<server-url-1> cluster-token=<token-1>
vault kv put "${parent}/exoscale-metrics-collector/${instance_2}" exoscale-key=<key-2> exoscale-secret=<secret-2> cluster-server=<server-url-2> cluster-token=<token-2>
vault kv put "${parent}/billing-collector-cloudservices/${instance_1}" exoscale-key=<key-1> exoscale-secret=<secret-1> cluster-server=<server-url-1> cluster-token=<token-1>
vault kv put "${parent}/billing-collector-cloudservices/${instance_2}" exoscale-key=<key-2> exoscale-secret=<secret-2> cluster-server=<server-url-2> cluster-token=<token-2>
----
+

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= metrics-collector
= billing-collector-cloudservices

Batch job to sync usage data from the Exoscale and Cloudscale metrics APIs to the https://github.com/appuio/appuio-cloud-reporting/[APPUiO Cloud Reporting] database.

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ See xref:how-tos/installation.adoc[Installation] for a full example.
[horizontal]
type:: dictionary
default:: https://github.com/vshn/exoscale-metrics-collector/blob/master/component/class/defaults.yml[See class/defaults.yml].
default:: https://github.com/vshn/billing-collector-cloudservices/blob/master/component/class/defaults.yml[See class/defaults.yml].
Dictionary containing the container images used by this component.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/vshn/exoscale-metrics-collector
module github.com/vshn/billing-collector-cloudservices

go 1.19

Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"time"

"github.com/urfave/cli/v2"
"github.com/vshn/exoscale-metrics-collector/pkg/cmd"
"github.com/vshn/exoscale-metrics-collector/pkg/log"
"github.com/vshn/billing-collector-cloudservices/pkg/cmd"
"github.com/vshn/billing-collector-cloudservices/pkg/log"
)

var (
Expand All @@ -20,7 +20,7 @@ var (
commit = "-dirty-"
date = time.Now().Format("2006-01-02")

appName = "metrics-collector"
appName = "billing-collector-cloudservices"
appLongName = "Metrics collector which gathers metrics information for cloud services"
)

Expand Down
Loading

0 comments on commit fe8faf9

Please sign in to comment.