Skip to content

Commit

Permalink
Helm chart: Add readOnlyRootFilesystem to securityContext
Browse files Browse the repository at this point in the history
Added readOnlyRootFilesystem to default securityContext to all helm charts.

Releated to issue #129.

Signed-off-by: Lianhao Lu <[email protected]>
  • Loading branch information
lianhao authored and yongfengdu committed Jul 5, 2024
1 parent 8ffc3bc commit 9367a9c
Show file tree
Hide file tree
Showing 25 changed files with 80 additions and 2 deletions.
1 change: 1 addition & 0 deletions helm-charts/chatqna/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ service:
port: 8888

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/chatqna/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- mountPath: /tmp
name: tmp
ports:
- name: chatqna
containerPort: {{ .Values.port }}
Expand All @@ -64,6 +67,9 @@ spec:
# port: {{ .Values.port }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/chatqna/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ service:
port: 8888

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
1 change: 1 addition & 0 deletions helm-charts/codegen/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ service:
port: 7778

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/codegen/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- mountPath: /tmp
name: tmp
ports:
- name: codegen
containerPort: {{ .Values.port }}
Expand All @@ -60,6 +63,9 @@ spec:
# port: {{ .Values.port }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/codegen/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ service:
port: 7778

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/common/embedding-usvc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ spec:
- name: embedding-usvc
containerPort: {{ .Values.service.targetPort }}
protocol: TCP
volumeMounts:
- mountPath: /tmp
name: tmp
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/embedding-usvc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/llm-uservice/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
8 changes: 8 additions & 0 deletions helm-charts/common/llm-uservice/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ spec:
value: "http://{{ .Release.Name }}-tgi"
- name: HUGGINGFACEHUB_API_TOKEN
value: {{ .Values.global.HUGGINGFACEHUB_API_TOKEN | quote}}
- name: HF_HOME
value: "/tmp/.cache/huggingface"
- name: http_proxy
value: {{ .Values.global.http_proxy }}
- name: https_proxy
Expand All @@ -54,6 +56,9 @@ spec:
- name: llm-uservice
containerPort: 9000
protocol: TCP
volumeMounts:
- mountPath: /tmp
name: tmp
startupProbe:
exec:
command:
Expand All @@ -64,6 +69,9 @@ spec:
failureThreshold: 120
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/llm-uservice/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
4 changes: 4 additions & 0 deletions helm-charts/common/redis-vector-db/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ spec:
name: data-volume
- mountPath: /redisinsight
name: redisinsight-volume
- mountPath: /tmp
name: tmp
ports:
{{- $redisServicePort := index .Values.service.ports 0 }}
{{- range .Values.service.ports }}
Expand All @@ -58,6 +60,8 @@ spec:
emptyDir: {}
- name: redisinsight-volume
emptyDir: {}
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/redis-vector-db/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/common/reranking-usvc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ spec:
- name: reranking-usvc
containerPort: {{ .Values.service.targetPort }}
protocol: TCP
volumeMounts:
- mountPath: /tmp
name: tmp
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/reranking-usvc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
10 changes: 10 additions & 0 deletions helm-charts/common/retriever-usvc/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
value: "redis://{{ .Release.Name }}-redis-vector-db:6379"
- name: INDEX_NAME
value: "rag-redis"
- name: EASYOCR_MODULE_PATH
value: "/tmp/.EasyOCR"
- name: http_proxy
value: {{ .Values.global.http_proxy }}
- name: https_proxy
Expand All @@ -48,6 +50,8 @@ spec:
value: {{ .Values.global.LANGCHAIN_API_KEY }}
- name: LANGCHAIN_PROJECT
value: "opea-retriever-service"
- name: HF_HOME
value: "/tmp/.cache/huggingface"
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}"
Expand All @@ -56,6 +60,9 @@ spec:
- name: retriever-usvc
containerPort: 7000
protocol: TCP
volumeMounts:
- mountPath: /tmp
name: tmp
startupProbe:
exec:
command:
Expand All @@ -74,6 +81,9 @@ spec:
# port: 7000
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/retriever-usvc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/common/tei/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ spec:
value: /tmp
- name: TRANSFORMERS_CACHE
value: /tmp/transformers_cache
- name: HF_HOME
value: "/tmp/.cache/huggingface"
securityContext:
{{- if .Values.global.modelUseHostPath }}
{}
Expand All @@ -57,6 +59,8 @@ spec:
name: model-volume
- mountPath: /dev/shm
name: shm
- mountPath: /tmp
name: tmp
ports:
- name: http
containerPort: {{ .Values.port }}
Expand All @@ -76,6 +80,8 @@ spec:
emptyDir:
medium: Memory
sizeLimit: {{ .Values.shmSize }}
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/tei/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/common/teirerank/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{{- end }}

2. Use this command to verify teirerank service:
curl ${teirerank_svc_ip}/embed \
curl ${teirerank_svc_ip}/rerank\
-X POST \
-d '{"inputs":"What is Deep Learning?"}' \
-d '{"query":"What is Deep Learning?", "texts": ["Deep Learning is not...", "Deep learning is..."]}' \
-H 'Content-Type: application/json'
6 changes: 6 additions & 0 deletions helm-charts/common/teirerank/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ spec:
value: /tmp
- name: TRANSFORMERS_CACHE
value: /tmp/transformers_cache
- name: HF_HOME
value: "/tmp/.cache/huggingface"
securityContext:
{{- if .Values.global.modelUseHostPath }}
{}
Expand All @@ -57,6 +59,8 @@ spec:
name: model-volume
- mountPath: /dev/shm
name: shm
- mountPath: /tmp
name: tmp
ports:
- name: http
containerPort: {{ .Values.port }}
Expand All @@ -76,6 +80,8 @@ spec:
emptyDir:
medium: Memory
sizeLimit: {{ .Values.shmSize }}
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/teirerank/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/tgi/gaudi-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down
6 changes: 6 additions & 0 deletions helm-charts/common/tgi/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ spec:
value: /tmp/numba_cache
- name: TRANSFORMERS_CACHE
value: /tmp/transformers_cache
- name: HF_HOME
value: "/tmp/.cache/huggingface"
securityContext:
{{- if .Values.global.modelUseHostPath }}
{}
Expand All @@ -61,6 +63,8 @@ spec:
volumeMounts:
- mountPath: /data
name: model-volume
- mountPath: /tmp
name: tmp
ports:
- name: http
containerPort: {{ .Values.port }}
Expand All @@ -76,6 +80,8 @@ spec:
{{- else }}
emptyDir: {}
{{- end }}
- name: tmp
emptyDir: {}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
1 change: 1 addition & 0 deletions helm-charts/common/tgi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ podSecurityContext: {}
# fsGroup: 2000

securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
Expand Down

0 comments on commit 9367a9c

Please sign in to comment.