From 020d8f2cab21090b6864986aafc17806db0890b5 Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Sun, 21 Jul 2024 18:10:45 +0300 Subject: [PATCH 1/4] feat: release helm CRDs in a separate helm chart --- .github/workflows/release.yml | 5 +- helm/odigos-crds/Chart.yaml | 8 + helm/odigos-crds/templates/odigos-config.yaml | 137 ++++++++++++++++++ helm/odigos-crds/values.yaml | 0 helm/odigos/Chart.yaml | 8 +- scripts/release-charts.sh | 29 +++- 6 files changed, 174 insertions(+), 13 deletions(-) create mode 100644 helm/odigos-crds/Chart.yaml create mode 100644 helm/odigos-crds/templates/odigos-config.yaml create mode 100644 helm/odigos-crds/values.yaml mode change 100644 => 100755 scripts/release-charts.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 52a05aef1..bdfcf2d6d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -137,6 +137,7 @@ jobs: echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV else echo "Unknown event type" + echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV exit 1 fi @@ -156,4 +157,6 @@ jobs: version: v3.15.2 - name: Release Helm charts - run: sh ./scripts/release-charts.sh + env: + GH_TOKEN: ${{ github.token }} + run: bash ./scripts/release-charts.sh diff --git a/helm/odigos-crds/Chart.yaml b/helm/odigos-crds/Chart.yaml new file mode 100644 index 000000000..2bb3fe6fa --- /dev/null +++ b/helm/odigos-crds/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: odigos-crds +description: CRDs for Odigos Helm Chart +type: application +# 0.0.0 will be replaced by the git tag version on release +version: "0.0.0" +appVersion: "0.0.0" +icon: https://d2q89wckrml3k4.cloudfront.net/logo.png diff --git a/helm/odigos-crds/templates/odigos-config.yaml b/helm/odigos-crds/templates/odigos-config.yaml new file mode 100644 index 000000000..39cd8d04b --- /dev/null +++ b/helm/odigos-crds/templates/odigos-config.yaml @@ -0,0 +1,137 @@ +# THIS RESOURCE STILL LIVES IN odigos-io/odigos-charts repo +# ADDED HERE FOR TESTING WORKFLOWS +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.8.0 + creationTimestamp: null + name: odigosconfigurations.odigos.io +spec: + group: odigos.io + names: + kind: OdigosConfiguration + listKind: OdigosConfigurationList + plural: odigosconfigurations + singular: odigosconfiguration + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: OdigosConfiguration is the Schema for the odigos configuration + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: OdigosConfigurationSpec defines the desired state of OdigosConfiguration + properties: + autoscalerImage: + type: string + collectorGateway: + properties: + goMemLimitMiB: + description: the GOMEMLIMIT environment variable value for the + collector gateway deployment. this is when go runtime will start + garbage collection. if not set, it will be set to 80% of the + hard limit of the memory limiter. + type: integer + memoryLimiterLimitMiB: + description: this parameter sets the "limit_mib" parameter in + the memory limiter configuration for the collector gateway. + it is the hard limit after which a force garbage collection + will be performed. if not set, it will be 50Mi below the memory + request. + type: integer + memoryLimiterSpikeLimitMiB: + description: this parameter sets the "spike_limit_mib" parameter + in the memory limiter configuration for the collector gateway. + note that this is not the processor soft limit, but the diff + in Mib between the hard limit and the soft limit. if not set, + this will be set to 20% of the hard limit (so the soft limit + will be 80% of the hard limit). + type: integer + requestMemoryMiB: + description: 'RequestMemoryMiB is the memory request for the cluster + gateway collector deployment. it will be embedded in the deployment + as a resource request of the form "memory: Mi" default + value is 500Mi' + type: integer + type: object + configVersion: + type: integer + defaultSDKs: + additionalProperties: + properties: + sdkTier: + type: string + sdkType: + description: 'Odigos supports two types of OpenTelemetry SDKs: + native and ebpf.' + type: string + required: + - sdkTier + - sdkType + type: object + type: object + ignoredContainers: + items: + type: string + type: array + ignoredNamespaces: + items: + type: string + type: array + imagePrefix: + type: string + instrumentorImage: + type: string + odigletImage: + type: string + odigosVersion: + type: string + openshiftEnabled: + type: boolean + psp: + type: boolean + supportedSDKs: + additionalProperties: + items: + properties: + sdkTier: + type: string + sdkType: + description: 'Odigos supports two types of OpenTelemetry SDKs: + native and ebpf.' + type: string + required: + - sdkTier + - sdkType + type: object + type: array + type: object + telemetryEnabled: + type: boolean + required: + - configVersion + - odigosVersion + type: object + type: object + served: true + storage: true +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/helm/odigos-crds/values.yaml b/helm/odigos-crds/values.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/helm/odigos/Chart.yaml b/helm/odigos/Chart.yaml index 574dc984e..d3f93b350 100644 --- a/helm/odigos/Chart.yaml +++ b/helm/odigos/Chart.yaml @@ -1,8 +1,8 @@ apiVersion: v2 name: odigos -description: Odigos Helm Chart for Kubernetes +description: Odigos distribution for Kubernetes type: application -# v0.0.0 will be replaced by the git tag version on release -version: "v0.0.0" -appVersion: "v0.0.0" +# 0.0.0 will be replaced by the git tag version on release +version: "0.0.0" +appVersion: "0.0.0" icon: https://d2q89wckrml3k4.cloudfront.net/logo.png diff --git a/scripts/release-charts.sh b/scripts/release-charts.sh old mode 100644 new mode 100755 index 443a4824b..1e7852349 --- a/scripts/release-charts.sh +++ b/scripts/release-charts.sh @@ -1,8 +1,17 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # Setup TMPDIR="$(mktemp -d)" -CHARTDIR="helm/odigos" +CHARTDIRS=("helm/odigos" "helm/odigos-crds") + +prefix () { + echo "${@:1}" + echo "${@:2}" + for i in "${@:2}"; do + echo "renaming $i to $1$i" + mv "$i" "$1$i" + done +} if [ -z "$TAG" ]; then echo "TAG required" @@ -14,7 +23,7 @@ if [ -z "$GITHUB_REPOSITORY" ]; then exit 1 fi -if [[ $(git diff -- $CHARTDIR | wc -c) -ne 0 ]]; then +if [[ $(git diff -- ${CHARTDIRS[*]} | wc -c) -ne 0 ]]; then echo "Helm chart dirty. Aborting." exit 1 fi @@ -24,16 +33,20 @@ helm repo add odigos https://odigos-io.github.io/odigos-charts 2> /dev/null || t git worktree add $TMPDIR gh-pages -f # Update index with new packages -sed -i -E 's/v0.0.0/'"${TAG}"'/' $CHARTDIR/Chart.yaml -helm package helm/* -d $TMPDIR +for chart in "${CHARTDIRS[@]}" +do + echo before $chart/Chart.yaml + sed -i -E 's/0.0.0/'"${TAG#v}"'/' $chart/Chart.yaml +done +helm package ${CHARTDIRS[*]} -d $TMPDIR pushd $TMPDIR helm repo index . --merge index.yaml --url https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/ # The check avoids pushing the same tag twice and only pushes if there's a new entry in the index if [[ $(git diff -G apiVersion | wc -c) -ne 0 ]]; then # Upload new packages - rename 'odigos' 'test-helm-assets-odigos' *.tgz - gh release upload -R $GITHUB_REPOSITORY $TAG $TMPDIR/*.tgz + prefix 'test-helm-assets-' *.tgz + gh release upload -R $GITHUB_REPOSITORY $TAG $TMPDIR/*.tgz || exit 1 git add index.yaml git commit -m "update index with $TAG" && git push @@ -45,5 +58,5 @@ else fi # Roll back chart version changes -git checkout $CHARTDIR +git checkout ${CHARTDIRS[*]} git worktree remove $TMPDIR -f || echo " -> Failed to clean up temp worktree" From dbfe9ff59454de27ef9b1e2718c1bd76da7af89a Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Mon, 22 Jul 2024 11:08:54 +0300 Subject: [PATCH 2/4] feat: remove CRD chart --- helm/odigos-crds/Chart.yaml | 8 - helm/odigos-crds/templates/odigos-config.yaml | 137 ------------------ helm/odigos-crds/values.yaml | 0 scripts/release-charts.sh | 6 +- 4 files changed, 3 insertions(+), 148 deletions(-) delete mode 100644 helm/odigos-crds/Chart.yaml delete mode 100644 helm/odigos-crds/templates/odigos-config.yaml delete mode 100644 helm/odigos-crds/values.yaml diff --git a/helm/odigos-crds/Chart.yaml b/helm/odigos-crds/Chart.yaml deleted file mode 100644 index 2bb3fe6fa..000000000 --- a/helm/odigos-crds/Chart.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: v2 -name: odigos-crds -description: CRDs for Odigos Helm Chart -type: application -# 0.0.0 will be replaced by the git tag version on release -version: "0.0.0" -appVersion: "0.0.0" -icon: https://d2q89wckrml3k4.cloudfront.net/logo.png diff --git a/helm/odigos-crds/templates/odigos-config.yaml b/helm/odigos-crds/templates/odigos-config.yaml deleted file mode 100644 index 39cd8d04b..000000000 --- a/helm/odigos-crds/templates/odigos-config.yaml +++ /dev/null @@ -1,137 +0,0 @@ -# THIS RESOURCE STILL LIVES IN odigos-io/odigos-charts repo -# ADDED HERE FOR TESTING WORKFLOWS -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.8.0 - creationTimestamp: null - name: odigosconfigurations.odigos.io -spec: - group: odigos.io - names: - kind: OdigosConfiguration - listKind: OdigosConfigurationList - plural: odigosconfigurations - singular: odigosconfiguration - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: OdigosConfiguration is the Schema for the odigos configuration - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: OdigosConfigurationSpec defines the desired state of OdigosConfiguration - properties: - autoscalerImage: - type: string - collectorGateway: - properties: - goMemLimitMiB: - description: the GOMEMLIMIT environment variable value for the - collector gateway deployment. this is when go runtime will start - garbage collection. if not set, it will be set to 80% of the - hard limit of the memory limiter. - type: integer - memoryLimiterLimitMiB: - description: this parameter sets the "limit_mib" parameter in - the memory limiter configuration for the collector gateway. - it is the hard limit after which a force garbage collection - will be performed. if not set, it will be 50Mi below the memory - request. - type: integer - memoryLimiterSpikeLimitMiB: - description: this parameter sets the "spike_limit_mib" parameter - in the memory limiter configuration for the collector gateway. - note that this is not the processor soft limit, but the diff - in Mib between the hard limit and the soft limit. if not set, - this will be set to 20% of the hard limit (so the soft limit - will be 80% of the hard limit). - type: integer - requestMemoryMiB: - description: 'RequestMemoryMiB is the memory request for the cluster - gateway collector deployment. it will be embedded in the deployment - as a resource request of the form "memory: Mi" default - value is 500Mi' - type: integer - type: object - configVersion: - type: integer - defaultSDKs: - additionalProperties: - properties: - sdkTier: - type: string - sdkType: - description: 'Odigos supports two types of OpenTelemetry SDKs: - native and ebpf.' - type: string - required: - - sdkTier - - sdkType - type: object - type: object - ignoredContainers: - items: - type: string - type: array - ignoredNamespaces: - items: - type: string - type: array - imagePrefix: - type: string - instrumentorImage: - type: string - odigletImage: - type: string - odigosVersion: - type: string - openshiftEnabled: - type: boolean - psp: - type: boolean - supportedSDKs: - additionalProperties: - items: - properties: - sdkTier: - type: string - sdkType: - description: 'Odigos supports two types of OpenTelemetry SDKs: - native and ebpf.' - type: string - required: - - sdkTier - - sdkType - type: object - type: array - type: object - telemetryEnabled: - type: boolean - required: - - configVersion - - odigosVersion - type: object - type: object - served: true - storage: true -status: - acceptedNames: - kind: "" - plural: "" - conditions: [] - storedVersions: [] diff --git a/helm/odigos-crds/values.yaml b/helm/odigos-crds/values.yaml deleted file mode 100644 index e69de29bb..000000000 diff --git a/scripts/release-charts.sh b/scripts/release-charts.sh index 1e7852349..194af6d2f 100755 --- a/scripts/release-charts.sh +++ b/scripts/release-charts.sh @@ -2,13 +2,13 @@ # Setup TMPDIR="$(mktemp -d)" -CHARTDIRS=("helm/odigos" "helm/odigos-crds") +CHARTDIRS=("helm/odigos") prefix () { echo "${@:1}" echo "${@:2}" for i in "${@:2}"; do - echo "renaming $i to $1$i" + echo "Renaming $i to $1$i" mv "$i" "$1$i" done } @@ -35,7 +35,7 @@ git worktree add $TMPDIR gh-pages -f # Update index with new packages for chart in "${CHARTDIRS[@]}" do - echo before $chart/Chart.yaml + echo "Updating $chart/Chart.yaml with version ${TAG#v}" sed -i -E 's/0.0.0/'"${TAG#v}"'/' $chart/Chart.yaml done helm package ${CHARTDIRS[*]} -d $TMPDIR From 7831b7e3d3e7beb2c32bb6b7e72426b4d6baa66e Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Mon, 22 Jul 2024 11:22:54 +0300 Subject: [PATCH 3/4] fix: prefix before indexing to have the correct filename in the index --- scripts/release-charts.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/release-charts.sh b/scripts/release-charts.sh index 194af6d2f..04ece9bd8 100755 --- a/scripts/release-charts.sh +++ b/scripts/release-charts.sh @@ -40,12 +40,13 @@ do done helm package ${CHARTDIRS[*]} -d $TMPDIR pushd $TMPDIR +prefix 'test-helm-assets-' *.tgz helm repo index . --merge index.yaml --url https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG/ +git diff -G apiVersion # The check avoids pushing the same tag twice and only pushes if there's a new entry in the index if [[ $(git diff -G apiVersion | wc -c) -ne 0 ]]; then # Upload new packages - prefix 'test-helm-assets-' *.tgz gh release upload -R $GITHUB_REPOSITORY $TAG $TMPDIR/*.tgz || exit 1 git add index.yaml From c1c90925c50b52ec9cd8c8a7c9626151cb8456fd Mon Sep 17 00:00:00 2001 From: Rauno Viskus Date: Mon, 22 Jul 2024 11:25:00 +0300 Subject: [PATCH 4/4] feat: release workflow releases the CLI and Helm now --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bdfcf2d6d..80ccc3279 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release Odigos CLI +name: Release Odigos on: workflow_dispatch: