Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port enhancement from dependency-track chart to hyades #91

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion charts/hyades/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Common labels
*/}}
{{- define "hyades.commonLabels" -}}
helm.sh/chart: {{ include "hyades.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/part-of: {{ include "hyades.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
Expand All @@ -54,6 +53,7 @@ API server labels
{{- define "hyades.apiServerLabels" -}}
{{ include "hyades.commonLabels" . }}
{{ include "hyades.apiServerSelectorLabels" . }}
app.kubernetes.io/version: {{ (.Values.apiServer.image.tag | default .Chart.AppVersion) | quote }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -93,6 +93,7 @@ Frontend labels
{{- define "hyades.frontendLabels" -}}
{{ include "hyades.commonLabels" . }}
{{ include "hyades.frontendSelectorLabels" . }}
app.kubernetes.io/version: {{ (.Values.frontend.image.tag | default .Chart.AppVersion) | quote }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -132,6 +133,7 @@ Mirror service labels
{{- define "hyades.mirrorServiceLabels" -}}
{{ include "hyades.commonLabels" . }}
{{ include "hyades.mirrorServiceSelectorLabels" . }}
app.kubernetes.io/version: {{ (.Values.mirrorService.image.tag | default .Chart.AppVersion) | quote }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -171,6 +173,7 @@ Notification publisher labels
{{- define "hyades.notificationPublisherLabels" -}}
{{ include "hyades.commonLabels" . }}
{{ include "hyades.notificationPublisherSelectorLabels" . }}
app.kubernetes.io/version: {{ (.Values.notificationPublisher.image.tag | default .Chart.AppVersion) | quote }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -210,6 +213,7 @@ Repository metadata analyzer labels
{{- define "hyades.repoMetaAnalyzerLabels" -}}
{{ include "hyades.commonLabels" . }}
{{ include "hyades.repoMetaAnalyzerSelectorLabels" . }}
app.kubernetes.io/version: {{ (.Values.repoMetaAnalyzer.image.tag | default .Chart.AppVersion) | quote }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -249,6 +253,7 @@ Vulnerability analyzer labels
{{- define "hyades.vulnAnalyzerLabels" -}}
{{ include "hyades.commonLabels" . }}
{{ include "hyades.vulnAnalyzerSelectorLabels" . }}
app.kubernetes.io/version: {{ (.Values.vulnAnalyzer.image.tag | default .Chart.AppVersion) | quote }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -290,3 +295,14 @@ Vulnerability analyzer image
{{- printf "%s-secret-key" (include "hyades.fullname" .) -}}
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account
*/}}
{{- define "hyades.serviceAccountName" -}}
{{- if .Values.common.serviceAccount.create }}
{{- default (include "hyades.fullname" .) .Values.common.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.common.serviceAccount.name }}
{{- end }}
{{- end }}
25 changes: 22 additions & 3 deletions charts/hyades/templates/api-server/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ spec:
{{- with .Values.common.image.pullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 6 }}
{{- end }}
initContainers:
{{- with .Values.apiServer.initContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
serviceAccountName: {{ include "hyades.serviceAccountName" . }}
terminationGracePeriodSeconds: {{ .Values.apiServer.terminationGracePeriodSeconds }}
containers:
- name: {{ include "hyades.apiServerName" . }}
Expand Down Expand Up @@ -73,9 +78,8 @@ spec:
- name: KAFKA_TOPIC_PREFIX
value: {{ . | quote }}
{{- end }}
{{- range $k, $v := .Values.apiServer.extraEnv }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- with .Values.apiServer.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.apiServer.extraEnvFrom }}
envFrom: {{ toYaml . | nindent 8 }}
Expand All @@ -95,6 +99,9 @@ spec:
mountPath: /var/run/secrets/secret.key
readOnly: true
{{- end }}
{{- with .Values.apiServer.additionalVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
livenessProbe:
httpGet:
scheme: HTTP
Expand All @@ -115,6 +122,15 @@ spec:
periodSeconds: {{ .Values.apiServer.probes.readiness.periodSeconds }}
successThreshold: {{ .Values.apiServer.probes.readiness.successThreshold }}
timeoutSeconds: {{ .Values.apiServer.probes.readiness.timeoutSeconds }}
{{- with .Values.apiServer.extraContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.apiServer.tolerations }}
tolerations: {{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.apiServer.nodeSelector }}
nodeSelector: {{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: data
emptyDir: {}
Expand All @@ -125,4 +141,7 @@ spec:
secret:
secretName: {{ . }}
{{- end }}
{{- with .Values.apiServer.additionalVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
22 changes: 0 additions & 22 deletions charts/hyades/templates/api-server/ingress.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions charts/hyades/templates/api-server/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
name: {{ include "hyades.apiServerFullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "hyades.apiServerLabels" . | nindent 4 }}
{{- with .Values.apiServer.service.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.apiServer.service.type | quote }}
ports:
Expand Down
36 changes: 31 additions & 5 deletions charts/hyades/templates/frontend/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ spec:
{{- with .Values.common.image.pullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 6 }}
{{- end }}
initContainers:
{{- if .Values.frontend.initContainers }}
{{- toYaml .Values.frontend.initContainers | nindent 6 }}
{{- end }}
serviceAccountName: {{ include "hyades.serviceAccountName" . }}
containers:
- name: {{ include "hyades.frontendName" . }}
image: {{ include "hyades.frontendImage" . }}
Expand All @@ -39,14 +44,12 @@ spec:
{{- with .Values.frontend.args }}
args: {{ toYaml . | nindent 8 }}
{{- end }}
resources:
{{- toYaml .Values.frontend.resources | nindent 10 }}
resources: {{- toYaml .Values.frontend.resources | nindent 10 }}
env:
- name: API_BASE_URL
value: {{ .Values.frontend.apiBaseUrl | quote }}
{{- range $k, $v := .Values.frontend.extraEnv }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- with .Values.frontend.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.extraEnvFrom }}
envFrom: {{ toYaml . | nindent 8 }}
Expand All @@ -55,6 +58,12 @@ spec:
- name: web
containerPort: 8080
protocol: TCP
volumeMounts:
- name: tmp
mountPath: /tmp
{{- with .Values.frontend.additionalVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
livenessProbe:
httpGet:
scheme: HTTP
Expand All @@ -75,4 +84,21 @@ spec:
periodSeconds: {{ .Values.frontend.probes.readiness.periodSeconds }}
successThreshold: {{ .Values.frontend.probes.readiness.successThreshold }}
timeoutSeconds: {{ .Values.frontend.probes.readiness.timeoutSeconds }}
{{- with .Values.frontend.extraContainers }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with .Values.frontend.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.frontend.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: tmp
emptyDir: {}
{{- with .Values.frontend.additionalVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
23 changes: 0 additions & 23 deletions charts/hyades/templates/frontend/ingress.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions charts/hyades/templates/frontend/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ metadata:
name: {{ include "hyades.frontendFullname" . }}
namespace: {{ .Release.Namespace }}
labels: {{- include "hyades.frontendLabels" . | nindent 4 }}
{{- with .Values.frontend.service.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: {{ .Values.frontend.service.type | quote }}
ports:
Expand Down
46 changes: 46 additions & 0 deletions charts/hyades/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- if and .Values.ingress.enabled (or .Values.apiServer.enabled .Values.frontend.enabled) -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "hyades.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- with .Values.ingress.annotations }}
annotations: {{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.ingressClassName | empty | not }}
ingressClassName: {{ .Values.ingress.ingressClassName | quote }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
- host: {{ .Values.ingress.hostname | quote }}
http:
paths:
{{- if .Values.apiServer.enabled }}
- path: /api
pathType: Prefix
backend:
service:
name: {{ include "hyades.apiServerFullname" . }}
port:
name: web
{{- end }}
{{- if .Values.frontend.enabled }}
- path: /
pathType: Prefix
backend:
service:
name: {{ include "hyades.frontendFullname" . }}
port:
name: web
{{- end }}
{{- end }}
39 changes: 32 additions & 7 deletions charts/hyades/templates/mirror-service/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ spec:
{{- with .Values.common.image.pullSecrets }}
imagePullSecrets: {{- toYaml . | nindent 6 }}
{{- end }}
initContainers:
{{- if .Values.mirrorService.initContainers }}
{{- toYaml .Values.mirrorService.initContainers | nindent 6 }}
{{- end }}
serviceAccountName: {{ include "hyades.serviceAccountName" . }}
containers:
- name: {{ include "hyades.mirrorServiceName" . }}
image: {{ include "hyades.mirrorServiceImage" . }}
Expand All @@ -42,18 +47,32 @@ spec:
{{- with .Values.mirrorService.args }}
args: {{ toYaml . | nindent 8 }}
{{- end }}
resources:
{{- toYaml .Values.mirrorService.resources | nindent 10 }}
resources: {{- toYaml .Values.mirrorService.resources | nindent 10 }}
env:
{{- if (include "hyades.secretKeySecretName" .) }}
- name: SECRET_KEY_PATH
value: "/var/run/secrets/secret.key"
{{- end }}
{{- with .Values.common.database.jdbcUrl }}
- name: QUARKUS_DATASOURCE_JDBC_URL
value: {{ tpl . $ | quote }}
{{- end}}
{{- with .Values.common.database.username }}
- name: QUARKUS_DATASOURCE_USERNAME
value: {{ . | quote }}
{{- end }}
{{- with .Values.common.database.password }}
- name: QUARKUS_DATASOURCE_PASSWORD
value: {{ . | quote }}
{{- end }}
- name: KAFKA_BOOTSTRAP_SERVERS
value: {{ tpl .Values.common.kafka.bootstrapServers $ | quote }}
{{- with .Values.common.kafka.topicPrefix }}
- name: KAFKA_TOPIC_PREFIX
value: {{ . | quote }}
{{- end }}
{{- range $k, $v := .Values.mirrorService.extraEnv }}
- name: {{ $k }}
value: {{ $v | quote }}
{{- with .Values.mirrorService.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.mirrorService.extraEnvFrom }}
envFrom: {{ toYaml . | nindent 8 }}
Expand All @@ -71,6 +90,9 @@ spec:
mountPath: /var/run/secrets/secret.key
readOnly: true
{{- end }}
{{- with .Values.mirrorService.additionalVolumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
livenessProbe:
httpGet:
scheme: HTTP
Expand All @@ -94,9 +116,12 @@ spec:
volumes:
- name: tmp
emptyDir: {}
{{- with (include "hyades.secretKeySecretName" .) }}
{{- with (include "hyades.secretKeySecretName" .) }}
- name: secret-key
secret:
secretName: {{ . }}
{{- end }}
{{- end }}
{{- with .Values.mirrorService.additionalVolumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
Loading