From c5fe5dcf45cffcf712aa3265c7b9af4369cb1815 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 4 Oct 2024 17:39:29 +0200 Subject: [PATCH 01/11] frigate --- .pre-commit-config.yaml | 3 ++- kbatch/README.md | 52 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6f03eec..9631a31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,7 @@ repos: - repo: https://github.com/rapidsai/frigate/ - rev: v0.4.0 # pre-commit autoupdate - to keep the version up to date + # need a release after https://github.com/rapidsai/frigate/pull/74 + rev: 0aca194f9011a656fd7211dbe2210511c94a36a5 hooks: - id: frigate - repo: https://github.com/gruntwork-io/pre-commit diff --git a/kbatch/README.md b/kbatch/README.md index e69de29..ab554d4 100644 --- a/kbatch/README.md +++ b/kbatch/README.md @@ -0,0 +1,52 @@ + +Kbatch-proxy +=========== + +A Helm chart for kbatch-proxy + + +## Configuration + +The following table lists the configurable parameters of the Kbatch-proxy chart and their default values. + +| Parameter | Description | Default | +| ------------------------ | ----------------------- | -------------- | +| `replicaCount` | | `1` | +| `app.jupyterhub_api_url` | | `""` | +| `app.jupyterhub_api_token` | | `""` | +| `app.jupyterhub_service_prefix` | | `""` | +| `app.extra_env` | | `{}` | +| `app.extraFiles` | | `{}` | +| `image.repository` | | `"ghcr.io/kbatch-dev/k8s-kbatch-proxy"` | +| `image.pullPolicy` | | `"IfNotPresent"` | +| `image.tag` | | `"set-by-chartpress"` | +| `imagePullSecrets` | | `[]` | +| `nameOverride` | | `""` | +| `fullnameOverride` | | `""` | +| `serviceAccount.create` | | `true` | +| `serviceAccount.annotations` | | `{}` | +| `serviceAccount.name` | | `""` | +| `podAnnotations` | | `{}` | +| `extraPodLabels` | | `{}` | +| `podSecurityContext` | | `{}` | +| `securityContext` | | `{}` | +| `service.type` | | `"ClusterIP"` | +| `service.port` | | `80` | +| `ingress.enabled` | | `false` | +| `ingress.className` | | `""` | +| `ingress.annotations` | | `{}` | +| `ingress.hosts` | | `[{"host": "chart-example.local", "paths": [{"path": "/", "pathType": "ImplementationSpecific"}]}]` | +| `ingress.tls` | | `[]` | +| `resources` | | `{}` | +| `autoscaling.enabled` | | `false` | +| `autoscaling.minReplicas` | | `1` | +| `autoscaling.maxReplicas` | | `100` | +| `autoscaling.targetCPUUtilizationPercentage` | | `80` | +| `nodeSelector` | | `{}` | +| `tolerations` | | `[]` | +| `affinity` | | `{}` | + + + +--- +_Documentation generated by [Frigate](https://frigate.readthedocs.io)._ From 6d428408acfab95b25260d2f8160bae474ef9ec4 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 4 Oct 2024 17:39:32 +0200 Subject: [PATCH 02/11] add chartpress for publishing --- .github/workflows/publish-charts.yml | 67 +++++++++++++++++++++++++--- .pre-commit-config.yaml | 6 ++- README.md | 1 + chartpress.yaml | 14 ++++++ images/kbatch-proxy/Dockerfile | 4 ++ kbatch/values.yaml | 4 +- 6 files changed, 87 insertions(+), 9 deletions(-) create mode 100644 chartpress.yaml create mode 100644 images/kbatch-proxy/Dockerfile diff --git a/.github/workflows/publish-charts.yml b/.github/workflows/publish-charts.yml index 59d9fb2..0c384eb 100644 --- a/.github/workflows/publish-charts.yml +++ b/.github/workflows/publish-charts.yml @@ -9,29 +9,84 @@ name: Publish charts on: push: tags: ["*"] + branches: + - main + pull_request: workflow_dispatch: defaults: run: shell: bash + env: + CHARTPRESS_ARGS: > + --builder docker-buildx + --platform linux/amd64 + --platform linux/arm64 jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + # chartpress requires git history to set chart version and image tags + # correctly + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Decide to publish or not + id: publishing + shell: python + run: | + import os + repo = "${{ github.repository }}" + event = "${{ github.event_name }}" + ref = "${{ github.event.ref }}" + publishing = "" + if ( + and event == "push" + and ( + ref.startswith("refs/tags/") + or ref == "refs/heads/main" + ) + ): + publishing = "true" + print("Publishing chart") + with open(os.environ["GITHUB_OUTPUT"], "a") as f: + f.write(f"publishing={publishing}\n") + + - name: Set up QEMU (for docker buildx) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx (for chartpress multi-arch builds) + uses: docker/setup-buildx-action@v3 + + - name: Install chart publishing dependencies (chartpress, helm) + run: | + pip install chartpress + pip list + + helm version + + - name: Enable chartpress publishing + if: steps.publishing.outputs.publishing + run: + echo CHARTPRESS_ARGS="${CHARTPRESS_ARGS} --push" >> $GITHUB_ENV + - - name: Get the version - id: get_version + - name: build chart with chartpress run: | - echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV + chartpress $CHARTPRESS_ARGS - name: Publish Helm charts + if: steps.publishing.outputs.publishing uses: stefanprodan/helm-gh-pages@master with: token: ${{ secrets.GITHUB_TOKEN }} charts_dir: "." charts_url: https://kbatch-dev.github.io/helm-chart linting: "off" - chart_version: ${{ env.VERSION }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9631a31..b70c444 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,6 +5,10 @@ repos: hooks: - id: frigate - repo: https://github.com/gruntwork-io/pre-commit - rev: v0.1.12 # pre-commit autoupdate - to keep the version up to date + rev: v0.1.23 # pre-commit autoupdate - to keep the version up to date hooks: - id: helmlint + - repo: https://github.com/jupyterhub/chartpress + rev: 2.2.0 + hooks: + - id: chartpress diff --git a/README.md b/README.md index e69de29..d52ea7e 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +poke diff --git a/chartpress.yaml b/chartpress.yaml new file mode 100644 index 0000000..c4009f5 --- /dev/null +++ b/chartpress.yaml @@ -0,0 +1,14 @@ +charts: + - name: kbatch + baseVersion: "0.5.0" + imagePrefix: ghcr.io/kbatch-dev/k8s- + repo: + git: kbatch-dev/helm-chart + published: https://kbatch-dev.github.io/helm-chart + images: + kbatch-proxy: + valuesPath: image + buildArgs: + # keep in sync with appVersion in Chart.yaml + kbatch_version: "0.4.2" + diff --git a/images/kbatch-proxy/Dockerfile b/images/kbatch-proxy/Dockerfile new file mode 100644 index 0000000..8c497b7 --- /dev/null +++ b/images/kbatch-proxy/Dockerfile @@ -0,0 +1,4 @@ +ARG kbatch_version=set-by-chartress +# for now, just retagging the image to match the chart +# but this could be where we translate config from helm +FROM ghcr.io/kbatch-dev/kbatch-proxy:${kbatch_version} diff --git a/kbatch/values.yaml b/kbatch/values.yaml index 25a7404..298e081 100644 --- a/kbatch/values.yaml +++ b/kbatch/values.yaml @@ -8,9 +8,9 @@ app: extraFiles: {} image: - repository: ghcr.io/kbatch-dev/kbatch-proxy + repository: ghcr.io/kbatch-dev/k8s-kbatch-proxy pullPolicy: IfNotPresent - tag: "" + tag: "set-by-chartpress" imagePullSecrets: [] nameOverride: "" From 2206a391489fbafded6a5947ffcfdaa5f5e14800 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 4 Oct 2024 17:53:55 +0200 Subject: [PATCH 03/11] fix env --- .github/workflows/publish-charts.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-charts.yml b/.github/workflows/publish-charts.yml index 0c384eb..a91be41 100644 --- a/.github/workflows/publish-charts.yml +++ b/.github/workflows/publish-charts.yml @@ -17,11 +17,12 @@ on: defaults: run: shell: bash - env: - CHARTPRESS_ARGS: > - --builder docker-buildx - --platform linux/amd64 - --platform linux/arm64 + +env: + CHARTPRESS_ARGS: > + --builder docker-buildx + --platform linux/amd64 + --platform linux/arm64 jobs: build: From 640daeb7d8de753240bc57dc66b3461c7a515eea Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 4 Oct 2024 17:55:37 +0200 Subject: [PATCH 04/11] typo --- .github/workflows/publish-charts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-charts.yml b/.github/workflows/publish-charts.yml index a91be41..26d9fac 100644 --- a/.github/workflows/publish-charts.yml +++ b/.github/workflows/publish-charts.yml @@ -49,7 +49,7 @@ jobs: ref = "${{ github.event.ref }}" publishing = "" if ( - and event == "push" + event == "push" and ( ref.startswith("refs/tags/") or ref == "refs/heads/main" From 39c8fcda193bac6e6fc5652841ecee6e4ce17ce1 Mon Sep 17 00:00:00 2001 From: Min RK Date: Sat, 5 Oct 2024 17:45:54 +0200 Subject: [PATCH 05/11] need chartpress to render chart for tests --- .github/workflows/test-kbatch-chart.yaml | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-kbatch-chart.yaml b/.github/workflows/test-kbatch-chart.yaml index 4ed1300..3162035 100644 --- a/.github/workflows/test-kbatch-chart.yaml +++ b/.github/workflows/test-kbatch-chart.yaml @@ -20,7 +20,7 @@ defaults: jobs: test-install-chart: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 strategy: # Keep running even if one variation of the job fail @@ -34,13 +34,32 @@ jobs: # k3s-channel: https://update.k3s.io/v1-release/channels include: - k3s-channel: v1.19 - - k3s-channel: v1.16 + - k3s-channel: v1.23 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + with: + # chartpress requires git history to set chart version and image tags + # correctly + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + cache: pip + + - name: Install chartpress + run: + pip install chartpress + pip freeze + - name: Install helm run: | curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash + + - name: Render chartpress + run: | + chartpress - name: Lint chart's templates run: | From 86e00893d0f652771b6ca05cce4229ac772a5cd9 Mon Sep 17 00:00:00 2001 From: Min RK Date: Sat, 5 Oct 2024 17:50:54 +0200 Subject: [PATCH 06/11] install chartpress via requirements.txt --- .github/workflows/publish-charts.yml | 4 ++-- .github/workflows/test-kbatch-chart.yaml | 6 +++--- requirements.txt | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 requirements.txt diff --git a/.github/workflows/publish-charts.yml b/.github/workflows/publish-charts.yml index 26d9fac..659f2ff 100644 --- a/.github/workflows/publish-charts.yml +++ b/.github/workflows/publish-charts.yml @@ -66,9 +66,9 @@ jobs: - name: Set up Docker Buildx (for chartpress multi-arch builds) uses: docker/setup-buildx-action@v3 - - name: Install chart publishing dependencies (chartpress, helm) + - name: Install chart publishing dependencies (chartpress) run: | - pip install chartpress + pip install -r requirements.txt pip list helm version diff --git a/.github/workflows/test-kbatch-chart.yaml b/.github/workflows/test-kbatch-chart.yaml index 3162035..161a391 100644 --- a/.github/workflows/test-kbatch-chart.yaml +++ b/.github/workflows/test-kbatch-chart.yaml @@ -48,9 +48,9 @@ jobs: python-version: "3.11" cache: pip - - name: Install chartpress - run: - pip install chartpress + - name: Install dependencies + run: | + pip install -r requirements.txt pip freeze - name: Install helm diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f76e616 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +chartpress From a5f06e6a6b6d82b596f8558dad5ea68f6c35c7e4 Mon Sep 17 00:00:00 2001 From: Min RK Date: Sat, 5 Oct 2024 17:54:00 +0200 Subject: [PATCH 07/11] link to frigate readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 120000 README.md diff --git a/README.md b/README.md deleted file mode 100644 index d52ea7e..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -poke diff --git a/README.md b/README.md new file mode 120000 index 0000000..1ffef23 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +kbatch/README.md \ No newline at end of file From ad7d8031d5aa419080f1d32151588eef276a03f7 Mon Sep 17 00:00:00 2001 From: Min RK Date: Sat, 5 Oct 2024 17:56:09 +0200 Subject: [PATCH 08/11] update k3s action --- .github/workflows/test-kbatch-chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kbatch-chart.yaml b/.github/workflows/test-kbatch-chart.yaml index 161a391..2822f1f 100644 --- a/.github/workflows/test-kbatch-chart.yaml +++ b/.github/workflows/test-kbatch-chart.yaml @@ -72,7 +72,7 @@ jobs: # Starts a k8s cluster with NetworkPolicy enforcement and installs kubectl # # ref: https://github.com/jupyterhub/action-k3s-helm/ - - uses: jupyterhub/action-k3s-helm@v1 + - uses: jupyterhub/action-k3s-helm@v4 with: k3s-channel: ${{ matrix.k3s-channel }} metrics-enabled: false From 26c71235505f7fddf9ba325981a91739ef622aab Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 7 Oct 2024 08:17:57 +0200 Subject: [PATCH 09/11] bump oldest kubernetes to 1.20 --- .github/workflows/test-kbatch-chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-kbatch-chart.yaml b/.github/workflows/test-kbatch-chart.yaml index 2822f1f..3d6d460 100644 --- a/.github/workflows/test-kbatch-chart.yaml +++ b/.github/workflows/test-kbatch-chart.yaml @@ -33,7 +33,7 @@ jobs: # k3s-version: https://github.com/rancher/k3s/tags # k3s-channel: https://update.k3s.io/v1-release/channels include: - - k3s-channel: v1.19 + - k3s-channel: v1.20 - k3s-channel: v1.23 steps: From ae56ba8c1a4268f2d47adfcf8f2de4a6121fa2f4 Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 7 Oct 2024 08:20:32 +0200 Subject: [PATCH 10/11] maybe docker-enabled will get access to the image --- .github/workflows/test-kbatch-chart.yaml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-kbatch-chart.yaml b/.github/workflows/test-kbatch-chart.yaml index 3d6d460..236d69a 100644 --- a/.github/workflows/test-kbatch-chart.yaml +++ b/.github/workflows/test-kbatch-chart.yaml @@ -53,22 +53,10 @@ jobs: pip install -r requirements.txt pip freeze - - name: Install helm - run: | - curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash - - name: Render chartpress run: | chartpress - - name: Lint chart's templates - run: | - helm lint ./kbatch --strict --values kbatch/values.yaml - - - name: Validate chart's templates can render - run: | - helm template ./kbatch --values kbatch/values.yaml 1>/dev/null - # Starts a k8s cluster with NetworkPolicy enforcement and installs kubectl # # ref: https://github.com/jupyterhub/action-k3s-helm/ @@ -77,7 +65,11 @@ jobs: k3s-channel: ${{ matrix.k3s-channel }} metrics-enabled: false traefik-enabled: false - docker-enabled: false + docker-enabled: true + + - name: Lint chart's templates + run: | + helm lint ./kbatch --strict --values kbatch/values.yaml - name: Validate charts' rendered templates are valid k8s resources run: | From 4523cdbd1fe5b8164d0261e8766b859c63a292af Mon Sep 17 00:00:00 2001 From: Min RK Date: Mon, 7 Oct 2024 08:24:08 +0200 Subject: [PATCH 11/11] kubernetes 1.27 reached end-of-life --- .github/workflows/test-kbatch-chart.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-kbatch-chart.yaml b/.github/workflows/test-kbatch-chart.yaml index 236d69a..398fc35 100644 --- a/.github/workflows/test-kbatch-chart.yaml +++ b/.github/workflows/test-kbatch-chart.yaml @@ -33,8 +33,8 @@ jobs: # k3s-version: https://github.com/rancher/k3s/tags # k3s-channel: https://update.k3s.io/v1-release/channels include: - - k3s-channel: v1.20 - - k3s-channel: v1.23 + - k3s-channel: v1.28 + - k3s-channel: v1.31 steps: - uses: actions/checkout@v4 @@ -65,6 +65,7 @@ jobs: k3s-channel: ${{ matrix.k3s-channel }} metrics-enabled: false traefik-enabled: false + # docker-enabled required to access images built in chartpress stage docker-enabled: true - name: Lint chart's templates