我在我的Helm中有一个PodSecurityPolicy,并且希望动态地更改runAsUser上的rule。
如果启用了{{- if .Values.global.psp.enabled }},并且相应的values.yaml包含如下内容:
runAsUnprivilegedUser: true 我希望模板会像这样呈现:
runAsUser:
# Require the container to run without root privileges.
rule: 'MustRunAsNonRoot'另外,还提供了一个默认的非根用户,比如UID 1000。
另一方面,如果runAsUnprivilegedUser设置为false,我希望
runAsUser:
rule: 'RunAsAny'受雇的。
发布于 2020-04-24 12:10:43
我想你可以用条件语句来做
kind: PodSecurityPolicy
apiVersion: policy/v1beta1
metadata:
name: allow-flex-volumes
spec:
runAsUser:
# Require the container to run without root privileges.
{{- if and .Values.global.psp .Values.podSecurityContext}}
rule: 'MustRunAsNonRoot'
{{else }}
rule: 'RunAsAny'
{{end}}https://stackoverflow.com/questions/61407140
复制相似问题