From 8ed9823213d082a2eb56ea5a37fcf576aef0333e Mon Sep 17 00:00:00 2001 From: Grant Limberg Date: Tue, 25 Jun 2024 11:46:03 -0700 Subject: [PATCH] Add a helm chart for crisp-status-local Couldn't find one that already existed so I whipped one up real quick --- charts/crisp-status-local/.helmignore | 23 +++++ charts/crisp-status-local/Chart.yaml | 24 +++++ .../crisp-status-local/templates/_helpers.tpl | 62 +++++++++++++ .../templates/deployment.yaml | 72 +++++++++++++++ .../crisp-status-local/templates/secret.yaml | 13 +++ .../templates/serviceaccount.yaml | 13 +++ charts/crisp-status-local/values.yaml | 91 +++++++++++++++++++ charts/zerotier-ingress-helm/README.md | 20 +++- 8 files changed, 314 insertions(+), 4 deletions(-) create mode 100644 charts/crisp-status-local/.helmignore create mode 100644 charts/crisp-status-local/Chart.yaml create mode 100644 charts/crisp-status-local/templates/_helpers.tpl create mode 100644 charts/crisp-status-local/templates/deployment.yaml create mode 100644 charts/crisp-status-local/templates/secret.yaml create mode 100644 charts/crisp-status-local/templates/serviceaccount.yaml create mode 100644 charts/crisp-status-local/values.yaml diff --git a/charts/crisp-status-local/.helmignore b/charts/crisp-status-local/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/crisp-status-local/.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/charts/crisp-status-local/Chart.yaml b/charts/crisp-status-local/Chart.yaml new file mode 100644 index 0000000..0c46761 --- /dev/null +++ b/charts/crisp-status-local/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: crisp-status-local +description: A Helm chart for Kubernetes that deploys an instance of the Crisp Status Reporter + +# 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: "v1.3.7" diff --git a/charts/crisp-status-local/templates/_helpers.tpl b/charts/crisp-status-local/templates/_helpers.tpl new file mode 100644 index 0000000..340f0c8 --- /dev/null +++ b/charts/crisp-status-local/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "crisp-status-local.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 "crisp-status-local.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 "crisp-status-local.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "crisp-status-local.labels" -}} +helm.sh/chart: {{ include "crisp-status-local.chart" . }} +{{ include "crisp-status-local.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "crisp-status-local.selectorLabels" -}} +app.kubernetes.io/name: {{ include "crisp-status-local.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "crisp-status-local.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "crisp-status-local.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/crisp-status-local/templates/deployment.yaml b/charts/crisp-status-local/templates/deployment.yaml new file mode 100644 index 0000000..168fd7b --- /dev/null +++ b/charts/crisp-status-local/templates/deployment.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "crisp-status-local.fullname" . }} + labels: + {{- include "crisp-status-local.labels" . | nindent 4 }} +spec: + replicas: 1 + selector: + matchLabels: + {{- include "crisp-status-local.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "crisp-status-local.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "crisp-status-local.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - crisp-status-local + args: + - -c /var/lib/crisp-status-local/config.toml + {{- with .Values.args }} + {{- toYaml . | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - name: config-secret + mountPath: /var/lib/crisp-status-local + readOnly: true + {{- with .Values.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + volumes: + - config-secret: + secret: + secretName: {{ include "crisp-status-local.fullname" . }}-config + optional: false + {{- with .Values.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/crisp-status-local/templates/secret.yaml b/charts/crisp-status-local/templates/secret.yaml new file mode 100644 index 0000000..9f598a0 --- /dev/null +++ b/charts/crisp-status-local/templates/secret.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: {{ include "crisp-status-local.fullname" . }}-config + labels: + {{- include "crisp-status-local.labels" . | nindent 4 }} +stringData: + config.toml: |- + [server] + log_level = {{ .Values.logLevel | default "info" | quote }} + [report] + token = {{ .Values.crispReporterToken | quote}} diff --git a/charts/crisp-status-local/templates/serviceaccount.yaml b/charts/crisp-status-local/templates/serviceaccount.yaml new file mode 100644 index 0000000..9bab697 --- /dev/null +++ b/charts/crisp-status-local/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "crisp-status-local.serviceAccountName" . }} + labels: + {{- include "crisp-status-local.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/crisp-status-local/values.yaml b/charts/crisp-status-local/values.yaml new file mode 100644 index 0000000..d8ee059 --- /dev/null +++ b/charts/crisp-status-local/values.yaml @@ -0,0 +1,91 @@ +# Default values for crisp-status-local. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +# Crisp Status Reporter configuration + +# The log level for the Crisp Status Reporter +logLevel: "info" + +# The token for the Crisp Reporter. This is required for the Crisp Status Reporter to function. +crispReporterToken: "" + +image: + repository: crispim/crisp-status-local + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: 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: {} +podLabels: {} + +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 + +# livenessProbe: +# httpGet: +# path: / +# port: http +# readinessProbe: +# httpGet: +# path: / +# port: http + +# Additional arguments to pass to the container. +args: [] + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/zerotier-ingress-helm/README.md b/charts/zerotier-ingress-helm/README.md index 3a4237a..b4586c9 100644 --- a/charts/zerotier-ingress-helm/README.md +++ b/charts/zerotier-ingress-helm/README.md @@ -1,14 +1,26 @@ -# ZeroTier Ingress Helm +# ZeroTier Helm Charts -This chart enables connections to private services running inside your Kubernetes cluster over ZeroTierby combining an instance of ZeroTier with an instance of Nginx. -## Adding the chart + +## Adding the Chart Repo ``` helm repo add zerotier https://zerotier.github.io/helm-charts ``` -## Configuring the Chart +## Crisp Status Local (crisp-status-local) + +Installs an instance of [crisp-status-local](https://github.com/crisp-im/crisp-status-local) into your cluster. + +### Configuring the chart + +There's only one required configuration variable: `crispReporterToken:`. Get this from your crisp.chat status page settings. + +## ZeroTier Ingress Helm (zerotier-ingress-helm) + +This chart enables connections to private services running inside your Kubernetes cluster over ZeroTierby combining an instance of ZeroTier with an instance of Nginx. + +### Configuring the Chart Create your values.yaml file. The following fields are required: