Skip to content

Commit

Permalink
feat: Allow to override ServiceAccount (#52)
Browse files Browse the repository at this point in the history
* feat: Allow to override ServiceAccount

Signed-off-by: Arnaud Hatzenbuhler <[email protected]>

* chore: Bump chart version

Signed-off-by: Arnaud Hatzenbuhler <[email protected]>

---------

Signed-off-by: Arnaud Hatzenbuhler <[email protected]>
Co-authored-by: Arnaud Hatzenbuhler <[email protected]>
  • Loading branch information
Wihrt and ahatzenbuhler authored May 14, 2024
1 parent afaa107 commit 45472c8
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 7 deletions.
10 changes: 5 additions & 5 deletions charts/dependency-track/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apiVersion: v2
name: dependency-track
version: 0.4.0
version: 0.4.1
type: application
appVersion: 4.11.0
description: |-
Dependency-Track is an intelligent Component Analysis platform
that allows organizations to identify and reduce risk in the software supply chain.
home: https://github.com/DependencyTrack/dependency-track
sources:
- https://github.com/DependencyTrack/helm-charts/tree/main/charts/dependency-track
- https://github.com/DependencyTrack/helm-charts/tree/main/charts/dependency-track
icon: https://avatars.githubusercontent.com/u/40258585
maintainers:
- name: nscuro
email: [email protected]
url: https://github.com/nscuro
- name: nscuro
email: [email protected]
url: https://github.com/nscuro
6 changes: 6 additions & 0 deletions charts/dependency-track/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ that allows organizations to identify and reduce risk in the software supply cha
| common.nameOverride | string | `""` | |
| common.secretKey.createSecret | bool | `false` | Whether the chart should generate a secret key upon deployment. |
| common.secretKey.existingSecretName | string | `""` | Use the secret key defined in an existing secret. |
| common.serviceAccount.annotations | object | `{}` | |
| common.serviceAccount.automount | bool | `false` | Whether the serviceAccount should mount the token. |
| common.serviceAccount.create | bool | `true` | Whether the chart should generate a serviceAccount |
| common.serviceAccount.name | string | `""` | Use the name of the name of the release by default, or specify a custom name. |
| extraObjects | list | `[]` | Create extra manifests via values. |
| frontend.additionalVolumeMounts | list | `[]` | |
| frontend.additionalVolumes | list | `[]` | |
Expand Down Expand Up @@ -105,3 +109,5 @@ that allows organizations to identify and reduce risk in the software supply cha
| ingress.ingressClassName | string | `""` | |
| ingress.tls | list | `[]` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
15 changes: 14 additions & 1 deletion charts/dependency-track/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,17 @@ Frontend image
{{- else if .Values.common.secretKey.createSecret -}}
{{- printf "%s-secret-key" (include "dependencytrack.fullname" .) -}}
{{- end -}}
{{- end -}}
{{- end -}}


{{/*
Create the name of the service account
*/}}
{{- define "dependencytrack.serviceAccountName" -}}
{{- if .Values.common.serviceAccount.create }}
{{- default (include "dependencytrack.fullname" .) .Values.common.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.common.serviceAccount.name }}
{{- end }}
{{- end }}

Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ spec:
{{- if .Values.apiServer.initContainers }}
{{- toYaml .Values.apiServer.initContainers | nindent 6 }}
{{- end }}
serviceAccount: {{ include "dependencytrack.serviceAccountName" . }}
containers:
- name: {{ include "dependencytrack.apiServerName" . }}
image: {{ include "dependencytrack.apiServerImage" . }}
Expand Down
1 change: 1 addition & 0 deletions charts/dependency-track/templates/frontend/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spec:
{{- if .Values.frontend.initContainers }}
{{- toYaml .Values.frontend.initContainers | nindent 6 }}
{{- end }}
serviceAccount: {{ include "dependencytrack.serviceAccountName" . }}
containers:
- name: {{ include "dependencytrack.frontendName" . }}
image: {{ include "dependencytrack.frontendImage" . }}
Expand Down
9 changes: 9 additions & 0 deletions charts/dependency-track/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{- if .Values.common.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "dependencytrack.serviceAccountName" . }}
labels: {{- include "dependencytrack.commonLabels" . | nindent 4 }}
annotations: {{- toYaml .Values.common.serviceAccount.annotations | nindent 4 }}
automountServiceAccountToken: {{ .Values.common.serviceAccount.automount }}
{{- end }}
11 changes: 10 additions & 1 deletion charts/dependency-track/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ common:
createSecret: false
# -- Use the secret key defined in an existing secret.
existingSecretName: ""
serviceAccount:
# -- Whether the chart should generate a serviceAccount
create: true
annotations: {}
# -- Use the name of the name of the release by default, or specify a custom name.
name: ""
# -- Whether the serviceAccount should mount the token.
automount: false

apiServer:
annotations: {}
Expand Down Expand Up @@ -146,7 +154,8 @@ ingress:
# - example.com

# -- Create extra manifests via values.
extraObjects: []
extraObjects:
[]
# - apiVersion: "kubernetes-client.io/v1"
# kind: ExternalSecret
# metadata:
Expand Down

0 comments on commit 45472c8

Please sign in to comment.