From 9054963452b1c3b2090cb6abf8c3ae70cb3e96ec Mon Sep 17 00:00:00 2001 From: Martyn Date: Sun, 26 Nov 2023 13:24:48 +0000 Subject: [PATCH] hyperion --- apps-helm/hyperion/.helmignore | 23 ++++++++ apps-helm/hyperion/Chart.yaml | 21 +++++++ apps-helm/hyperion/templates/_helpers.tpl | 62 ++++++++++++++++++++ apps-helm/hyperion/templates/claim.yaml | 15 +++++ apps-helm/hyperion/templates/data.yaml | 17 ++++++ apps-helm/hyperion/templates/deployment.yaml | 52 ++++++++++++++++ apps-helm/hyperion/templates/svc.yaml | 29 +++++++++ apps-helm/hyperion/values.yaml | 13 ++++ everything-app/hyperion.yaml | 20 +++++++ 9 files changed, 252 insertions(+) create mode 100755 apps-helm/hyperion/.helmignore create mode 100755 apps-helm/hyperion/Chart.yaml create mode 100755 apps-helm/hyperion/templates/_helpers.tpl create mode 100644 apps-helm/hyperion/templates/claim.yaml create mode 100644 apps-helm/hyperion/templates/data.yaml create mode 100644 apps-helm/hyperion/templates/deployment.yaml create mode 100644 apps-helm/hyperion/templates/svc.yaml create mode 100644 apps-helm/hyperion/values.yaml create mode 100644 everything-app/hyperion.yaml diff --git a/apps-helm/hyperion/.helmignore b/apps-helm/hyperion/.helmignore new file mode 100755 index 0000000..0e8a0eb --- /dev/null +++ b/apps-helm/hyperion/.helmignore @@ -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/ diff --git a/apps-helm/hyperion/Chart.yaml b/apps-helm/hyperion/Chart.yaml new file mode 100755 index 0000000..0be4f78 --- /dev/null +++ b/apps-helm/hyperion/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: hyperion +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: "0.1.0" diff --git a/apps-helm/hyperion/templates/_helpers.tpl b/apps-helm/hyperion/templates/_helpers.tpl new file mode 100755 index 0000000..70ca1fa --- /dev/null +++ b/apps-helm/hyperion/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "hyperion.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 "hyperion.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 "hyperion.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "hyperion.labels" -}} +helm.sh/chart: {{ include "hyperion.chart" . }} +{{ include "hyperion.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "hyperion.selectorLabels" -}} +app.kubernetes.io/name: {{ include "hyperion.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "hyperion.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "hyperion.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/apps-helm/hyperion/templates/claim.yaml b/apps-helm/hyperion/templates/claim.yaml new file mode 100644 index 0000000..3ac0439 --- /dev/null +++ b/apps-helm/hyperion/templates/claim.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "hyperion.fullname" . }}-claim + labels: + app: hyperion + {{- include "hyperion.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.pvc.claim.storageRequest | quote }} + storageClassName: {{ .Values.pvc.claim.storageClass | quote }} + volumeMode: Filesystem \ No newline at end of file diff --git a/apps-helm/hyperion/templates/data.yaml b/apps-helm/hyperion/templates/data.yaml new file mode 100644 index 0000000..595051d --- /dev/null +++ b/apps-helm/hyperion/templates/data.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ include "hyperion.fullname" . }}-data + labels: + {{- include "hyperion.labels" . | nindent 4 }} +spec: + accessModes: + - ReadWriteOnce + capacity: + storage: 100Mi + hostPath: + path: /home/hyperion + type: DirectoryOrCreate + persistentVolumeReclaimPolicy: Delete + storageClassName: local + volumeMode: Filesystem \ No newline at end of file diff --git a/apps-helm/hyperion/templates/deployment.yaml b/apps-helm/hyperion/templates/deployment.yaml new file mode 100644 index 0000000..a2f7f10 --- /dev/null +++ b/apps-helm/hyperion/templates/deployment.yaml @@ -0,0 +1,52 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "hyperion.fullname" . }}-hyperion + labels: + app: hyperion + {{- include "hyperion.labels" . | nindent 4 }} +spec: + replicas: {{ .Values.hyperion.replicas }} + selector: + matchLabels: + app: hyperion + {{- include "hyperion.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + app: hyperion + {{- include "hyperion.selectorLabels" . | nindent 8 }} + spec: + containers: + - command: + - /usr/bin/hyperiond + - --userdata + - /root/.hyperion + env: + - name: KUBERNETES_CLUSTER_DOMAIN + value: {{ .Values.kubernetesClusterDomain }} + image: {{ .Values.hyperion.hyperion.image.repository }}:{{ .Values.hyperion.hyperion.image.tag + | default .Chart.AppVersion }} + imagePullPolicy: IfNotPresent + name: hyperion + ports: + - containerPort: 19445 + hostPort: 19445 + protocol: TCP + - containerPort: 19444 + hostPort: 19444 + protocol: TCP + - containerPort: 8090 + hostPort: 8090 + protocol: TCP + resources: {} + volumeMounts: + - mountPath: /root/.hyperion + name: data + dnsPolicy: ClusterFirst + hostNetwork: true + restartPolicy: Always + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ include "hyperion.fullname" . }}-claim diff --git a/apps-helm/hyperion/templates/svc.yaml b/apps-helm/hyperion/templates/svc.yaml new file mode 100644 index 0000000..d188d3f --- /dev/null +++ b/apps-helm/hyperion/templates/svc.yaml @@ -0,0 +1,29 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + app: hyperion + {{- include "hyperion.labels" . | nindent 4 }} + name: hyperion + namespace: hyperion +spec: + internalTrafficPolicy: Cluster + ports: + - name: web + nodePort: 30419 + port: 80 + targetPort: 8090 + - name: json + nodePort: 31201 + port: 19444 + - name: flatbuffers + nodePort: 31448 + port: 19400 + - name: protobuf + nodePort: 32039 + port: 19445 + selector: + app: hyperion + app.kubernetes.io/instance: hyperion + app.kubernetes.io/name: hyperion + type: {{ .Values.service.type }} diff --git a/apps-helm/hyperion/values.yaml b/apps-helm/hyperion/values.yaml new file mode 100644 index 0000000..5fdb674 --- /dev/null +++ b/apps-helm/hyperion/values.yaml @@ -0,0 +1,13 @@ +hyperion: + hyperion: + image: + repository: sirfragalot/hyperion.ng + tag: 2.0.15 + replicas: 1 +kubernetesClusterDomain: cluster.local +pvc: + claim: + storageClass: local + storageRequest: 100Mi +service: + type: LoadBalancer \ No newline at end of file diff --git a/everything-app/hyperion.yaml b/everything-app/hyperion.yaml new file mode 100644 index 0000000..dbf7653 --- /dev/null +++ b/everything-app/hyperion.yaml @@ -0,0 +1,20 @@ +apiVersion: argoproj.io/v1alpha1 +kind: Application +metadata: + name: hyperion + namespace: argocd +spec: + destination: + namespace: hyperion + server: https://kubernetes.default.svc + project: apps + source: + helm: + parameters: + - name: hyperion.hyperion.image.tag + value: 2.0.15 + - name: pvc.claim.storageClass + value: local-path-fast + path: helm/hyperion + repoURL: https://git.martyn.berlin/martyn/infra4talos.git + targetRevision: HEAD