Skip to content

Commit

Permalink
feat(charts): sablier helm chart for kube deployement
Browse files Browse the repository at this point in the history
Closed: #271
  • Loading branch information
DrummyFloyd committed Apr 10, 2024
1 parent dda8cae commit 62c0aa5
Show file tree
Hide file tree
Showing 14 changed files with 664 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/configs/ct-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
remote: origin
target-branch: main
chart-dirs:
- charts
check-version-increment: false
validate-maintainers: false
exclude-deprecated: true
excluded-charts: []
72 changes: 72 additions & 0 deletions .github/workflows/chart-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
name: "Lint and Test Chart"

on:
push:
branches:
- main
pull_request:

jobs:
linter-artifacthub:
runs-on: ubuntu-latest
container:
image: public.ecr.aws/artifacthub/ah:v1.14.0
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run ah lint
working-directory: ./charts
run: ah lint

lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Run helm unittest
uses: d3adb5/helm-unittest-action@v2
with:
github-token: ${{ secrets.GH_TOKEN }}
charts: charts/sablier

- name: Setup Chart Linting
id: lint
uses: helm/chart-testing-action@v2

- name: List changed charts
id: list-changed
run: |
changed=$(ct --config ./.github/configs/ct-lint.yaml list-changed)
charts=$(echo "$changed" | tr '\n' ' ' | xargs)
if [[ -n "$changed" ]]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "changed_charts=$charts" >> $GITHUB_OUTPUT
fi
- name: Run chart-testing (lint)
run: ct lint --debug --config ./.github/configs/ct-lint.yaml

- name: Run docs-testing (helm-docs)
id: helm-docs
run: |
./scripts/helm-docs.sh
if [[ $(git diff --stat) != '' ]]; then
echo -e '\033[0;31mDocumentation outdated!\033[0m ❌'
git diff --color
exit 1
else
echo -e '\033[0;32mDocumentation up to date\033[0m ✔'
fi
57 changes: 57 additions & 0 deletions .github/workflows/chart-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release Charts

on:
push:
branches:
- main
workflow_call:

permissions:
contents: write
packages: write

jobs:
release:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Git
run: |
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Set up Helm
uses: azure/setup-helm@v4

- id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}

- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: ${{ steps.generate_token.outputs.token }}
CR_SKIP_EXISTING: "true"
CR_GENERATE_RELEASE_NOTES: "true"

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push Charts to GHCR
run: |
for pkg in .cr-release-packages/*; do
if [ -z "${pkg:-}" ]; then
break
fi
helm push "${pkg}" oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/helm-charts
done
14 changes: 14 additions & 0 deletions charts/sablier/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: sablier
description: An free and open-source software to start workloads on demand and stop them after a period of inactivity.
type: application
version: "0.1.0"
appVersion: 1.6.0
deprecated: false
sources:
- "https://github.com/acouvreur/sablier"
keywords:
- Orchestration & Management
maintainers:
- email: TODO
name: TODO
34 changes: 34 additions & 0 deletions charts/sablier/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# sablier

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.6.0](https://img.shields.io/badge/AppVersion-1.6.0-informational?style=flat-square)

An free and open-source software to start workloads on demand and stop them after a period of inactivity.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| TODO | <TODO> | |

## Source Code

* <https://github.com/acouvreur/sablier>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| deploymentAnnotations | object | `{}` | Annotations for all deployed Deployments |
| deploymentLabels | object | `{}` | Labels for all deployed Deployments |
| deploymentStrategy | object | `{"rollingUpdate":{"maxSurge":"25%","maxUnavailable":"25%"},"type":"RollingUpdate"}` | Deployment strategy for all deployed Deployments |
| image.repository | string | `"acouvreur/sablier"` | Sablier image repository |
| image.tag | string | `""` | Sablier image tag (deafult) appVersion |
| imagePullPolicy | string | `"IfNotPresent"` | Sablier imagePullPolicy |
| livenessProbe | object | `{"failureThreshold":3,"httpGet":{"path":"/healthz","port":10000},"initialDelaySeconds":5,"periodSeconds":5,"successThreshold":1,"timeoutSeconds":1}` | Sablier livenessProbe |
| logLevel | string | `"trace"` | Sablier log level |
| podAnnotations | object | `{}` | Annotations for all deployed pods |
| podLabels | object | `{}` | Labels for all deployed pods |
| readinessProbe | object | `{"failureThreshold":3,"httpGet":{"path":"/healthz","port":10000},"initialDelaySeconds":5,"periodSeconds":5,"successThreshold":1,"timeoutSeconds":1}` | Sablier readinessProbe |
| replicas | int | `1` | Sablier's replicas |
| resources | object | `{}` | Resource limits and requests for sablier |

53 changes: 53 additions & 0 deletions charts/sablier/templates/deployement.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: sablier-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
app: sablier-{{ .Release.Name }}
{{- with .Values.deploymentLabels }}
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{ toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicas }}
{{- with .Values.deploymentStrategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
app: sablier-{{ .Release.Name }}
template:
metadata:
labels:
app: sablier-{{ .Release.Name }}
{{- with .Values.podLabels }}
{{ toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.podAnnotations }}
annotations:
{{ toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: sablier-{{ .Release.Name }}
containers:
- name: sablier
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
imagePullPolicy: IfNotPresent
args: ["start", "--provider.name=kubernetes", "--logging.level={{ .Values.logLevel}}"]
ports:
- containerPort: 10000
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
33 changes: 33 additions & 0 deletions charts/sablier/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: sablier-{{ .Release.Name }}
rules:
- apiGroups:
- apps
- ""
resources:
- deployments
- deployments/scale
- statefulsets
- statefulsets/scale
verbs:
- patch # Scale up and down
- get # Retrieve info about specific dep
- update # Scale up and down
- list # Events
- watch # Events
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: sablier-{{ .Release.Name }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: sablier-{{ .Release.Name }}
subjects:
- kind: ServiceAccount
name: sablier
namespace: {{ .Release.Namespace }}
6 changes: 6 additions & 0 deletions charts/sablier/templates/sa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: sablier-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
13 changes: 13 additions & 0 deletions charts/sablier/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: sablier-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
spec:
selector:
app: sablier-{{ .Release.Name }}
ports:
- protocol: TCP
port: 10000
targetPort: 10000
Loading

0 comments on commit 62c0aa5

Please sign in to comment.