commit ab1587ed13d92d194e9ff7536be04a298f6a15bb Author: DevMiner Date: Sun Aug 25 23:59:52 2024 +0200 chore: add files diff --git a/chart/.helmignore b/chart/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/chart/.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/chart/Chart.lock b/chart/Chart.lock new file mode 100644 index 0000000..8f09b1e --- /dev/null +++ b/chart/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: nats + repository: https://nats-io.github.io/k8s/helm/charts/ + version: 1.2.2 +- name: versia_go + repository: file://../versia + version: 0.1.0 +digest: sha256:b44a0f4359140bf676876ebc26549491314a2c83b4cd5e8bbb7080866a760010 +generated: "2024-08-28T00:58:12.087020501+02:00" diff --git a/chart/Chart.yaml b/chart/Chart.yaml new file mode 100644 index 0000000..875090e --- /dev/null +++ b/chart/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +type: application +name: versia-go-run +description: Versia Go runtime +version: 0.1.0 +appVersion: "0.0.1" + +dependencies: + - name: nats + version: 1.2.2 + repository: https://nats-io.github.io/k8s/helm/charts/ + - name: versia_go + version: 0.1.0 + repository: file://../versia \ No newline at end of file diff --git a/chart/charts/nats-1.2.2.tgz b/chart/charts/nats-1.2.2.tgz new file mode 100644 index 0000000..4ff8f5a Binary files /dev/null and b/chart/charts/nats-1.2.2.tgz differ diff --git a/chart/charts/versia_go-0.1.0.tgz b/chart/charts/versia_go-0.1.0.tgz new file mode 100644 index 0000000..dc9514a Binary files /dev/null and b/chart/charts/versia_go-0.1.0.tgz differ diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl new file mode 100644 index 0000000..bc88186 --- /dev/null +++ b/chart/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the versiagorun. +*/}} +{{- define "versiagorun.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 versiagorun name it will be used as a full name. +*/}} +{{- define "versiagorun.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 versiagorun name and version as used by the versiagorun label. +*/}} +{{- define "versiagorun.versiagorun" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "versiagorun.labels" -}} +helm.sh/versiagorun: {{ include "versiagorun.versiagorun" . }} +{{ include "versiagorun.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "versiagorun.selectorLabels" -}} +app.kubernetes.io/name: {{ include "versiagorun.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} diff --git a/chart/templates/certificate.yaml b/chart/templates/certificate.yaml new file mode 100644 index 0000000..cda593a --- /dev/null +++ b/chart/templates/certificate.yaml @@ -0,0 +1,37 @@ +{{- if and .Values.versia_go.ingress.enabled (hasKey .Values.versia_go.ingress "sslSecret") }} +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: {{ include "versiagorun.fullname" . }} + {{- if eq .Values.versia_go.ingress.className "istio" }} + namespace: istio-system + {{- end }} + labels: + {{- include "versiagorun.labels" . | nindent 4 }} +spec: + {{ $host := include "versiago.instanceHostname" .Values.versia_go.versia.instance.address }} + secretName: {{ .Values.versia_go.ingress.sslSecret }} + commonName: {{ $host }} + dnsNames: + - {{ $host }} + subject: + organizations: + - {{ .Values.ssl.org }} + duration: 2160h0m0s # 90d + renewBefore: 720h0m0s # 30d + issuerRef: +{{- if (and (hasKey .Values.ssl "issuerKind") (hasKey .Values.ssl "issuerName")) }} + name: {{ .Values.ssl.issuerName }} + kind: {{ .Values.ssl.issuerKind }} +{{- else }} + name: {{ include "versiagorun.fullname" . | quote }} + kind: Issuer +{{- end }} + usages: + - server auth + - client auth + privateKey: + algorithm: RSA + encoding: PKCS1 + size: 4096 +{{- end }} diff --git a/chart/templates/issuer.yaml b/chart/templates/issuer.yaml new file mode 100644 index 0000000..148ce9e --- /dev/null +++ b/chart/templates/issuer.yaml @@ -0,0 +1,21 @@ +{{- if not (and (hasKey .Values.ssl "issuerKind") (hasKey .Values.ssl "issuerName")) }} +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + name: {{ include "versiagorun.fullname" . | quote }} + {{- if eq .Values.versia_go.ingress.className "istio" }} + namespace: istio-system + {{- end }} +spec: + acme: + server: https://acme-v02.api.letsencrypt.org/directory + email: {{ .Values.ssl.issuer.email }} + privateKeySecretRef: + name: {{ include "versiagorun.fullname" . }}-tls-account-key + solvers: + - http01: + {{- if hasKey .Values.versia_go.ingress "className" }} + ingress: + class: {{ .Values.versia_go.ingress.className | quote }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/chart/values.yaml b/chart/values.yaml new file mode 100644 index 0000000..4f22e8e --- /dev/null +++ b/chart/values.yaml @@ -0,0 +1,23 @@ +--- +ssl: { + # org: + + # Self provided issuer + # issuerName: + # issuerKind: + + # Create a new namespaced Issuer + # issuer: + # email: +} + +versia_go: + nats: + uri: nats://versia-nats:4222 + +nats: + config: + cluster: + enabled: true + jetstream: + enabled: true \ No newline at end of file diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000..7e88068 --- /dev/null +++ b/values.yaml @@ -0,0 +1,34 @@ +ssl: + org: DevMiner.xyz + issuer: + email: devminer@devminer.xyz + +versia_go: + image: + tag: "main" + + environment: staging + + versia: + instance: + name: Versia-Go + description: Versia-Go instance running in Kubernetes + address: "https://versia.devminer.xyz" + + ingress: + enabled: true + className: istio + sslSecret: "a" + + pod: + resources: + limits: + cpu: 500m + requests: + cpu: 50m + memory: 16Mi + + database: + type: "sqlite" + size: 1Gi + storageClassName: longhorn