Initial submission

This commit is contained in:
2023-09-23 22:49:42 -06:00
commit 3fc058e820
19 changed files with 671 additions and 0 deletions

View File

@@ -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/

View File

@@ -0,0 +1,24 @@
apiVersion: v2
name: conversion-engine
description: A Helm chart for Kubernetes
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

View File

@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "conversion-engine.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 "conversion-engine.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 "conversion-engine.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "conversion-engine.labels" -}}
helm.sh/chart: {{ include "conversion-engine.chart" . }}
{{ include "conversion-engine.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "conversion-engine.selectorLabels" -}}
app.kubernetes.io/name: {{ include "conversion-engine.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "conversion-engine.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "conversion-engine.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.pvc.name }}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: {{ .Values.pvc.size }}
storageClassName: {{ .Values.pvc.storageClassName }}

View File

@@ -0,0 +1,72 @@
apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
name: {{ include "conversion-engine.fullname" . }}
labels:
{{- include "conversion-engine.labels" . | nindent 4 }}
spec:
failedJobsHistoryLimit: 5
jobTargetRef:
activeDeadlineSeconds: 86400
completions: 1
parallelism: 1
template:
metadata:
creationTimestamp: null
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: scaledjob.keda.sh/name
operator: In
values:
- conversion-engine-consumer
topologyKey: kubernetes.io/hostname
weight: 100
{{- if .Values.cicd.enabled }}
initContainers:
- name: init-storage
image: quay01.ipa.endofday.com/goghvideo/rockylinux:9-ubi
env:
- name: sourcefile
value: "{{ uuidv4 }}"
command: ['sh', '-c', "cd {{ .Values.mount.path }} && curl -o ${sourcefile} {{ .Values.cicd.testFile }}"]
volumeMounts:
- mountPath: "{{ .Values.mount.path }}"
name: "{{ .Values.mount.name }}"
{{- end }}
containers:
- env:
- name: amqp
valueFrom:
secretKeyRef:
key: url
name: amqp
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: Always
name: transcode-job
resources:
requests:
cpu: "4"
memory: 2Gi
volumeMounts:
- mountPath: "{{ .Values.mount.path }}"
name: "{{ .Values.mount.name }}"
volumes:
- name: "{{ .Values.volumes.name }}"
persistentVolumeClaim:
claimName: "{{ .Values.volumes.claimName }}"
maxReplicaCount: 4
pollingInterval: 60
successfulJobsHistoryLimit: 5
triggers:
- authenticationRef:
name: "{{ .Values.keda.authenticationRef }}"
metadata:
includeUnacked: "false"
queueLength: "1"
queueName: "{{ .Values.keda.queueName }}"
type: rabbitmq

View File

@@ -0,0 +1,10 @@
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
name: "{{ .Values.keda.authenticationRef }}"
namespace: "{{ .Release.Namespace }}"
spec:
secretTargetRef:
- key: "{{ .Values.keda.triggerSecretKey }}"
name: "{{ .Values.keda.triggerSecretRef }}"
parameter: host

View File

@@ -0,0 +1,62 @@
# Default values for conversion-engine.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
image:
repository: quay01.ipa.endofday.com/goghvideo/conversion-engine
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v0.1.119"
cicd:
enabled: true
testFile: https://nextcloud.endofday.com/s/cxDfPwgbnwDacNY/download/DNx220x_1080i_2997.mxf
# testFile: https://nextcloud.endofday.com/s/YkKspDt6T8pLjST/download/10mintestfile.mxf
mount:
path: /conversion
name: pvc-conversion
volumes:
name: pvc-conversion
claimName: pvc-conversion
keda:
authenticationRef: rabbitmq-consumer-trigger
queueName: transcode
triggerSecretKey: url
triggerSecretRef: amqp
pvc:
name: pvc-conversion
storageClassName: govideo-nfs-client
size: 5Gi
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""
podAnnotations: {}
podSecurityContext: {}
# fsGroup: 2000
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi