Skip to content

Commit

Permalink
feat: Addressing feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
saumilmac committed Mar 6, 2024
1 parent ca4a6fc commit c2c394a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
11 changes: 11 additions & 0 deletions charts/snyk-broker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@ Create the name of the broker service to use
{{- else }}
{{- .Values.scmType}}-broker-service
{{- end -}}
{{- end -}}

{{/*
Create TLS secret name
*/}}
{{- define "tls-secret-name" -}}
{{- if not .Values.disableSuffixes -}}
tls-secret-{{ .Release.Name }}
{{- else -}}
tls-secret
{{- end -}}
{{- end -}}
10 changes: 5 additions & 5 deletions charts/snyk-broker/templates/broker_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ spec:
mountPath: /home/node/cacert
readOnly: true
{{- end }}
{{- if and .Values.httpsCert .Values.httpsKey }}
{{- if and (.Values.httpsCert) (.Values.httpsKey) }}
- name: {{ include "snyk-broker.fullname" . }}-tls-secret-volume
mountPath: /home/node/tls-cert/
readOnly: true
Expand Down Expand Up @@ -375,11 +375,11 @@ spec:
{{- if .Values.httpsCert }}
# HTTPS Config
- name: HTTPS_CERT
value: /home/node/tls-cert/{{ .Values.httpsCert }}
value: /home/node/tls-cert/tls.crt
{{- end }}
{{- if .Values.httpsKey }}
- name: HTTPS_KEY
value: /home/node/tls-cert/{{ .Values.httpsKey }}
value: /home/node/tls-cert/tls.key
{{- end }}

{{- if .Values.tlsRejectUnauthorized }}
Expand Down Expand Up @@ -455,10 +455,10 @@ spec:
configMap:
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
{{- end }}
{{- if and .Values.httpsCert .Values.httpsKey }}
{{- if and (.Values.httpsCert) (.Values.httpsKey) }}
- name: {{ include "snyk-broker.fullname" . }}-tls-secret-volume
secret:
secretName: "tls-secret{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
secretName: {{ include "tls-secret-name" . }}
{{- end }}
{{- if .Values.extraVolumes }}
{{ tpl (toYaml .Values.extraVolumes | indent 6) . }}
Expand Down
13 changes: 7 additions & 6 deletions charts/snyk-broker/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,14 @@ data:
"nexus-nexus-url": {{ .Values.nexusUrl | b64enc | quote }}
---
{{- end}}
{{- if and .Values.httpsCert .Values.httpsKey }}
{{- if and (.Values.httpsCert) (.Values.httpsKey) }}
apiVersion: v1
kind: Secret
metadata:
name: tls-secret{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
type: Opaque
name: {{ include "tls-secret-name" . }}
type: kubernetes.io/tls
data:
"{{ .Values.httpsCert }}": {{ (.Files.Get .Values.httpsCert) | b64enc | quote }}
"{{ .Values.httpsKey }}": {{ (.Files.Get .Values.httpsKey) | b64enc | quote }}
{{- end }}
tls.crt: {{ (.Files.Get .Values.httpsCert) | b64enc | quote }}
tls.key: {{ (.Files.Get .Values.httpsKey) | b64enc | quote }}
---
{{- end }}
21 changes: 5 additions & 16 deletions charts/snyk-broker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ logEnableBody: "false"
##### Enable HTTPS #####

# Location of mounted cert
httpsCert: ""
httpsCert: "MyCertificate.crt"

# Location of mounted HTTPS key
httpsKey: ""
httpsKey: "MyKey.key"

##### HTTPS Inspection #####

Expand Down Expand Up @@ -320,31 +320,20 @@ podSecurityContext: {}
# These can be adjusted at your own risk.

securityContext:
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
runAsUser: 0

securityContextCr:
capabilities:
drop:
- ALL
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 1000
runAsUser: 0

securityContextCa:
capabilities:
drop:
- ALL
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
runAsNonRoot: true
runAsUser: 1000
runAsUser: 0

##### Service Types #####
# If you prefer to adjust how communication to the cluster occurs, these values can be adjusted
Expand Down

0 comments on commit c2c394a

Please sign in to comment.