Skip to content
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.

Commit

Permalink
fix: allow setting proxies when trivy is disabled (#308)
Browse files Browse the repository at this point in the history
* allow setting proxies when trivy is disabled

* move variable definition to top of file
  • Loading branch information
florentinadolf authored Jan 29, 2023
1 parent 7a91f7f commit fc0b0c3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions charts/kubeclarity/templates/scanner-template-configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
{{- $noproxy := list (print (include "kubeclarity.name" .) "." .Release.Namespace ":" (index .Values "kubeclarity-runtime-scan" "resultServicePort")) -}}
{{- if index .Values "kubeclarity-grype-server" "enabled" -}}
{{- $noproxy = append $noproxy (print (include "kubeclarity.grype-server.name" .) "." .Release.Namespace ":" (index .Values "kubeclarity-grype-server" "servicePort")) -}}
{{- end -}}
{{- if index .Values "kubeclarity-trivy-server" "enabled" -}}
{{- $noproxy = append $noproxy (print ((index .Values "kubeclarity-trivy-server" "service" "name") | default (include "trivy.fullname" (index .Subcharts "kubeclarity-trivy-server"))) "." .Release.Namespace ":" (index .Values "kubeclarity-trivy-server" "service" "port")) -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
Expand Down Expand Up @@ -109,10 +116,10 @@ data:
{{- end}}
{{- if index .Values "kubeclarity-runtime-scan" "httpsProxy" }}
- name: NO_PROXY
value: {{ include "kubeclarity.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-runtime-scan" "resultServicePort" }},{{ include "kubeclarity.grype-server.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-grype-server" "servicePort" }},{{ (index .Values "kubeclarity-trivy-server" "service" "name") | default (include "trivy.fullname" (index .Subcharts "kubeclarity-trivy-server")) }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-trivy-server" "service" "port" }}
value: {{ join "," $noproxy }}
{{- else if index .Values "kubeclarity-runtime-scan" "httpProxy" }}
- name: NO_PROXY
value: {{ include "kubeclarity.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-runtime-scan" "resultServicePort" }},{{ include "kubeclarity.grype-server.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-grype-server" "servicePort" }},{{ (index .Values "kubeclarity-trivy-server" "service" "name") | default (include "trivy.fullname" (index .Subcharts "kubeclarity-trivy-server")) }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-trivy-server" "service" "port" }}
value: {{ join "," $noproxy }}
{{- end}}
securityContext:
capabilities:
Expand Down Expand Up @@ -158,10 +165,10 @@ data:
{{- end}}
{{- if index .Values "kubeclarity-runtime-scan" "httpsProxy" }}
- name: NO_PROXY
value: {{ include "kubeclarity.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-runtime-scan" "resultServicePort" }},{{ include "kubeclarity.grype-server.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-grype-server" "servicePort" }},{{ (index .Values "kubeclarity-trivy-server" "service" "name") | default (include "trivy.fullname" (index .Subcharts "kubeclarity-trivy-server")) }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-trivy-server" "service" "port" }}
value: {{ join "," $noproxy }}
{{- else if index .Values "kubeclarity-runtime-scan" "httpProxy" }}
- name: NO_PROXY
value: {{ include "kubeclarity.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-runtime-scan" "resultServicePort" }},{{ include "kubeclarity.grype-server.name" . }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-grype-server" "servicePort" }},{{ (index .Values "kubeclarity-trivy-server" "service" "name") | default (include "trivy.fullname" (index .Subcharts "kubeclarity-trivy-server")) }}.{{ .Release.Namespace }}:{{ index .Values "kubeclarity-trivy-server" "service" "port" }}
value: {{ join "," $noproxy }}
{{- end}}
securityContext:
capabilities:
Expand Down

0 comments on commit fc0b0c3

Please sign in to comment.