Skip to content

Commit 19aa6a7

Browse files
authored
feat: Add support for extraContainers (#67)
Signed-off-by: Asgeir Nilsen <[email protected]>
1 parent 22582a6 commit 19aa6a7

File tree

10 files changed

+182
-2
lines changed

10 files changed

+182
-2
lines changed

charts/zot/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ appVersion: v2.1.5
33
description: A Helm chart for Kubernetes
44
name: zot
55
type: application
6-
version: 0.1.73
6+
version: 0.1.74

charts/zot/templates/deployment.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ spec:
121121
{{- end }}
122122
resources:
123123
{{- toYaml .Values.resources | nindent 12 }}
124+
{{- with .Values.extraContainers }}
125+
{{- toYaml . | nindent 8 }}
126+
{{- end }}
124127
volumes:
125128
- name: data
126129
emptyDir: {}
@@ -159,4 +162,4 @@ spec:
159162
{{- toYaml . | nindent 8 }}
160163
{{- end }}
161164
dnsPolicy: {{ .Values.dnsPolicy }}
162-
{{ end }}
165+
{{ end }}

charts/zot/templates/statefulset.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ spec:
134134
{{- end }}
135135
resources:
136136
{{- toYaml .Values.resources | nindent 12 }}
137+
{{- with .Values.extraContainers }}
138+
{{- toYaml . | nindent 8 }}
139+
{{- end }}
137140
{{- if or .Values.mountConfig .Values.mountSecret .Values.externalSecrets (not (empty .Values.extraVolumes)) }}
138141
volumes:
139142
{{- if .Values.mountConfig }}

charts/zot/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ extraVolumes: []
172172
# - name: data
173173
# emptyDir: {}
174174

175+
# Extra Containers running alongside the main container
176+
extraContainers: []
177+
# - name: data
178+
# image: busybox
179+
# command: ["sleep", "infinity"]
180+
175181
# Deployment strategy type
176182
strategy:
177183
type: RollingUpdate
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/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: extra-container-persistence
3+
description: Test chart for zot extra-container values with persistence enabled
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
dependencies:
8+
- name: zot
9+
version: ~0.1.39
10+
repository: "file://../../../charts/zot"
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
zot:
2+
# Enable persistence to test extraContainers with StatefulSet
3+
persistence: true
4+
5+
# PVC configuration for StatefulSet
6+
pvc:
7+
create: true
8+
storage: 1Gi
9+
accessModes: ["ReadWriteOnce"]
10+
11+
# Test extraContainers functionality with StatefulSet
12+
extraContainers:
13+
- name: sidecar-redis
14+
image: redis:alpine
15+
ports:
16+
- containerPort: 6379
17+
name: redis
18+
protocol: TCP
19+
command: ["redis-server"]
20+
args: ["--appendonly", "yes"]
21+
volumeMounts:
22+
- name: redis-data
23+
mountPath: /data
24+
resources:
25+
limits:
26+
memory: "256Mi"
27+
cpu: "200m"
28+
requests:
29+
memory: "128Mi"
30+
cpu: "100m"
31+
- name: monitoring-agent
32+
image: busybox:latest
33+
command: ["sh", "-c"]
34+
args: ["while true; do echo 'Monitoring StatefulSet pod'; df -h; sleep 60; done"]
35+
resources:
36+
limits:
37+
memory: "64Mi"
38+
cpu: "50m"
39+
requests:
40+
memory: "32Mi"
41+
cpu: "25m"
42+
43+
# Add extra volumes to support the sidecar containers
44+
extraVolumes:
45+
- name: redis-data
46+
emptyDir: {}
47+
48+
# Set security context for testing
49+
securityContext:
50+
runAsUser: 1000
51+
runAsGroup: 1000
52+
fsGroup: 1000
53+
54+
# Use lower resource requirements for testing
55+
resources:
56+
limits:
57+
memory: "512Mi"
58+
cpu: "500m"
59+
requests:
60+
memory: "256Mi"
61+
cpu: "250m"
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/
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v2
2+
name: extra-container
3+
description: Test chart for zot extra-container values
4+
type: application
5+
version: 0.1.0
6+
appVersion: "0.1.0"
7+
dependencies:
8+
- name: zot
9+
version: ~0.1.39
10+
repository: "file://../../../charts/zot"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
zot:
2+
# Test extraContainers functionality with both deployment and statefulset scenarios
3+
extraContainers:
4+
- name: sidecar-nginx
5+
image: nginx:alpine
6+
ports:
7+
- containerPort: 80
8+
name: http
9+
protocol: TCP
10+
volumeMounts:
11+
- name: shared-data
12+
mountPath: /usr/share/nginx/html
13+
resources:
14+
limits:
15+
memory: "128Mi"
16+
cpu: "100m"
17+
requests:
18+
memory: "64Mi"
19+
cpu: "50m"
20+
- name: busybox-logger
21+
image: busybox:latest
22+
command: ["sh", "-c"]
23+
args: ["while true; do echo 'Logging from sidecar'; sleep 30; done"]
24+
resources:
25+
limits:
26+
memory: "64Mi"
27+
cpu: "50m"
28+
requests:
29+
memory: "32Mi"
30+
cpu: "25m"
31+
32+
# Add extra volumes to support the sidecar containers
33+
extraVolumes:
34+
- name: shared-data
35+
emptyDir: {}
36+
37+
# Set security context for testing
38+
securityContext:
39+
runAsUser: 1000
40+
runAsGroup: 1000
41+
fsGroup: 1000

0 commit comments

Comments
 (0)