Skip to content

Commit

Permalink
helm charts
Browse files Browse the repository at this point in the history
  • Loading branch information
rdcm committed Nov 18, 2023
1 parent 8b36ceb commit 5349d48
Show file tree
Hide file tree
Showing 63 changed files with 518 additions and 129 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml → .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ env:

jobs:
build:

runs-on: ubuntu-latest

defaults:
run:
working-directory: ./src
services:
mongodb:
image: mongo
ports:
- 27017:27017

steps:
- uses: actions/checkout@v3
- name: Build
Expand Down
3 changes: 0 additions & 3 deletions build_images.sh

This file was deleted.

3 changes: 3 additions & 0 deletions deploy_helm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

helm install web-api-dev helm
23 changes: 23 additions & 0 deletions helm/.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/
6 changes: 6 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: helm
description: Development environment
type: application
version: 0.1.0
appVersion: "1.16.0"
Binary file added helm/charts/ingress-nginx-4.8.3.tgz
Binary file not shown.
62 changes: 62 additions & 0 deletions helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "helm.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 "helm.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 "helm.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "helm.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "helm.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
30 changes: 30 additions & 0 deletions helm/templates/acl/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.acl.label }}-deployment
spec:
replicas: {{ .Values.acl.replicas }}
selector:
matchLabels:
app: {{ .Values.acl.label }}
template:
metadata:
labels:
app: {{ .Values.acl.label }}
spec:
containers:
- name: {{ .Values.acl.image.name }}
image: "{{ .Values.acl.image.name }}:{{ .Values.acl.image.tag }}"
env:
- name: KAFKA_BROKERS
value: {{ .Values.acl.kafka.brokers }}
- name: KAFKA_TOPIC
value: {{ .Values.acl.kafka.topic }}
- name: KAFKA_GROUP_ID
value: {{ .Values.acl.kafka.group }}
imagePullPolicy: {{ .Values.acl.pullPolicy }}
resources:
limits:
memory: {{ .Values.acl.resources.limits.memory }}
cpu: {{ .Values.acl.resources.limits.cpu }}

32 changes: 32 additions & 0 deletions helm/templates/api/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.api.label }}-deployment
spec:
selector:
matchLabels:
app: {{ .Values.api.label }}
template:
metadata:
labels:
app: {{ .Values.api.label }}
spec:
containers:
- name: {{ .Values.api.image.name }}
image: "{{ .Values.api.image.name }}:{{ .Values.api.image.tag }}"
env:
- name: DB_URI
value: {{ .Values.api.mongodb.uri }}
- name: KAFKA_BROKERS
value: {{ .Values.api.kafka.brokers }}
- name: KAFKA_TOPIC
value: {{ .Values.api.kafka.topic }}
- name: KAFKA_GROUP_ID
value: {{ .Values.api.kafka.group }}
imagePullPolicy: {{ .Values.api.pullPolicy }}
resources:
limits:
memory: {{ .Values.api.resources.limits.memory }}
cpu: {{ .Values.api.resources.limits.cpu }}
ports:
- containerPort: {{ .Values.api.port }}
23 changes: 23 additions & 0 deletions helm/templates/api/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.api.label }}-ingress
labels:
name: {{ .Values.api.label }}
spec:
ingressClassName: {{ .Values.api.ingress.ingressClassName }}
rules:
- host: {{ .Values.api.ingress.host }}
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: {{ .Values.api.label }}-service
port:
number: {{ .Values.api.port }}
tls:
- hosts:
- {{ .Values.api.ingress.host }}
secretName: {{ .Values.api.label }}-secret
10 changes: 10 additions & 0 deletions helm/templates/api/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.api.label }}-service
spec:
selector:
app: {{ .Values.api.label }}
ports:
- port: {{ .Values.api.port }}
targetPort: {{ .Values.api.port }}
33 changes: 33 additions & 0 deletions helm/templates/kafka/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.kafka.label }}-deployment
spec:
replicas: {{ .Values.kafka.replicas }}
selector:
matchLabels:
app: {{ .Values.kafka.label }}
template:
metadata:
labels:
app: {{ .Values.kafka.label }}
spec:
containers:
- env:
- name: KAFKA_BROKER_ID
value: "{{ .Values.kafka.variables.brokerId }}"
- name: KAFKA_ZOOKEEPER_CONNECT
value: {{ .Values.kafka.variables.zookeeperConnect }}
- name: KAFKA_LISTENERS
value: {{ .Values.kafka.variables.listeners }}
- name: KAFKA_ADVERTISED_LISTENERS
value: {{ .Values.kafka.variables.advertisedListeners }}
image: {{ .Values.kafka.image.name }}
imagePullPolicy: {{ .Values.kafka.pullPolicy }}
name: {{ .Values.kafka.label }}
resources:
limits:
memory: {{ .Values.kafka.resources.limits.memory }}
cpu: {{ .Values.kafka.resources.limits.cpu }}
ports:
- containerPort: {{ .Values.kafka.port }}
10 changes: 10 additions & 0 deletions helm/templates/kafka/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.kafka.label }}-service
spec:
selector:
app: {{ .Values.kafka.label }}
ports:
- port: {{ .Values.kafka.port }}
targetPort: {{ .Values.kafka.port }}
24 changes: 24 additions & 0 deletions helm/templates/mongodb/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.mongodb.label }}-deployment
spec:
selector:
matchLabels:
app: {{ .Values.mongodb.label }}
template:
metadata:
labels:
app: {{ .Values.mongodb.label }}
spec:
containers:
- name: {{ .Values.mongodb.image.name }}
image: "{{ .Values.mongodb.image.name }}:{{ .Values.mongodb.image.tag }}"
resources:
limits:
memory: {{ .Values.mongodb.resources.limits.memory }}
cpu: {{ .Values.mongodb.resources.limits.cpu }}
ports:
- containerPort: {{ .Values.mongodb.port }}


10 changes: 10 additions & 0 deletions helm/templates/mongodb/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.mongodb.label }}-service
spec:
selector:
app: {{ .Values.mongodb.label }}
ports:
- port: {{ .Values.mongodb.port }}
targetPort: {{ .Values.mongodb.port }}
23 changes: 23 additions & 0 deletions helm/templates/zookeeper/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.zookeeper.label }}-deployment
spec:
selector:
matchLabels:
app: {{ .Values.zookeeper.label }}
template:
metadata:
labels:
app: {{ .Values.zookeeper.label }}
spec:
containers:
- image: {{ .Values.zookeeper.image.name }}
imagePullPolicy: {{ .Values.zookeeper.pullPolicy }}
name: {{ .Values.zookeeper.label }}
ports:
- containerPort: {{ .Values.zookeeper.port }}
resources:
limits:
memory: {{ .Values.zookeeper.resources.limits.memory }}
cpu: {{ .Values.zookeeper.resources.limits.cpu }}
10 changes: 10 additions & 0 deletions helm/templates/zookeeper/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.zookeeper.label }}-service
spec:
selector:
app: {{ .Values.zookeeper.label }}
ports:
- port: {{ .Values.zookeeper.port }}
targetPort: {{ .Values.zookeeper.port }}
Loading

0 comments on commit 5349d48

Please sign in to comment.