Skip to content

Commit

Permalink
feat: set this repo up for a Helm chart registry (#1362)
Browse files Browse the repository at this point in the history
I cannot properly test the new workflow because of the very intricate
setup with dispatches and everything. Thus I added the workflow here for
testing.

:exclamation: The workflow will be run and assets produced and uploaded
to the release under "test-helm-assets-odigos.tgz". **These assets will
not be available through our current Helm Chart index.** Anyone using
our helm charts will not be affected with this PR. The current mode of
Helm chart development completely stays the same. This contribution is
solely for setting up a parallel workflow for testing.

Notable changes:

1. Set up a duplicate registry at https://odigos-io.github.io/odigos
(note the lack of "-charts" suffix)
2. Bring charts into the same repo(this one here) as the code, since our
application is tightly coupled with k8s assets anyway.
3. Integrate publishing Helm charts (to the **new** registry) into the
"release" step of Odigos - until now, that step consisted of publishing
CLI, now there's two outlets.
4. Simplify managing Helm Charts:
    - Remove the need to update the version(taken from the git tag)
- Unify appVersion, chart version and `image.tag` values so that there's
one less thing to mess up while releasing charts.
- Automate the release process and reuse the same GitHub releases for
the code, the CLI and helm charts.
  • Loading branch information
rauno56 authored Jul 17, 2024
1 parent f50dc97 commit 989a1ba
Show file tree
Hide file tree
Showing 9 changed files with 368 additions and 16 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/helm-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint Charts

on:
pull_request:
paths:
- helm/**

jobs:
lint-charts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Helm
uses: azure/setup-helm@v4
- name: Lint Charts
run: helm lint helm/*
61 changes: 45 additions & 16 deletions .github/workflows/publish-cli.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,15 @@ env:
DOCKERHUB_ORG: "keyval"

jobs:
release:
runs-on:
labels: ubuntu-latest
release-cli:
runs-on: ubuntu-latest
steps:

- name: Determine Tag Value
id: set_tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_OUTPUT
echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
else
echo "Unknown event type"
exit 1
Expand All @@ -38,7 +35,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.set_tag.outputs.tag }}
ref: ${{ env.TAG }}

- name: Set env
id: vars
Expand All @@ -51,12 +48,12 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"description":"Starting Odigos CLI release", "tag":"${{ steps.set_tag.outputs.tag }}"}' ${{ env.SLACK_WEBHOOK_URL }}
curl -X POST -H 'Content-type: application/json' --data '{"description":"Starting Odigos CLI release", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Verify Components Image Ready
run: |
declare -a REPOS=("odigos-autoscaler" "odigos-scheduler" "odigos-instrumentor" "odigos-odiglet" "odigos-collector" "odigos-enterprise-odiglet")
TAG_TO_CHECK=${{ steps.set_tag.outputs.tag }}
TAG_TO_CHECK=${{ env.TAG }}
for REPO in "${REPOS[@]}"; do
echo "Checking tag $TAG_TO_CHECK in $REPO..."
Expand Down Expand Up @@ -98,8 +95,7 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${{ secrets.RELEASE_BOT_TOKEN }}" \
https://api.github.com/repos/odigos-io/odigos-charts/dispatches \
-d '{"event_type": "create_release_pr", "client_payload": {"tag": "${{ steps.set_tag.outputs.tag }}"}}'
-d '{"event_type": "create_release_pr", "client_payload": {"tag": "${{ env.TAG }}"}}'
- uses: ko-build/setup-ko@v0.7

Expand All @@ -108,17 +104,17 @@ jobs:
env:
KO_DOCKER_REPO: ${{ env.DOCKERHUB_ORG }}/odigos-cli
KO_CONFIG_PATH: ./.ko.yaml
VERSION: ${{ steps.set_tag.outputs.tag }}
VERSION: ${{ env.TAG }}
SHORT_COMMIT: ${{ steps.vars.outputs.short_commit }}
DATE: ${{ steps.vars.outputs.date }}
run: |
ko build --bare --tags latest --tags ${{ steps.set_tag.outputs.tag }} --platform=all .
ko build --bare --tags latest --tags ${{ env.TAG }} --platform=all .
- name: Notify Slack End
env:
SLACK_WEBHOOK_URL: ${{ secrets.ODIGOS_RELEASE_STATUS_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos CLI released successfully. new version is ready", "tag":"${{ steps.set_tag.outputs.tag }}"}' ${{ env.SLACK_WEBHOOK_URL }}
curl -X POST -H 'Content-type: application/json' --data '{"description":"Odigos CLI released successfully. new version is ready", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Failure
if: failure()
Expand All @@ -127,4 +123,37 @@ jobs:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"link":"https://github.com/${{ env.GITHUB_REPOSITORY }}/actions/runs/${{ env.GITHUB_RUN_ID }}", "description":"ERROR: failed to publish odigos CLI", "tag":"${{ steps.set_tag.outputs.tag }}"}' ${{ env.SLACK_WEBHOOK_URL }}
curl -X POST -H 'Content-type: application/json' --data '{"link":"https://github.com/${{ env.GITHUB_REPOSITORY }}/actions/runs/${{ env.GITHUB_RUN_ID }}", "description":"ERROR: failed to publish odigos CLI", "tag":"${{ env.TAG }}"}' ${{ env.SLACK_WEBHOOK_URL }}
release-helm:
needs: [release-cli]
runs-on: ubuntu-latest
steps:
- name: Determine Tag Value
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
elif [ "${{ github.event_name }}" = "repository_dispatch" ]; then
echo "TAG=${{ github.event.client_payload.tag }}" >> $GITHUB_ENV
else
echo "Unknown event type"
exit 1
fi
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.email "bot@odigos.io"
git config --global user.name "Odigos Release Bot"
- name: Install Helm
uses: azure/setup-helm@v4.2.0
with:
version: v3.15.2

- name: Release Helm charts
run: sh ./scripts/release-charts.sh
File renamed without changes.
23 changes: 23 additions & 0 deletions helm/odigos/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
8 changes: 8 additions & 0 deletions helm/odigos/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v2
name: odigos
description: Odigos Helm Chart 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"
icon: https://d2q89wckrml3k4.cloudfront.net/logo.png
120 changes: 120 additions & 0 deletions helm/odigos/templates/odigos-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# THIS RESOURCE STILL LIVES IN odigos-io/odigos-charts repo
# ADDED HERE FOR TESTING WORKFLOWS
apiVersion: odigos.io/v1alpha1
kind: OdigosConfiguration
metadata:
name: odigos-config
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install,post-upgrade
spec:
configVersion: 1
autoscalerImage: {{ .Values.autoscaler.image.repository }}
{{- if .Values.imagePrefix }}
imagePrefix: {{ .Values.imagePrefix }}
{{- end }}
{{- if .Values.collectorGateway }}
collectorGateway:
{{- with .Values.collectorGateway.requestMemoryMiB }}
requestMemoryMiB: {{ . }}
{{- end }}
{{- with .Values.collectorGateway.memoryLimiterLimitMiB }}
memoryLimiterLimitMiB: {{ . }}
{{- end }}
{{- with .Values.collectorGateway.memoryLimiterSpikeLimitMiB }}
memoryLimiterSpikeLimitMiB: {{ . }}
{{- end }}
{{- with .Values.collectorGateway.goMemLimitMiB }}
goMemLimitMiB: {{ . }}
{{- end }}
{{- end }}
instrumentorImage: {{ .Values.instrumentor.image.repository }}
odigosVersion: {{ .Values.image.tag | default .Chart.AppVersion }}
telemetryEnabled: {{ .Values.telemetry.enabled }}
openshiftEnabled: {{ .Values.openshift.enabled }}
psp: {{ .Values.psp.enabled }}
ignoredNamespaces:
{{- toYaml .Values.ignoredNamespaces | nindent 8 }}
ignoredContainers:
{{- toYaml .Values.ignoredContainers | nindent 8 }}
{{- if .Values.onPremToken }}
defaultSDKs:
dotnet:
sdkTier: community
sdkType: native
go:
sdkTier: enterprise
sdkType: ebpf
java:
sdkTier: enterprise
sdkType: ebpf
javascript:
sdkTier: enterprise
sdkType: ebpf
python:
sdkTier: enterprise
sdkType: ebpf
mysql:
sdkTier: enterprise
sdkType: ebpf
supportedSDKs:
dotnet:
- sdkTier: community
sdkType: native
go:
- sdkTier: enterprise
sdkType: ebpf
java:
- sdkTier: community
sdkType: native
- sdkTier: enterprise
sdkType: ebpf
- sdkTier: enterprise
sdkType: native
javascript:
- sdkTier: community
sdkType: native
- sdkTier: enterprise
sdkType: ebpf
python:
- sdkTier: community
sdkType: native
- sdkTier: enterprise
sdkType: ebpf
mysql:
- sdkTier: enterprise
sdkType: ebpf
{{- else }}
defaultSDKs:
dotnet:
sdkTier: community
sdkType: native
go:
sdkTier: community
sdkType: ebpf
java:
sdkTier: community
sdkType: native
javascript:
sdkTier: community
sdkType: native
python:
sdkTier: community
sdkType: native
supportedSDKs:
dotnet:
- sdkTier: community
sdkType: native
go:
- sdkTier: community
sdkType: ebpf
java:
- sdkTier: community
sdkType: native
javascript:
- sdkTier: community
sdkType: native
python:
- sdkTier: community
sdkType: native
{{- end }}
9 changes: 9 additions & 0 deletions helm/odigos/templates/odigos-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# THIS RESOURCE STILL LIVES IN odigos-io/odigos-charts repo
# ADDED HERE FOR TESTING WORKFLOWS
apiVersion: v1
kind: ConfigMap
metadata:
name: odigos-deployment
namespace: {{ .Release.Namespace }}
data:
ODIGOS_VERSION: {{ .Values.image.tag | default .Chart.AppVersion }}
97 changes: 97 additions & 0 deletions helm/odigos/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
image:
tag: ""
imagePullSecrets: []

# namespaces not to show in odigos ui
ignoredNamespaces:
- odigos-system
- kube-system
- local-path-storage
- istio-system
- linkerd
- kube-node-lease

ignoredContainers:
- istio-proxy

collectorGateway:
# the memory request for the cluster gateway collector deployment.
# it will be embedded in the deployment as a resource request
# of the form "memory: <value>Mi".
# default value is 500Mi
requestMemoryMiB: 500
# 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.
memoryLimiterLimitMiB: 450
# 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 specified, this value will be set to 20% of the hard limit (so the soft limit will be 80% of the hard limit).
memoryLimiterSpikeLimitMiB: 90
# the GOMEMLIMIT environment variable value for the collector gateway deployment.
# this is when go runtime will start garbage collection.
# if not specified, it will be set to 80% of the hard limit of the memory limiter.
goMemLimitMiB: 340

autoscaler:
image:
repository: keyval/odigos-autoscaler
nodeSelector:
kubernetes.io/os: linux
tolerations: []
affinity: {}

scheduler:
image:
repository: keyval/odigos-scheduler
nodeSelector:
kubernetes.io/os: linux
tolerations: []
affinity: {}

ui:
image:
repository: keyval/odigos-ui
nodeSelector:
kubernetes.io/os: linux
tolerations: []
affinity: {}

instrumentor:
deleteLangDetectionPods: true
image:
repository: keyval/odigos-instrumentor
nodeSelector:
kubernetes.io/os: linux
tolerations: []
affinity: {}

odiglet:
image:
repository: keyval/odigos-odiglet
enterpriseRepository: keyval/odigos-enterprise-odiglet
nodeSelector:
kubernetes.io/os: linux
tolerations:
- effect: NoSchedule
key: node.kubernetes.io/os
operator: Equal
value: windows
affinity: {}

cli:
image:
repository: keyval/odigos-cli

# Pod Security Policy
psp:
enabled: false

telemetry:
enabled: true

openshift:
enabled: false

gke:
enabled: false
Loading

0 comments on commit 989a1ba

Please sign in to comment.