Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 62 additions & 6 deletions .github/workflows/publish-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,85 @@ 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 (
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)
run: |
pip install -r requirements.txt
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 }}
38 changes: 25 additions & 13 deletions .github/workflows/test-kbatch-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,32 +33,44 @@ 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.16
- k3s-channel: v1.28
- k3s-channel: v1.31

steps:
- uses: actions/checkout@v2
- name: Install helm
run: |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash
- uses: actions/checkout@v4
with:
# chartpress requires git history to set chart version and image tags
# correctly
fetch-depth: 0

- name: Lint chart's templates
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip

- name: Install dependencies
run: |
helm lint ./kbatch --strict --values kbatch/values.yaml
pip install -r requirements.txt
pip freeze

- name: Validate chart's templates can render
- name: Render chartpress
run: |
helm template ./kbatch --values kbatch/values.yaml 1>/dev/null
chartpress

# 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
traefik-enabled: false
docker-enabled: false
# docker-enabled required to access images built in chartpress stage
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: |
Expand Down
9 changes: 7 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
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
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
Empty file removed README.md
Empty file.
1 change: 1 addition & 0 deletions README.md
14 changes: 14 additions & 0 deletions chartpress.yaml
Original file line number Diff line number Diff line change
@@ -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"

4 changes: 4 additions & 0 deletions images/kbatch-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -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}
52 changes: 52 additions & 0 deletions kbatch/README.md
Original file line number Diff line number Diff line change
@@ -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)._
4 changes: 2 additions & 2 deletions kbatch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chartpress