Skip to content

Commit 1823d05

Browse files
committed
move lab projects to new repo
1 parent c14297b commit 1823d05

14 files changed

+463
-1
lines changed

.github/workflows/release-chart.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Configure Git
18+
run: |
19+
git config user.name "$GITHUB_ACTOR"
20+
git config user.email "[email protected]"
21+
- name: Helm Deps
22+
run: |
23+
helm repo add bitnami https://charts.bitnami.com/bitnami
24+
- name: Run chart-releaser
25+
uses: helm/[email protected]
26+
env:
27+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# helm-charts
1+
# helm-charts-lab
22

33
Helm charts for subshell side projects.
44

charts/group-challenge/.helmignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/group-challenge/Chart.lock

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 11.1.17
5+
digest: sha256:38055223b7aec2efe1354de3996b66f39ab6e6104add65cc9bcf67ad6055ab13
6+
generated: "2022-04-07T13:15:54.883027+02:00"

charts/group-challenge/Chart.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: v2
2+
name: group-challenge
3+
description: Group challenge helm chart
4+
type: application
5+
version: 1.0.3
6+
appVersion: "0.6.1"
7+
dependencies:
8+
- name: postgresql
9+
version: 11.1.17
10+
repository: https://charts.bitnami.com/bitnami
11+
condition: postgresql.enabled

charts/group-challenge/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Group Challenge
2+
3+
Helm Chart for the [Group Challene App](https://github.com/subshell/group-challenge).
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "group-challenge.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "group-challenge.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "group-challenge.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "group-challenge.labels" -}}
37+
helm.sh/chart: {{ include "group-challenge.chart" . }}
38+
{{ include "group-challenge.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "group-challenge.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "group-challenge.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "group-challenge.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "group-challenge.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "group-challenge.fullname" . }}
5+
labels:
6+
{{- include "group-challenge.labels" . | nindent 4 }}
7+
data:
8+
config.yaml: |- {{ toYaml (required "A valid config.yaml config is required (nested in the value .Values.groupChallenge.config)!" .Values.groupChallenge.config) | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "group-challenge.fullname" . }}
5+
labels:
6+
{{- include "group-challenge.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
selector:
10+
matchLabels:
11+
{{- include "group-challenge.selectorLabels" . | nindent 6 }}
12+
template:
13+
metadata:
14+
annotations:
15+
"cluster-autoscaler.kubernetes.io/safe-to-evict": "true"
16+
{{- with .Values.podAnnotations }}
17+
{{- toYaml . | nindent 8 }}
18+
{{- end }}
19+
labels:
20+
{{- include "group-challenge.selectorLabels" . | nindent 8 }}
21+
spec:
22+
{{- with .Values.imagePullSecrets }}
23+
imagePullSecrets:
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
serviceAccountName: {{ include "group-challenge.serviceAccountName" . }}
27+
securityContext:
28+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
29+
restartPolicy: Always
30+
containers:
31+
{{ if .Values.imgProxy.enabled -}}
32+
- name: img-proxy
33+
securityContext:
34+
{{- toYaml .Values.securityContext | nindent 12 }}
35+
image: "{{ .Values.imgProxy.image.repository }}:{{ .Values.imgProxy.image.tag }}"
36+
imagePullPolicy: {{ .Values.imgProxy.image.pullPolicy }}
37+
volumeMounts:
38+
- name: group-challenge-cache
39+
mountPath: "/tmp/group-challenge-cache"
40+
env:
41+
- name: IMGPROXY_LOCAL_FILESYSTEM_ROOT
42+
value: "/tmp/group-challenge-cache"
43+
- name: IMGPROXY_BIND
44+
value: ":8081"
45+
- name: IMGPROXY_PROMETHEUS_BIND
46+
value: ":8082"
47+
- name: IMGPROXY_MAX_SRC_RESOLUTION
48+
value: "25"
49+
{{ if .Values.imgProxy.env -}}
50+
{{- toYaml .Values.imgProxy.env | nindent 12 }}
51+
{{- end }}
52+
ports:
53+
- name: http-ip
54+
containerPort: 8081
55+
protocol: TCP
56+
- name: http-ipp
57+
containerPort: 8082
58+
protocol: TCP
59+
livenessProbe:
60+
httpGet:
61+
path: /
62+
port: http-ip
63+
readinessProbe:
64+
httpGet:
65+
path: /
66+
port: http-ip
67+
resources:
68+
{{- toYaml .Values.imgProxy.resources | nindent 12 }}
69+
{{- end }}
70+
- name: {{ .Chart.Name }}
71+
securityContext:
72+
{{- toYaml .Values.securityContext | nindent 12 }}
73+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
74+
imagePullPolicy: {{ .Values.image.pullPolicy }}
75+
volumeMounts:
76+
- name: config
77+
mountPath: "/app/config"
78+
- name: group-challenge-cache
79+
mountPath: "/tmp/group-challenge-cache"
80+
env:
81+
{{ if .Values.groupChallenge.env -}}
82+
{{- toYaml .Values.groupChallenge.env | nindent 12 }}
83+
{{- end }}
84+
ports:
85+
- name: http
86+
containerPort: 8080
87+
protocol: TCP
88+
livenessProbe:
89+
httpGet:
90+
path: /
91+
port: http
92+
readinessProbe:
93+
httpGet:
94+
path: /
95+
port: http
96+
resources:
97+
{{- toYaml .Values.resources | nindent 12 }}
98+
volumes:
99+
- name: config
100+
configMap:
101+
name: {{ include "group-challenge.fullname" . }}
102+
- name: group-challenge-cache
103+
emptyDir: {}
104+
{{- with .Values.nodeSelector }}
105+
nodeSelector:
106+
{{- toYaml . | nindent 8 }}
107+
{{- end }}
108+
{{- with .Values.affinity }}
109+
affinity:
110+
{{- toYaml . | nindent 8 }}
111+
{{- end }}
112+
{{- with .Values.tolerations }}
113+
tolerations:
114+
{{- toYaml . | nindent 8 }}
115+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{{- if .Values.ingress.enabled -}}
2+
{{- $fullName := include "group-challenge.fullname" . -}}
3+
{{- $svcPort := .Values.service.port -}}
4+
apiVersion: networking.k8s.io/v1
5+
kind: Ingress
6+
metadata:
7+
name: {{ $fullName }}
8+
labels:
9+
{{- include "group-challenge.labels" . | nindent 4 }}
10+
{{- with .Values.ingress.annotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
spec:
15+
{{- if .Values.ingress.ingressClassName }}
16+
ingressClassName: {{ .Values.ingress.ingressClassName }}
17+
{{- end -}}
18+
{{- if .Values.ingress.tls }}
19+
tls:
20+
{{- range .Values.ingress.tls }}
21+
- hosts:
22+
{{- range .hosts }}
23+
- {{ . | quote }}
24+
{{- end }}
25+
secretName: {{ .secretName }}
26+
{{- end }}
27+
{{- end }}
28+
rules:
29+
{{- range .Values.ingress.hosts }}
30+
- host: {{ .host | quote }}
31+
http:
32+
paths:
33+
- path: /
34+
pathType: Prefix
35+
backend:
36+
service:
37+
name: {{ $fullName }}
38+
port:
39+
number: {{ $svcPort }}
40+
{{- end }}
41+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "group-challenge.fullname" . }}
5+
labels:
6+
{{- include "group-challenge.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.service.type }}
9+
ports:
10+
- port: {{ .Values.service.port }}
11+
targetPort: http
12+
protocol: TCP
13+
name: http
14+
{{ if .Values.imgProxy.enabled -}}
15+
- port: 8082
16+
targetPort: http-ipp
17+
protocol: TCP
18+
name: http-ipp
19+
{{- end }}
20+
selector:
21+
{{- include "group-challenge.selectorLabels" . | nindent 4 }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "group-challenge.serviceAccountName" . }}
6+
labels:
7+
{{- include "group-challenge.labels" . | nindent 4 }}
8+
{{- with .Values.serviceAccount.annotations }}
9+
annotations:
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- if .Values.serviceMonitor.enabled -}}
2+
{{- $fullName := include "group-challenge.fullname" . -}}
3+
apiVersion: monitoring.coreos.com/v1
4+
kind: ServiceMonitor
5+
metadata:
6+
name: {{ $fullName }}
7+
labels: {{- include "group-challenge.labels" . | nindent 8 }}
8+
spec:
9+
selector:
10+
matchLabels: {{- include "group-challenge.selectorLabels" . | nindent 12 }}
11+
endpoints:
12+
- interval: {{ .Values.serviceMonitor.interval }}
13+
port: http
14+
path: {{ .Values.serviceMonitor.path }}
15+
- interval: {{ .Values.serviceMonitor.interval }}
16+
port: http-ipp
17+
path: /
18+
{{- end }}

0 commit comments

Comments
 (0)