Skip to content
This repository was archived by the owner on Apr 14, 2025. It is now read-only.

Commit 72dd720

Browse files
committed
feat: ds mode support
1 parent 8792580 commit 72dd720

File tree

4 files changed

+137
-2
lines changed

4 files changed

+137
-2
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{{ if eq .Values.DeploymentMode "DaemonSet" }}
2+
apiVersion: apps/v1
3+
kind: DaemonSet
4+
metadata:
5+
name: {{ include "s3proxy.fullname" . }}
6+
labels:
7+
{{- include "s3proxy.labels" . | nindent 4 }}
8+
annotations:
9+
checkov.io/skip1: CKV_K8S_35=Inorder to use a generated secret in two ways we can't do this
10+
spec:
11+
selector:
12+
matchLabels:
13+
{{- include "s3proxy.selectorLabels" . | nindent 6 }}
14+
template:
15+
metadata:
16+
{{- with .Values.podAnnotations }}
17+
annotations:
18+
{{- toYaml . | nindent 8 }}
19+
{{- end }}
20+
labels:
21+
{{- include "s3proxy.selectorLabels" . | 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+
serviceAccountName: {{ include "s3proxy.serviceAccountName" . }}
31+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken | default false }}
32+
33+
securityContext:
34+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
35+
containers:
36+
- name: {{ .Chart.Name }}
37+
securityContext:
38+
{{- toYaml .Values.securityContext | nindent 12 }}
39+
#checkov:skip=CKV_K8S_43: Not for Public Charts
40+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
41+
imagePullPolicy: {{ .Values.image.pullPolicy }}
42+
command:
43+
{{- .Values.command | toYaml | nindent 12 }}
44+
args:
45+
{{- .Values.args | toYaml | nindent 12 }}
46+
env:
47+
- name: S3PROXY_IDENTITY
48+
valueFrom:
49+
secretKeyRef:
50+
{{- if empty .Values.existingSecretName }}
51+
name: "{{ include "s3proxy.fullname" . }}-awsclient"
52+
{{- else }}
53+
name: {{ .Values.existingSecretName }}
54+
{{- end }}
55+
key: AWS_ACCESS_KEY_ID
56+
optional: false
57+
- name: S3PROXY_CREDENTIAL
58+
valueFrom:
59+
secretKeyRef:
60+
{{- if empty .Values.existingSecretName }}
61+
name: "{{ include "s3proxy.fullname" . }}-awsclient"
62+
{{- else }}
63+
name: {{ .Values.existingSecretName }}
64+
{{- end }}
65+
key: AWS_SECRET_ACCESS_KEY
66+
optional: false
67+
{{- with .Values.config.env }}
68+
{{- toYaml . | nindent 10 }}
69+
{{- end }}
70+
ports:
71+
- name: http
72+
containerPort: {{ .Values.service.port }}
73+
protocol: TCP
74+
# livenessProbe:
75+
# httpGet:
76+
# path: /
77+
# port: http
78+
# readinessProbe:
79+
# httpGet:
80+
# path: /
81+
# port: http
82+
resources:
83+
{{- toYaml .Values.resources | nindent 12 }}
84+
volumeMounts:
85+
{{- if eq .Values.config.jclouds.provider "filesystem" }}
86+
- mountPath: {{ .Values.config.jclouds.filesystem.baseDir }}
87+
name: tmp-volume
88+
{{- end }}
89+
- name: secret-volume
90+
readOnly: true
91+
mountPath: "/etc/s3proxy"
92+
volumes:
93+
{{- if eq .Values.config.jclouds.provider "filesystem" }}
94+
- name: tmp-volume
95+
emptyDir:
96+
sizeLimit: {{ .Values.config.jclouds.filesystem.tmpSize }}
97+
{{- end }}
98+
- name: secret-volume
99+
{{- if .Values.csiSecret.enabled }}
100+
csi:
101+
driver: {{ .Values.csiSecret.driver | default "secrets-store.csi.k8s.io" }}
102+
readOnly: {{ .Values.csiSecret.readOnly | default true }}
103+
volumeAttributes:
104+
secretProviderClass: {{ .Values.csiSecret.class }}
105+
{{ else }}
106+
secret:
107+
{{- if .Values.existingPropertiesSecret }}
108+
secretName: {{ .Values.existingPropertiesSecret }}
109+
{{ else }}
110+
secretName: {{ include "s3proxy.fullname" . }}
111+
{{- end }}
112+
{{- end }}
113+
{{- with .Values.nodeSelector }}
114+
nodeSelector:
115+
{{- toYaml . | nindent 8 }}
116+
{{- end }}
117+
{{- with .Values.affinity }}
118+
affinity:
119+
{{- toYaml . | nindent 8 }}
120+
{{- end }}
121+
{{- with .Values.tolerations }}
122+
tolerations:
123+
{{- toYaml . | nindent 8 }}
124+
{{- end }}
125+
{{- with .Values.topologySpreadConstraints }}
126+
topologySpreadConstraints:
127+
{{- toYaml . | nindent 8 }}
128+
{{- end }}
129+
{{- end }}

charts/s3proxy/templates/deployment.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{ if eq .Values.DeploymentMode "Deployment" }}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
@@ -30,7 +31,8 @@ spec:
3031
{{- toYaml . | nindent 8 }}
3132
{{- end }}
3233
serviceAccountName: {{ include "s3proxy.serviceAccountName" . }}
33-
automountServiceAccountToken: false
34+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken | default false }}
35+
3436
securityContext:
3537
{{- toYaml .Values.podSecurityContext | nindent 8 }}
3638
containers:
@@ -127,3 +129,4 @@ spec:
127129
topologySpreadConstraints:
128130
{{- toYaml . | nindent 8 }}
129131
{{- end }}
132+
{{- end }}

charts/s3proxy/templates/hpa.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.DeploymentMode "Deployment" }}
12
{{- if .Values.autoscaling.enabled }}
23
apiVersion: autoscaling/v2
34
kind: HorizontalPodAutoscaler
@@ -30,3 +31,4 @@ spec:
3031
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
3132
{{- end }}
3233
{{- end }}
34+
{{- end }}

charts/s3proxy/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Default values for s3proxy.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
4-
4+
DeploymentMode: Deployment
55
replicaCount: 1
66
labels: {}
77
podLabels: {}
@@ -50,6 +50,7 @@ serviceAccount:
5050
# The name of the service account to use.
5151
# If not set and create is true, a name is generated using the fullname template
5252
name: ""
53+
automountServiceAccountToken: false
5354

5455
podAnnotations: {}
5556

0 commit comments

Comments
 (0)