File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,3 +28,4 @@ dependencies:
2828 - name : mysql
2929 version : 14.0.3
3030 repository : https://charts.bitnami.com/bitnami
31+ condition : mysql.enabled
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ kind: ConfigMap
44apiVersion : v1
55metadata :
66 name : {{ template "test-application.fullname" . }}-config
7- namespace : {{ .Values.namespace }}
7+ namespace : {{ .Values.namespace | default "app-system" }}
88 labels :
99 {{- include "test-application.labels" . | nindent 4 }}
1010data :
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ apiVersion: apps/v1
44kind : Deployment
55metadata :
66 name : {{ include "test-application.fullname" . }}
7- namespace : {{ .Values.namespace }}
7+ namespace : {{ .Values.namespace | default "app-system" }}
88 labels :
99 {{- include "test-application.labels" . | nindent 4 }}
1010spec :
@@ -30,46 +30,24 @@ spec:
3030 {{- end }}
3131 serviceAccountName : {{ include "test-application.serviceAccountName" . }}
3232 securityContext :
33- runAsNonRoot : true
34- runAsUser : 101
35- runAsGroup : 101
36- fsGroup : 101
37- volumes :
38- - name : cache-nginx
39- emptyDir : {}
40- - name : var-run
41- emptyDir : {}
42- - name : tmp
43- emptyDir : {}
33+ {{- toYaml .Values.podSecurityContext | nindent 8 }}
4434 containers :
4535 - name : {{ .Chart.Name }}
36+ {{- if .Values.image.digest }}
37+ image : " {{ .Values.image.registry }}/{{ .Values.image.repository }}@{{ .Values.image.digest }}"
38+ {{- else }}
4639 image : " {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
40+ {{- end }}
4741 imagePullPolicy : {{ .Values.image.pullPolicy }}
4842 securityContext :
49- privileged : false
50- allowPrivilegeEscalation : false
51- readOnlyRootFilesystem : true
52- seccompProfile :
53- type : RuntimeDefault
54- capabilities :
55- drop :
56- - ALL
57- add :
58- - NET_BIND_SERVICE
43+ {{- toYaml .Values.securityContext | nindent 12 }}
5944 envFrom :
6045 - configMapRef :
6146 name : {{ template "test-application.fullname" . }}-config
6247 ports :
6348 - name : http
6449 containerPort : 8080
6550 protocol : TCP
66- volumeMounts :
67- - name : cache-nginx
68- mountPath : /var/cache/nginx
69- - name : var-run
70- mountPath : /var/run
71- - name : tmp
72- mountPath : /tmp
7351 livenessProbe :
7452 httpGet :
7553 path : /health/check
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ apiVersion: autoscaling/v2
55kind : HorizontalPodAutoscaler
66metadata :
77 name : {{ include "test-application.fullname" . }}
8+ namespace : {{ .Values.namespace | default "app-system" }}
89 labels :
910 {{- include "test-application.labels" . | nindent 4 }}
1011spec :
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ apiVersion: extensions/v1beta1
1818kind : Ingress
1919metadata :
2020 name : {{ $fullName }}
21+ namespace : {{ .Values.namespace | default "app-system" }}
2122 labels :
2223 {{- include "test-application.labels" . | nindent 4 }}
2324 {{- with .Values.ingress.annotations }}
Original file line number Diff line number Diff line change 1+ {{- if .Values.networkPolicy.enabled }}
2+ ---
3+ apiVersion : networking.k8s.io/v1
4+ kind : NetworkPolicy
5+ metadata :
6+ name : {{ include "test-application.fullname" . }}
7+ namespace : {{ .Values.namespace | default "app-system" }}
8+ labels :
9+ {{- include "test-application.labels" . | nindent 4 }}
10+ spec :
11+ podSelector :
12+ matchLabels :
13+ {{- include "test-application.selectorLabels" . | nindent 6 }}
14+ policyTypes :
15+ - Ingress
16+ - Egress
17+ ingress :
18+ {{- if .Values.networkPolicy.ingress }}
19+ {{- range .Values.networkPolicy.ingress }}
20+ - {{- toYaml . | nindent 6 }}
21+ {{- end }}
22+ {{- else }}
23+ - from :
24+ - namespaceSelector : {}
25+ ports :
26+ - protocol : TCP
27+ port : 8080
28+ {{- end }}
29+ egress :
30+ {{- if .Values.networkPolicy.egress }}
31+ {{- range .Values.networkPolicy.egress }}
32+ - {{- toYaml . | nindent 6 }}
33+ {{- end }}
34+ {{- else }}
35+ - to : []
36+ ports :
37+ - protocol : UDP
38+ port : 53
39+ - protocol : TCP
40+ port : 53
41+ - to :
42+ - podSelector :
43+ matchLabels :
44+ app.kubernetes.io/name : mysql
45+ ports :
46+ - protocol : TCP
47+ port : 3306
48+ - to : []
49+ ports :
50+ - protocol : TCP
51+ port : 80
52+ - protocol : TCP
53+ port : 443
54+ {{- end }}
55+ {{- end }}
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ apiVersion: v1
33kind : Service
44metadata :
55 name : {{ include "test-application.fullname" . }}
6- namespace : {{ .Values.namespace }}
6+ namespace : {{ .Values.namespace | default "app-system" }}
77 labels :
88 {{- include "test-application.labels" . | nindent 4 }}
99spec :
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ apiVersion: v1
33kind : ServiceAccount
44metadata :
55 name : {{ include "test-application.serviceAccountName" . }}
6- namespace : {{ .Values.namespace }}
6+ namespace : {{ .Values.namespace | default "app-system" }}
77 labels :
88 {{- include "test-application.labels" . | nindent 4 }}
99 {{- with .Values.serviceAccount.annotations }}
Original file line number Diff line number Diff line change @@ -4,24 +4,54 @@ apiVersion: v1
44kind : Pod
55metadata :
66 name : " {{ include " test-application.fullname" . }}-test-connection"
7- namespace : {{ .Values.namespace }}
7+ namespace : {{ .Values.namespace | default "app-system" }}
88 labels :
99 {{- include "test-application.labels" . | nindent 4 }}
1010 annotations :
1111 " helm.sh/hook " : test
1212spec :
1313 automountServiceAccountToken : false
1414 securityContext :
15+ seccompProfile :
16+ type : RuntimeDefault
17+ readOnlyRootFilesystem : true
18+ runAsUser : 10001
19+ allowPrivilegeEscalation : false
20+ capabilities :
21+ drop :
22+ - NET_RAW
23+ - ALL
1524 containers :
1625 - name : wget
1726 image : busybox@sha256:9ae97d36d26566ff84e8893c64a6dc4fe8ca6d1144bf5b87b2b85a32def253c7
18- command :
19- - /bin/sh
20- - -c
21- - |
22- echo "+ testing the application using wget"
23- set -x
24- wget -O /dev/null -q '{{ include "test-application.fullname" . }}:{{ .Values.service.port }}'
27+ command : ['wget']
28+ args : ['{{ include "test-application.fullname" . }}:{{ .Values.service.port }}']
29+ readinessProbe :
30+ exec :
31+ command :
32+ - wget
33+ - -O
34+ - /dev/null
35+ - -q
36+ - ' {{ include "test-application.fullname" . }}:{{ .Values.service.port }}'
37+ initialDelaySeconds : 5
38+ periodSeconds : 5
39+ timeoutSeconds : 1
40+ successThreshold : 1
41+ failureThreshold : 3
42+ livenessProbe :
43+ exec :
44+ command :
45+ - wget
46+ - -O
47+ - /dev/null
48+ - -q
49+ - ' {{ include "test-application.fullname" . }}:{{ .Values.service.port }}'
50+ initialDelaySeconds : 5
51+ periodSeconds : 5
52+ timeoutSeconds : 1
53+ successThreshold : 1
54+ failureThreshold : 3
2555 resources :
2656 limits :
2757 cpu : " 100m"
Original file line number Diff line number Diff line change 33# This is a YAML-formatted file.
44# Declare variables to be passed into your templates.
55---
6+ namespace : " app-system"
7+
68application :
79 dbConnection : mysql
810 dbHost : " mysql"
1921 registry : " ghcr.io"
2022 repository : " hoverkraft-tech/ci-github-container/application-test"
2123 tag : " "
22- digest : " sha256:0000000000000000000000000000000000000000000000000000000000000000 "
24+ digest : " sha256:da3b65f32ea75f8041079d220b72da4f605738996256a7dc32715424cc117271 "
2325
2426imagePullSecrets : []
2527
@@ -38,8 +40,10 @@ serviceAccount:
3840podAnnotations : {}
3941
4042podSecurityContext :
41- {}
42- # fsGroup: 2000
43+ runAsNonRoot : true
44+ runAsUser : 10001
45+ runAsGroup : 10001
46+ fsGroup : 10001
4347
4448securityContext :
4549 capabilities :
@@ -98,6 +102,11 @@ tolerations: []
98102
99103affinity : {}
100104
105+ networkPolicy :
106+ enabled : true
107+ ingress : []
108+ egress : []
109+
101110# chart dependencies
102111mysql :
103112 fullnameOverride : mysql
You can’t perform that action at this time.
0 commit comments