Skip to content

Commit

Permalink
Added helm config
Browse files Browse the repository at this point in the history
  • Loading branch information
kchudy committed Jul 24, 2023
1 parent f572699 commit cdc8a49
Show file tree
Hide file tree
Showing 10 changed files with 195 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/vonage-rust/target/
/matrix-hookshot-rust/target/
/.idea/
config.toml
/config.toml
/charts/vonage-to-matrix/config.toml
23 changes: 23 additions & 0 deletions charts/vonage-to-matrix/.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/
24 changes: 24 additions & 0 deletions charts/vonage-to-matrix/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: vonage-to-matrix
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"
7 changes: 7 additions & 0 deletions charts/vonage-to-matrix/config.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[hookshot]
url = "https://example.com/abc"

[vonage]
[vonage.labels]
48111111111 = "Poland"
12222222222 = "United States"
62 changes: 62 additions & 0 deletions charts/vonage-to-matrix/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "vonage-to-matrix.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 "vonage-to-matrix.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 "vonage-to-matrix.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "vonage-to-matrix.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "vonage-to-matrix.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
10 changes: 10 additions & 0 deletions charts/vonage-to-matrix/templates/config-maps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
data:
config.toml: |-
{{ .Files.Get "config.toml" | indent 4 }}
kind: ConfigMap
metadata:
name: vonage-to-matrix-config
labels:
app: vonage-to-matrix
type: rust
36 changes: 36 additions & 0 deletions charts/vonage-to-matrix/templates/deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: vonage-to-matrix
type: rust
name: vonage-to-matrix
spec:
replicas: 1
selector:
matchLabels:
app: vonage-to-matrix
type: rust
strategy:
type: Recreate
template:
metadata:
labels:
app: vonage-to-matrix
type: rust
spec:
containers:
- name: vonage-to-matrix
image: ghcr.io/teonite/vonage-to-matrix:main
imagePullPolicy: Always
volumeMounts:
- mountPath: /opt/config.toml
name: config-volume
subPath: config.toml
env:
- name: RUST_LOG
value: {{ .Values.loglevel }}
volumes:
- name: config-volume
configMap:
name: vonage-to-matrix-config
17 changes: 17 additions & 0 deletions charts/vonage-to-matrix/templates/ingresses.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: vonage-to-matrix
spec:
ingressClassName: traefik
rules:
- host: vonage.teonite.net
http:
paths:
- backend:
service:
name: vonage-to-matrix
port:
number: 80
path: /
pathType: Prefix
13 changes: 13 additions & 0 deletions charts/vonage-to-matrix/templates/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: vonage-to-matrix
spec:
ports:
- name: "80"
port: 80
targetPort: 8080
selector:
app: vonage-to-matrix
type: rust
type: ClusterIP
1 change: 1 addition & 0 deletions charts/vonage-to-matrix/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loglevel: info

0 comments on commit cdc8a49

Please sign in to comment.