Skip to content

Commit

Permalink
add the initial chart
Browse files Browse the repository at this point in the history
  • Loading branch information
baxtree committed Sep 26, 2023
1 parent 634f1d9 commit 780c0f8
Show file tree
Hide file tree
Showing 11 changed files with 256 additions and 15 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,10 @@ jobs:
platforms: linux/amd64,linux/arm64
allow: network.host
github-token: ${{ github.token }}
tags: baxtree/subaligner:latest
push: true

- name: Build and push the Ubuntu 20 image
id: docker_build_u20
uses: docker/build-push-action@v4
with:
context: ./docker
file: "./docker/Dockerfile-Ubuntu20"
build-args: |
"RELEASE_VERSION=${{ steps.tag.outputs.TAG }}"
platforms: linux/amd64,linux/arm64
allow: network.host
github-token: ${{ github.token }}
tags: baxtree/subaligner:${{ steps.tag.outputs.TAG }}.u20
tags: |
baxtree/subaligner:latest
baxtree/subaligner:${{ steps.tag.outputs.TAG }}
baxtree/subaligner:${{ steps.tag.outputs.TAG }}.u20
push: true

- name: Build and push the Ubuntu 22 image
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/lint-charts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint Helm charts

on:
push:
paths:
- "charts/**"

workflow_dispatch:

env:
HELM_VERSION: 3.11.2

jobs:
lint-helm-charts:
runs-on: ubuntu-20.04

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Setup Helm
uses: mamezou-tech/setup-helmfile@v1.2.0
with:
helm-version: "v${{ env.HELM_VERSION }}"

- name: Lint Helm Charts
run: |
helm lint charts/*
working-directory: ${{ github.workspace }}
23 changes: 23 additions & 0 deletions charts/subaligner/.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/
7 changes: 7 additions & 0 deletions charts/subaligner/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: subaligner
description: A Helm chart for subaligner CLIs
icon: https://raw.githubusercontent.com/baxtree/subaligner/master/figures/subaligner.png
type: application
version: 0.1.0
appVersion: "0.3.6"
1 change: 1 addition & 0 deletions charts/subaligner/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ .Release.Name }} is deployed to {{ .Release.Namespace }} namespace.
62 changes: 62 additions & 0 deletions charts/subaligner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "subaligner.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "subaligner.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "subaligner.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "subaligner.labels" -}}
helm.sh/chart: {{ include "subaligner.chart" . }}
{{ include "subaligner.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "subaligner.selectorLabels" -}}
app.kubernetes.io/name: {{ include "subaligner.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "subaligner.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "subaligner.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/subaligner/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "subaligner.fullname" . }}
labels:
{{- include "subaligner.labels" . | nindent 4 }}
data:
70 changes: 70 additions & 0 deletions charts/subaligner/templates/job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{.Release.Name}}-{{ randAlphaNum 5 | lower }}
labels:
{{- include "subaligner.labels" . | nindent 4 }}
spec:
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "subaligner.selectorLabels" . | nindent 8 }}
spec:
restartPolicy: Never
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "subaligner.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
command: ['/usr/local/bin/subaligner_batch', '-m', '{{ .Values.alignmentMode }}', '-vd', '/subaligner-media/videos', '-sd', '/subaligner-media/subtitles', '-od', '/subaligner-media/output']
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: videos
mountPath: /subaligner-media/videos
- name: subtitles
mountPath: /subaligner-media/subtitles
- name: output
mountPath: /subaligner-media/output
resources:
{{- toYaml .Values.resources | nindent 12 }}
envFrom:
- secretRef:
name: {{ include "subaligner.fullname" . }}
- configMapRef:
name: {{ include "subaligner.fullname" . }}
volumes:
- name: videos
hostPath:
path: {{ .Values.pathToTheVideoDirectory }}
type: Directory
- name: subtitles
hostPath:
path: {{ .Values.pathToTheSubtitleDirectory }}
type: Directory
- name: output
hostPath:
path: {{ .Values.pathToTheOutputDirectory }}
type: Directory
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/subaligner/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ include "subaligner.fullname" . }}
labels:
{{- include "subaligner.labels" . | nindent 4 }}
data:
12 changes: 12 additions & 0 deletions charts/subaligner/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "subaligner.serviceAccountName" . }}
labels:
{{- include "subaligner.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
34 changes: 34 additions & 0 deletions charts/subaligner/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
replicaCount: 1

image:
repository: baxtree/subaligner
pullPolicy: IfNotPresent
tag: ""

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

serviceAccount:
create: true
annotations: {}
name: ""

podAnnotations: {}

podSecurityContext: {}

securityContext: {}

resources: {}

nodeSelector: {}

tolerations: []

affinity: {}

alignmentMode: "dual"
pathToTheVideoDirectory: ""
pathToTheSubtitleDirectory: ""
pathToTheOutputDirectory: ""

0 comments on commit 780c0f8

Please sign in to comment.