Skip to content

Commit 67eb352

Browse files
committed
chore: fix chart lint issues
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent cb3b9dd commit 67eb352

13 files changed

Lines changed: 143 additions & 47 deletions

File tree

tests/charts/application/Chart.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ dependencies:
22
- name: mysql
33
repository: https://charts.bitnami.com/bitnami
44
version: 14.0.3
5-
digest: sha256:801482030fdbfbb0e9bc66d808541458d0549644d295c43c088203014920c9c9
6-
generated: "2025-08-15T04:17:01.63589655Z"
5+
digest: sha256:80cd59471fc8937944ac535c25f1da52a9820c3f2ed001e3ed741adb41f9e121
6+
generated: "2026-05-18T15:28:04.623045457+02:00"

tests/charts/application/Chart.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: application
1616
# This is the chart version. This version number should be incremented each time you make changes
1717
# to the chart and its templates, including the app version.
1818
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19-
version: 0.0.0
19+
version: 0.0.1
2020

2121
# This is the version number of the application being deployed. This version number should be
2222
# incremented each time you make changes to the application. Versions are not expected to
@@ -28,3 +28,4 @@ dependencies:
2828
- name: mysql
2929
version: 14.0.3
3030
repository: https://charts.bitnami.com/bitnami
31+
condition: mysql.enabled

tests/charts/application/templates/configmap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: ConfigMap
44
apiVersion: v1
55
metadata:
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 }}
1010
data:

tests/charts/application/templates/deployment.yaml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ apiVersion: apps/v1
44
kind: Deployment
55
metadata:
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 }}
1010
spec:
@@ -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

tests/charts/application/templates/hpa.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ apiVersion: autoscaling/v2
55
kind: HorizontalPodAutoscaler
66
metadata:
77
name: {{ include "test-application.fullname" . }}
8+
namespace: {{ .Values.namespace | default "app-system" }}
89
labels:
910
{{- include "test-application.labels" . | nindent 4 }}
1011
spec:

tests/charts/application/templates/ingress.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ apiVersion: extensions/v1beta1
1818
kind: Ingress
1919
metadata:
2020
name: {{ $fullName }}
21+
namespace: {{ .Values.namespace | default "app-system" }}
2122
labels:
2223
{{- include "test-application.labels" . | nindent 4 }}
2324
{{- with .Values.ingress.annotations }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 }}

tests/charts/application/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v1
33
kind: Service
44
metadata:
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 }}
99
spec:

tests/charts/application/templates/serviceaccount.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ apiVersion: v1
33
kind: ServiceAccount
44
metadata:
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 }}

tests/charts/application/templates/tests/test-connection.yaml

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,54 @@ apiVersion: v1
44
kind: Pod
55
metadata:
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
1212
spec:
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"

0 commit comments

Comments
 (0)