From bdb95bbbb339ac1b4bf0a331b2d02ae43244b310 Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Thu, 21 Nov 2024 16:49:20 +0100 Subject: [PATCH 1/5] Add json schema for values.yaml + use alternateConfig instead of config for otel collector (easier to null the default values) Signed-off-by: Jirka Kremser --- helmchart/otel-add-on/Chart.lock | 6 +- helmchart/otel-add-on/Chart.yaml | 2 +- helmchart/otel-add-on/values.schema.json | 497 +++++++++++++++++++++++ helmchart/otel-add-on/values.yaml | 23 +- 4 files changed, 508 insertions(+), 20 deletions(-) create mode 100644 helmchart/otel-add-on/values.schema.json diff --git a/helmchart/otel-add-on/Chart.lock b/helmchart/otel-add-on/Chart.lock index a1a4544..a7e9a3e 100644 --- a/helmchart/otel-add-on/Chart.lock +++ b/helmchart/otel-add-on/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: opentelemetry-collector repository: https://open-telemetry.github.io/opentelemetry-helm-charts - version: 0.108.0 -digest: sha256:96f3eef2ce4a5cc86b5143e735f0b3e65ed43cf48776f93f535328a4379921f3 -generated: "2024-10-16T19:37:49.891859+02:00" + version: 0.110.0 +digest: sha256:887e770259e440e1feec1570037af95f3cb0da788ac824b57d6f79a8bcfa4481 +generated: "2024-11-21T16:37:17.878663+01:00" diff --git a/helmchart/otel-add-on/Chart.yaml b/helmchart/otel-add-on/Chart.yaml index 93b464d..36bdff6 100644 --- a/helmchart/otel-add-on/Chart.yaml +++ b/helmchart/otel-add-on/Chart.yaml @@ -10,7 +10,7 @@ icon: https://raw.githubusercontent.com/kedacore/keda/main/images/keda-logo-500x dependencies: - name: opentelemetry-collector repository: https://open-telemetry.github.io/opentelemetry-helm-charts - version: 0.108.0 + version: 0.110.0 condition: opentelemetry-collector.enabled home: https://github.com/kedify/otel-add-on sources: diff --git a/helmchart/otel-add-on/values.schema.json b/helmchart/otel-add-on/values.schema.json new file mode 100644 index 0000000..2c647f1 --- /dev/null +++ b/helmchart/otel-add-on/values.schema.json @@ -0,0 +1,497 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Generated schema for Root", + "type": "object", + "properties": { + "replicaCount": { + "type": "number" + }, + "image": { + "type": "object", + "properties": { + "repository": { + "type": "string" + }, + "pullPolicy": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "required": [ + "repository", + "pullPolicy", + "tag" + ] + }, + "settings": { + "type": "object", + "properties": { + "metricStoreRetentionSeconds": { + "type": "number" + }, + "isActivePollingIntervalMilliseconds": { + "type": "number" + }, + "internalMetricsPort": { + "type": "number" + }, + "restApiPort": { + "type": "number" + }, + "logs": { + "type": "object", + "properties": { + "logLvl": { + "type": "string" + }, + "stackTracesLvl": { + "type": "string" + }, + "noColor": { + "type": "boolean" + }, + "noBanner": { + "type": "boolean" + } + }, + "required": [ + "logLvl", + "stackTracesLvl", + "noColor", + "noBanner" + ] + } + }, + "required": [ + "metricStoreRetentionSeconds", + "isActivePollingIntervalMilliseconds", + "internalMetricsPort", + "restApiPort", + "logs" + ] + }, + "asciiArt": { + "type": "boolean" + }, + "imagePullSecrets": { + "type": "array", + "items": {} + }, + "nameOverride": { + "type": "string" + }, + "fullnameOverride": { + "type": "string" + }, + "serviceAccount": { + "type": "object", + "properties": { + "create": { + "type": "boolean" + }, + "automount": { + "type": "boolean" + }, + "annotations": { + "type": "object", + "properties": {}, + "required": [] + }, + "name": { + "type": "string" + } + }, + "required": [ + "create", + "automount", + "annotations", + "name" + ] + }, + "podAnnotations": { + "type": "object", + "properties": {}, + "required": [] + }, + "podLabels": { + "type": "object", + "properties": {}, + "required": [] + }, + "podSecurityContext": { + "type": "object", + "properties": {}, + "required": [] + }, + "securityContext": { + "type": "object", + "properties": { + "capabilities": { + "type": "object", + "properties": { + "drop": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "drop" + ] + }, + "readOnlyRootFilesystem": { + "type": "boolean" + }, + "runAsNonRoot": { + "type": "boolean" + }, + "runAsUser": { + "type": "number" + } + }, + "required": [ + "capabilities", + "readOnlyRootFilesystem", + "runAsNonRoot", + "runAsUser" + ] + }, + "service": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "otlpReceiverPort": { + "type": "number" + }, + "kedaExternalScalerPort": { + "type": "number" + } + }, + "required": [ + "type", + "otlpReceiverPort", + "kedaExternalScalerPort" + ] + }, + "resources": { + "type": "object", + "properties": { + "limits": { + "type": "object", + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "required": [ + "cpu", + "memory" + ] + }, + "requests": { + "type": "object", + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "required": [ + "cpu", + "memory" + ] + } + }, + "required": [ + "limits", + "requests" + ] + }, + "volumes": { + "type": "array", + "items": {} + }, + "volumeMounts": { + "type": "array", + "items": {} + }, + "nodeSelector": { + "type": "object", + "properties": {}, + "required": [] + }, + "tolerations": { + "type": "array", + "items": {} + }, + "affinity": { + "type": "object", + "properties": {}, + "required": [] + }, + "opentelemetry-collector": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "mode": { + "type": "string" + }, + "image": { + "type": "object", + "properties": { + "repository": { + "type": "string" + } + }, + "required": [ + "repository" + ] + }, + "fullnameOverride": { + "type": "string" + }, + "ports": { + "type": "object", + "properties": { + "jaeger-compact": {}, + "jaeger-thrift": {}, + "jaeger-grpc": {}, + "zipkin": {}, + "otlp": {}, + "otlp-http": {}, + "opencensus": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "containerPort": { + "type": "number" + }, + "servicePort": { + "type": "number" + }, + "hostPort": { + "type": "number" + }, + "protocol": { + "type": "string" + } + }, + "required": [ + "enabled", + "containerPort", + "servicePort", + "hostPort", + "protocol" + ] + } + }, + "required": [ + ] + }, + "alternateConfig": { + "type": "object", + "properties": { + "receivers": { + "type": "object", + "properties": { + "opencensus": { + "type": "object", + "properties": { + "endpoint": { + "type": "string" + }, + "include_metadata": { + "type": "boolean" + } + }, + "required": [ + "endpoint", + "include_metadata" + ] + }, + "prometheus": {}, + "zipkin": {}, + "jaeger": {}, + "otlp": {} + }, + "required": [ + ] + }, + "exporters": { + "type": "object", + "properties": { + "otlp": { + "type": "object", + "properties": { + "endpoint": { + "type": "string" + }, + "compression": { + "type": "string" + }, + "tls": { + "type": "object", + "properties": { + "insecure": { + "type": "boolean" + } + }, + "required": [ + "insecure" + ] + } + }, + "required": [ + "endpoint", + "compression", + "tls" + ] + }, + "debug": { + "type": "object", + "properties": { + "verbosity": { + "type": "string" + } + }, + "required": [ + "verbosity" + ] + } + }, + "required": [ + "otlp", + "debug" + ] + }, + "processors": { + "type": "object", + "properties": { + "filter/ottl": { + "type": "object", + "properties": { + "error_mode": { + "type": "string" + }, + "metrics": { + "type": "object", + "properties": { + "metric": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "metric" + ] + } + }, + "required": [ + "error_mode", + "metrics" + ] + } + }, + "required": [ + "filter/ottl" + ] + }, + "service": { + "type": "object", + "properties": { + "pipelines": { + "type": "object", + "properties": { + "traces": {}, + "logs": {}, + "metrics": { + "type": "object", + "properties": { + "receivers": { + "type": "array", + "items": { + "type": "string" + } + }, + "processors": { + "type": "array", + "items": { + "type": "string" + } + }, + "exporters": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "processors", + "exporters" + ] + } + }, + "required": [ + "metrics" + ] + } + }, + "required": [ + "pipelines" + ] + } + }, + "required": [ + "exporters", + "processors", + "service" + ] + } + }, + "required": [ + "enabled", + "mode", + "image", + "fullnameOverride" + ] + } + }, + "required": [ + "replicaCount", + "image", + "settings", + "asciiArt", + "imagePullSecrets", + "nameOverride", + "fullnameOverride", + "serviceAccount", + "podAnnotations", + "podLabels", + "podSecurityContext", + "securityContext", + "service", + "resources", + "volumes", + "volumeMounts", + "nodeSelector", + "tolerations", + "affinity" + ] +} diff --git a/helmchart/otel-add-on/values.yaml b/helmchart/otel-add-on/values.yaml index 79722da..73e17a6 100644 --- a/helmchart/otel-add-on/values.yaml +++ b/helmchart/otel-add-on/values.yaml @@ -75,7 +75,8 @@ securityContext: runAsUser: 1000 service: - # -- Under this service, the otel add on needs to be reachable by KEDA operator and OTEL collector ([details](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types)) + # -- Under this service, the otel add on needs to be reachable by KEDA operator and OTEL collector + # ([details](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types)) type: ClusterIP # -- OTLP receiver will be opened on this port. OTEL exporter configured in the OTEL collector needs to have this value set. otlpReceiverPort: 4317 @@ -114,9 +115,10 @@ tolerations: [] # -- [details](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) affinity: {} -#otel collector helm chart: +# otel collector helm chart: # https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-collector/values.yaml #-------------------------- +# example configuration of otel collector to work as an opencensus receiver and forwarder to otel-add-on opentelemetry-collector: enabled: true mode: deployment @@ -125,12 +127,6 @@ opentelemetry-collector: fullnameOverride: otelcol ports: - jaeger-compact: null - jaeger-thrift: null - jaeger-grpc: null - zipkin: null - otlp: null - otlp-http: null opencensus: enabled: true containerPort: 55678 @@ -138,16 +134,12 @@ opentelemetry-collector: hostPort: 55678 protocol: TCP - config: + alternateConfig: receivers: # https://grafana.com/docs/alloy/latest/reference/components/otelcol/otelcol.receiver.opencensus/ opencensus: endpoint: 0.0.0.0:55678 include_metadata: true - prometheus: null - zipkin: null - jaeger: null - otlp: null exporters: otlp: # make sure this is the same hostname and port as .service @@ -175,7 +167,8 @@ opentelemetry-collector: - resource.attributes["app_id"] == "nodeapp" # drop all metrics w/o the app_id = nodeapp tag on them # - not (IsMatch(name, "http/client/*")) # drop all metrics that don't start w/ http/client/ - # more here: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/LANGUAGE.md & https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/ottlfuncs + # more here: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/pkg/ottl/LANGUAGE.md + # & https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/ottlfuncs # - 'type != METRIC_DATA_TYPE_GAUGE' # drop all non-gauges # debug/profiling @@ -188,8 +181,6 @@ opentelemetry-collector: service: # extensions: [pprof, zpages] pipelines: - traces: null - logs: null metrics: receivers: - opencensus From 914238d4212b28ab2191ea9969f6229908f94d18 Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Thu, 21 Nov 2024 17:00:39 +0100 Subject: [PATCH 2/5] reference the upstream json schema from this json schema Signed-off-by: Jirka Kremser --- helmchart/otel-add-on/values.schema.json | 231 +---------------------- 1 file changed, 1 insertion(+), 230 deletions(-) diff --git a/helmchart/otel-add-on/values.schema.json b/helmchart/otel-add-on/values.schema.json index 2c647f1..b31680e 100644 --- a/helmchart/otel-add-on/values.schema.json +++ b/helmchart/otel-add-on/values.schema.json @@ -241,236 +241,7 @@ }, "opentelemetry-collector": { "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "mode": { - "type": "string" - }, - "image": { - "type": "object", - "properties": { - "repository": { - "type": "string" - } - }, - "required": [ - "repository" - ] - }, - "fullnameOverride": { - "type": "string" - }, - "ports": { - "type": "object", - "properties": { - "jaeger-compact": {}, - "jaeger-thrift": {}, - "jaeger-grpc": {}, - "zipkin": {}, - "otlp": {}, - "otlp-http": {}, - "opencensus": { - "type": "object", - "properties": { - "enabled": { - "type": "boolean" - }, - "containerPort": { - "type": "number" - }, - "servicePort": { - "type": "number" - }, - "hostPort": { - "type": "number" - }, - "protocol": { - "type": "string" - } - }, - "required": [ - "enabled", - "containerPort", - "servicePort", - "hostPort", - "protocol" - ] - } - }, - "required": [ - ] - }, - "alternateConfig": { - "type": "object", - "properties": { - "receivers": { - "type": "object", - "properties": { - "opencensus": { - "type": "object", - "properties": { - "endpoint": { - "type": "string" - }, - "include_metadata": { - "type": "boolean" - } - }, - "required": [ - "endpoint", - "include_metadata" - ] - }, - "prometheus": {}, - "zipkin": {}, - "jaeger": {}, - "otlp": {} - }, - "required": [ - ] - }, - "exporters": { - "type": "object", - "properties": { - "otlp": { - "type": "object", - "properties": { - "endpoint": { - "type": "string" - }, - "compression": { - "type": "string" - }, - "tls": { - "type": "object", - "properties": { - "insecure": { - "type": "boolean" - } - }, - "required": [ - "insecure" - ] - } - }, - "required": [ - "endpoint", - "compression", - "tls" - ] - }, - "debug": { - "type": "object", - "properties": { - "verbosity": { - "type": "string" - } - }, - "required": [ - "verbosity" - ] - } - }, - "required": [ - "otlp", - "debug" - ] - }, - "processors": { - "type": "object", - "properties": { - "filter/ottl": { - "type": "object", - "properties": { - "error_mode": { - "type": "string" - }, - "metrics": { - "type": "object", - "properties": { - "metric": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "metric" - ] - } - }, - "required": [ - "error_mode", - "metrics" - ] - } - }, - "required": [ - "filter/ottl" - ] - }, - "service": { - "type": "object", - "properties": { - "pipelines": { - "type": "object", - "properties": { - "traces": {}, - "logs": {}, - "metrics": { - "type": "object", - "properties": { - "receivers": { - "type": "array", - "items": { - "type": "string" - } - }, - "processors": { - "type": "array", - "items": { - "type": "string" - } - }, - "exporters": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "processors", - "exporters" - ] - } - }, - "required": [ - "metrics" - ] - } - }, - "required": [ - "pipelines" - ] - } - }, - "required": [ - "exporters", - "processors", - "service" - ] - } - }, - "required": [ - "enabled", - "mode", - "image", - "fullnameOverride" - ] + "$ref": "https://raw.githubusercontent.com/open-telemetry/opentelemetry-helm-charts/refs/tags/opentelemetry-operator-0.74.2/charts/opentelemetry-collector/values.schema.json#/properties" } }, "required": [ From 5dae8622e1c5e20cf78ee17717c86c868fb390ff Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Fri, 22 Nov 2024 10:50:32 +0100 Subject: [PATCH 3/5] Use the corresponding opentelemetry-collector version in url links Signed-off-by: Jirka Kremser --- helmchart/otel-add-on/values.schema.json | 2 +- helmchart/otel-add-on/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helmchart/otel-add-on/values.schema.json b/helmchart/otel-add-on/values.schema.json index b31680e..61c7a9b 100644 --- a/helmchart/otel-add-on/values.schema.json +++ b/helmchart/otel-add-on/values.schema.json @@ -241,7 +241,7 @@ }, "opentelemetry-collector": { "type": "object", - "$ref": "https://raw.githubusercontent.com/open-telemetry/opentelemetry-helm-charts/refs/tags/opentelemetry-operator-0.74.2/charts/opentelemetry-collector/values.schema.json#/properties" + "$ref": "https://raw.githubusercontent.com/open-telemetry/opentelemetry-helm-charts/refs/tags/opentelemetry-collector-0.110.0/charts/opentelemetry-collector/values.schema.json#/properties" } }, "required": [ diff --git a/helmchart/otel-add-on/values.yaml b/helmchart/otel-add-on/values.yaml index 73e17a6..3c2853b 100644 --- a/helmchart/otel-add-on/values.yaml +++ b/helmchart/otel-add-on/values.yaml @@ -116,7 +116,7 @@ tolerations: [] affinity: {} # otel collector helm chart: -# https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-collector/values.yaml +# https://github.com/open-telemetry/opentelemetry-helm-charts/tree/opentelemetry-collector-0.110.0/charts/opentelemetry-collector/values.yaml #-------------------------- # example configuration of otel collector to work as an opencensus receiver and forwarder to otel-add-on opentelemetry-collector: From 679c4f2ec80a338b1cee8702d347e54a2902fa9b Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Fri, 22 Nov 2024 11:46:53 +0100 Subject: [PATCH 4/5] Add renovate task that updates the sub-chart version + gh action that rebuilds the deps Signed-off-by: Jirka Kremser --- .github/workflows/helm-rebuild-deps.yaml | 48 ++++++++++++++++++++++++ renovate.json5 | 32 ++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 .github/workflows/helm-rebuild-deps.yaml diff --git a/.github/workflows/helm-rebuild-deps.yaml b/.github/workflows/helm-rebuild-deps.yaml new file mode 100644 index 0000000..4bfe580 --- /dev/null +++ b/.github/workflows/helm-rebuild-deps.yaml @@ -0,0 +1,48 @@ +name: Helm deps +on: + workflow_dispatch: + push: + branches: + - 'main' + paths: + - 'helmchart/otel-add-on/Chart.yaml' +permissions: + contents: read + +jobs: + build-helm-deps: + permissions: + contents: write # for peter-evans/create-pull-request to create branch + pull-requests: write # for peter-evans/create-pull-request to create a PR + name: Update Helm Deps + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + - name: Rebuild the lock file for chart dependencies + run: | + helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts + helm repo update open-telemetry + pushd ./helmchart/otel-add-on && helm dependency build && popd + - name: Create Pull Request + uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 + id: cpr + with: + title: "Update Helm Chart.lock" + branch: ci-helm-deps + delete-branch: true + base: main + signoff: true + token: ${{ secrets.GITHUB_TOKEN }} + body: | + :package: helmchart/otel-add-on/Chart.lock update :package: + ### automated change + Running helm dependency build on updated sub-chart versions. + Check the result of e2e tests if latest release of `opentelemetry-collector` didn't break the scaler. + If so, pls revert the change from renovate. + + This automated PR was created by [this action](https://github.com/kedify/otel-add-on/actions/runs/${{ github.run_id }}). + - name: Check PR + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" | tee -a "$GITHUB_STEP_SUMMARY" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" | tee -a "$GITHUB_STEP_SUMMARY" diff --git a/renovate.json5 b/renovate.json5 index b2ceea7..763b815 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -19,6 +19,13 @@ "labels": ["skip-ci", "renovate"], "enabled": true, }, + { + "packageNames": [ + "open-telemetry/opentelemetry-helm-charts", + ], + "labels": ["skip-ci", "renovate"], + "enabled": true, + } ], "regexManagers": [ { @@ -40,6 +47,31 @@ ".* oci://ghcr.io/kedify/charts/otel-add-on \\s*--version=(?\\S+).*\n", ], }, + + // bump helm chart version of opentelemetry-collector if there is a release + { + "fileMatch": [ + "(^|/)helmchart/otel-add-on/README.md$", + "(^|/)helmchart/otel-add-on/values.schema.json$", + ], + "datasourceTemplate": "github-tags", + "depNameTemplate": "open-telemetry/opentelemetry-helm-charts", + "extractVersionTemplate": "^opentelemetry-collector-(?.*)$", + "matchStrings": [ + ".*/(tree|tags)/opentelemetry-collector-(?[^/]+).*\n", + ], + }, + { + "fileMatch": [ + "(^|/)helmchart/otel-add-on/Chart.yaml$" + ], + "datasourceTemplate": "github-tags", + "depNameTemplate": "open-telemetry/opentelemetry-helm-charts", + "extractVersionTemplate": "^opentelemetry-collector-(?.*)$", + "matchStrings": [ + ".*/opentelemetry-helm-charts\n\\s+version:\\s+(?[^\\S]+).*\n", + ], + } ], "reviewers": ["team:all"], "prBodyNotes": [ From 45f626b9a9574540e74282f38d5ae6dd5a822525 Mon Sep 17 00:00:00 2001 From: Jirka Kremser Date: Fri, 22 Nov 2024 11:49:55 +0100 Subject: [PATCH 5/5] simplify the regexp for renovate Signed-off-by: Jirka Kremser --- renovate.json5 | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/renovate.json5 b/renovate.json5 index 763b815..50a075c 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -32,10 +32,7 @@ // bump helm chart version if there is a release "fileMatch": [ "(^|/)README.md$", - "(^|/)examples/metric-pull/README.md$", - "(^|/)examples/metric-pull/setup.sh$", - "(^|/)examples/metric-push/README.md$", - "(^|/)examples/metric-push/setup.sh$", + "(^|/)examples/metric-pu(ll|sh)/(README.md|setup.sh)$", "(^|/)helmchart/otel-add-on/README.md$", "(^|/)helmchart/otel-add-on/_helm-docs-template.gotmpl$", ],