Skip to content

Commit 73918fc

Browse files
Merge pull request #53 from TPIsoftwareOSPO/feature/helm
add helm contribution
2 parents 618280e + 4ff8358 commit 73918fc

File tree

9 files changed

+307
-17
lines changed

9 files changed

+307
-17
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
66
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
77

8+
**/*.tgz
9+
810
.tmp/
911

1012
build/

deploys/helm/.helmignore

Lines changed: 23 additions & 0 deletions
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/

deploys/helm/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: digirunner-open-source-helm
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 1.0.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "release-v4.5.5"

deploys/helm/templates/_helpers.tpl

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "digirunner-open-source-helm.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 "digirunner-open-source-helm.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 "digirunner-open-source-helm.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "digirunner-open-source-helm.labels" -}}
37+
helm.sh/chart: {{ include "digirunner-open-source-helm.chart" . }}
38+
{{ include "digirunner-open-source-helm.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 "digirunner-open-source-helm.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "digirunner-open-source-helm.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 "digirunner-open-source-helm.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "digirunner-open-source-helm.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "digirunner-open-source-helm.fullname" . }}
5+
labels:
6+
{{- include "digirunner-open-source-helm.labels" . | nindent 4 }}
7+
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
11+
selector:
12+
matchLabels:
13+
{{- include "digirunner-open-source-helm.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "digirunner-open-source-helm.labels" . | nindent 8 }}
22+
{{- with .Values.podLabels }}
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
25+
spec:
26+
{{- with .Values.imagePullSecrets }}
27+
imagePullSecrets:
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
{{- with .Values.podSecurityContext }}
31+
securityContext:
32+
{{- toYaml . | nindent 8 }}
33+
{{- end }}
34+
containers:
35+
- name: {{ .Chart.Name }}
36+
{{- with .Values.securityContext }}
37+
securityContext:
38+
{{- toYaml . | nindent 12 }}
39+
{{- end }}
40+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
41+
imagePullPolicy: {{ .Values.image.pullPolicy }}
42+
ports:
43+
- name: http
44+
containerPort: {{ .Values.service.port }}
45+
protocol: TCP
46+
{{- with .Values.livenessProbe }}
47+
livenessProbe:
48+
{{- toYaml . | nindent 12 }}
49+
{{- end }}
50+
{{- with .Values.readinessProbe }}
51+
readinessProbe:
52+
{{- toYaml . | nindent 12 }}
53+
{{- end }}
54+
{{- with .Values.resources }}
55+
resources:
56+
{{- toYaml . | nindent 12 }}
57+
{{- end }}
58+
{{- with .Values.volumeMounts }}
59+
volumeMounts:
60+
{{- toYaml . | nindent 12 }}
61+
{{- end }}
62+
{{- with .Values.volumes }}
63+
volumes:
64+
{{- toYaml . | nindent 8 }}
65+
{{- end }}
66+
{{- with .Values.nodeSelector }}
67+
nodeSelector:
68+
{{- toYaml . | nindent 8 }}
69+
{{- end }}
70+
{{- with .Values.affinity }}
71+
affinity:
72+
{{- toYaml . | nindent 8 }}
73+
{{- end }}
74+
{{- with .Values.tolerations }}
75+
tolerations:
76+
{{- toYaml . | nindent 8 }}
77+
{{- end }}

deploys/helm/templates/service.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "digirunner-open-source-helm.fullname" . }}
5+
labels:
6+
{{- include "digirunner-open-source-helm.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+
nodePort: {{ .Values.service.nodePort }}
15+
selector:
16+
{{- include "digirunner-open-source-helm.selectorLabels" . | nindent 4 }}

deploys/helm/values.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Default values for digirunner-open-source-helm.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
# This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/
6+
replicaCount: 1
7+
8+
# This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/
9+
image:
10+
repository: tpisoftwareopensource/digirunner-open-source
11+
# This sets the pull policy for images.
12+
pullPolicy: Always
13+
# Overrides the image tag whose default is the chart appVersion.
14+
tag: "release-v4.5.5"
15+
16+
# This is for the secrets for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/
17+
imagePullSecrets: []
18+
# This is to override the chart name.
19+
nameOverride: ""
20+
fullnameOverride: ""
21+
22+
# This is for setting Kubernetes Annotations to a Pod.
23+
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
24+
podAnnotations: {}
25+
# This is for setting Kubernetes Labels to a Pod.
26+
# For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
27+
podLabels: {}
28+
29+
podSecurityContext: {}
30+
# fsGroup: 2000
31+
32+
securityContext: {}
33+
# capabilities:
34+
# drop:
35+
# - ALL
36+
# readOnlyRootFilesystem: true
37+
# runAsNonRoot: true
38+
# runAsUser: 1000
39+
40+
# This is for setting up a service more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/
41+
service:
42+
# This sets the service type more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
43+
type: NodePort
44+
# This sets the ports more information can be found here: https://kubernetes.io/docs/concepts/services-networking/service/#field-spec-ports
45+
port: 18080
46+
nodePort: 31080
47+
48+
resources: {}
49+
# We usually recommend not to specify default resources and to leave this as a conscious
50+
# choice for the user. This also increases chances charts run on environments with little
51+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
52+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
53+
# limits:
54+
# cpu: 100m
55+
# memory: 128Mi
56+
# requests:
57+
# cpu: 100m
58+
# memory: 128Mi
59+
60+
# This is to setup the liveness and readiness probes more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
61+
livenessProbe:
62+
httpGet:
63+
path: /dgrv4/liveness
64+
port: http
65+
readinessProbe:
66+
httpGet:
67+
path: /dgrv4/version
68+
port: http
69+
70+
# This section is for setting up autoscaling more information can be found here: https://kubernetes.io/docs/concepts/workloads/autoscaling/
71+
autoscaling:
72+
enabled: false
73+
74+
# Additional volumes on the output Deployment definition.
75+
volumes: []
76+
# - name: foo
77+
# secret:
78+
# secretName: mysecret
79+
# optional: false
80+
81+
# Additional volumeMounts on the output Deployment definition.
82+
volumeMounts: []
83+
# - name: foo
84+
# mountPath: "/etc/foo"
85+
# readOnly: true
86+
87+
nodeSelector: {}
88+
89+
tolerations: []
90+
91+
affinity: {}

deploys/kubernetes/digirunner-open-source.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
apiVersion: v1
2-
kind: Namespace
3-
metadata:
4-
name: digirunner-open-source-ns
5-
6-
---
7-
81
apiVersion: v1
92
kind: Service
103
metadata:
114
name: digirunner-open-source-svc
12-
namespace: digirunner-open-source-ns
135
spec:
146
ports:
157
- name: tcp
@@ -30,7 +22,6 @@ metadata:
3022
labels:
3123
app: digirunner
3224
name: digirunner-open-source-deploy
33-
namespace: digirunner-open-source-ns
3425
spec:
3526
replicas: 1
3627
selector:

readme.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ docker run -it -d -p 31080:18080 tpisoftwareopensource/digirunner-open-source
105105

106106
#### Option 2: Docker-Compose
107107

108+
> Based on the content of [deploys/docker-compose/docker-compose.yml](deploys/docker-compose/docker-compose.yml)
109+
108110
```yml
109111
name: digirunner-open-source
110112
services:
@@ -121,19 +123,14 @@ services:
121123

122124
#### Option 3: Kubernetes
123125

124-
```yml
125-
apiVersion: v1
126-
kind: Namespace
127-
metadata:
128-
name: digirunner-open-source-ns
126+
> Based on the content of [deploys/kubernetes/digirunner-open-source.yml](deploys/kubernetes/digirunner-open-source.yml)
129127

130-
---
131128

129+
```yml
132130
apiVersion: v1
133131
kind: Service
134132
metadata:
135133
name: digirunner-open-source-svc
136-
namespace: digirunner-open-source-ns
137134
spec:
138135
ports:
139136
- name: tcp
@@ -154,7 +151,6 @@ metadata:
154151
labels:
155152
app: digirunner
156153
name: digirunner-open-source-deploy
157-
namespace: digirunner-open-source-ns
158154
spec:
159155
replicas: 1
160156
selector:
@@ -183,6 +179,14 @@ spec:
183179
- save above configuration to `digirunner-open-source.yml`
184180
- run `kubectl apply -f digirunner-open-source.yml`
185181

182+
#### Option 4: Helm
183+
184+
Contributions:
185+
186+
- **[how-to-package-digirunner-using-helm](https://github.com/vulcanshen-tpi/how-to-package-digirunner-using-helm)**
187+
- Step-by-step guide on how to package the digirunner open source project using Helm.
188+
- Quickly install the example
189+
186190
#### Connect to service
187191

188192
- Open your browser and navigate to: http://localhost:31080/dgrv4/login

0 commit comments

Comments
 (0)