Skip to content

Commit

Permalink
feat: Add extraEnv option to Helm chart (#2288)
Browse files Browse the repository at this point in the history
* Add extraEnv option to Helm chart

* Document extraEnv config option

* Reindent comments to ensure auto-formatting is not confused
  • Loading branch information
gnadaban authored Jan 15, 2025
1 parent 73fe67c commit 2a57ee8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions deploy/helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Keeps security report resources updated
| compliance.reportType | string | `"summary"` | reportType this flag control the type of report generated (summary or all) |
| compliance.specs | list | `["k8s-cis-1.23","k8s-nsa-1.0","k8s-pss-baseline-0.1","k8s-pss-restricted-0.1"]` | specs is a list of compliance specs to be used by the cluster compliance scanner - k8s-cis-1.23 - k8s-nsa-1.0 - k8s-pss-baseline-0.1 - k8s-pss-restricted-0.1 - eks-cis-1.4 - rke2-cis-1.24 |
| excludeNamespaces | string | `""` | excludeNamespaces is a comma separated list of namespaces (or glob patterns) to be excluded from scanning. Only applicable in the all namespaces install mode, i.e. when the targetNamespaces values is a blank string. |
| extraEnv | list | `[]` | extraEnv is a list of extra environment variables for the trivy-operator. |
| fullnameOverride | string | `""` | fullnameOverride override operator full name |
| global | object | `{"image":{"registry":""}}` | global values provide a centralized configuration for 'image.registry', reducing the potential for errors. If left blank, the chart will default to the individually set 'image.registry' values |
| image.pullPolicy | string | `"IfNotPresent"` | pullPolicy set the operator pullPolicy |
Expand Down
5 changes: 4 additions & 1 deletion deploy/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
{{- with .Values.operator.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
labels:
labels:
{{- include "trivy-operator.labels" . | nindent 4 }}
{{- with .Values.operator.labels }}
{{- toYaml . | nindent 4 }}
Expand Down Expand Up @@ -50,6 +50,9 @@ spec:
value: {{ tpl .Values.targetWorkloads . | quote }}
- name: OPERATOR_SERVICE_ACCOUNT
value: {{ include "trivy-operator.serviceAccountName" . | quote }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
envFrom:
- configMapRef:
name: trivy-operator-config
Expand Down
31 changes: 17 additions & 14 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ targetNamespaces: ""
# mode, i.e. when the targetNamespaces values is a blank string.
excludeNamespaces: ""

# -- extraEnv is a list of extra environment variables for the trivy-operator.
extraEnv: []

# -- targetWorkloads is a comma seperated list of Kubernetes workload resources
# to be included in the vulnerability and config-audit scans
# if left blank, all workload resources will be scanned
Expand Down Expand Up @@ -636,7 +639,7 @@ serviceAccount:
podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000
# fsGroup: 2000

# -- securityContext security context
securityContext:
Expand All @@ -659,16 +662,17 @@ volumes:
emptyDir: {}

resources: {}
# -- We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
# -- We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# -- nodeSelector set the operator nodeSelector
nodeSelector: {}

Expand All @@ -681,7 +685,7 @@ affinity: {}
# -- priorityClassName set the operator priorityClassName
priorityClassName: ""

# -- automountServiceAccountToken the flag to enable automount for service account token
# -- automountServiceAccountToken the flag to enable automount for service account token
automountServiceAccountToken: true

policiesBundle:
Expand All @@ -691,7 +695,7 @@ policiesBundle:
repository: aquasec/trivy-checks
# -- tag version of the policies bundle
tag: 1
# -- registryUser is the user for the registry
# -- registryUser is the user for the registry
registryUser: ~
# -- registryPassword is the password for the registry
registryPassword: ~
Expand All @@ -703,7 +707,6 @@ policiesBundle:
# -- insecure is the flag to enable insecure connection to the policy bundle registry
insecure: false


nodeCollector:
# -- useNodeSelector determine if to use nodeSelector (by auto detecting node name) with node-collector scan job
useNodeSelector: true
Expand Down

0 comments on commit 2a57ee8

Please sign in to comment.