Skip to content

Commit

Permalink
feat: add support for multiple broker in same namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlaud committed Sep 19, 2023
1 parent a418d27 commit cfcd990
Show file tree
Hide file tree
Showing 14 changed files with 167 additions and 167 deletions.
2 changes: 1 addition & 1 deletion charts/snyk-broker/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: snyk-broker
version: 1.8.0
version: 2.0.0
description: A Helm chart for Kubernetes
type: application
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
Selector labels
*/}}
{{- define "snyk-broker.selectorLabels" -}}
app.kubernetes.io/name: {{ include "snyk-broker.name" . }}
app.kubernetes.io/name: {{ include "snyk-broker.name" . }}-{{ .Release.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

Expand Down
52 changes: 26 additions & 26 deletions charts/snyk-broker/templates/broker_deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Values.scmType}}-broker"
name: "{{ .Values.scmType}}-broker-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down Expand Up @@ -30,11 +30,11 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}-{{ .Release.Name }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: "{{ .Values.scmType}}-broker"
- name: "{{ .Values.scmType}}-broker-{{ .Release.Name }}"
resources:
limits:
cpu: {{ .Values.brokerResources.limits.cpu }}
Expand Down Expand Up @@ -106,12 +106,12 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: PORT
value: {{ .Values.deployment.container.containerPort | squote }}
Expand All @@ -123,12 +123,12 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: GITHUB
value: {{ .Values.github }}
Expand All @@ -147,14 +147,14 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: BITBUCKET_USERNAME
value: {{ .Values.bitbucketUsername }}
- name: BITBUCKET_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: BITBUCKET
value: {{ .Values.bitbucket }}
Expand All @@ -170,12 +170,12 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: GITLAB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: GITLAB
value: {{ .Values.gitlab }}
Expand All @@ -189,12 +189,12 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: AZURE_REPOS_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: AZURE_REPOS_ORG
value: {{ .Values.azureReposOrg }}
Expand All @@ -210,7 +210,7 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: ARTIFACTORY_URL
value: {{ .Values.artifactoryUrl }}
Expand All @@ -222,17 +222,17 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType }}-broker-token
name: {{ .Values.scmType }}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: BASE_NEXUS_URL
valueFrom:
secretKeyRef:
name: {{ .Values.scmType }}-base-nexus-url
name: {{ .Values.scmType }}-base-nexus-url-{{ .Release.Name }}
key: "{{ .Values.scmType}}-base-nexus-url"
- name: NEXUS_URL
valueFrom:
secretKeyRef:
name: {{ .Values.scmType }}-nexus-url
name: {{ .Values.scmType }}-nexus-url-{{ .Release.Name }}
key: "{{ .Values.scmType}}-nexus-url"

- name: BROKER_CLIENT_VALIDATION_URL
Expand All @@ -246,14 +246,14 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: JIRA_USERNAME
value: {{ .Values.jiraUsername }}
- name: JIRA_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: JIRA_HOSTNAME
value: {{ .Values.jiraHostname }}
Expand All @@ -267,7 +267,7 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: CR_AGENT_URL
value: http://cra-service:{{ .Values.deployment.container.crSnykPort | toString }}
Expand All @@ -280,12 +280,12 @@ spec:
- name: CR_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: CR_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
key: "{{ .Values.scmType}}-token-key"
- name: CR_ROLE_ARN
value: {{ .Values.crRoleArn }}
Expand Down Expand Up @@ -387,22 +387,22 @@ spec:
{{- if (include "snyk-broker.acceptJson" .)}}
- name: {{ include "snyk-broker.fullname" . }}-accept-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-accept-configmap
name: {{ include "snyk-broker.fullname" . }}-accept-configmap-{{ .Release.Name }}
{{- end }}
{{- if .Values.caCert }}
- name: {{ include "snyk-broker.fullname" . }}-cacert-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap-{{ .Release.Name }}
{{- end }}
{{- if .Values.httpsCert }}
- name: {{ include "snyk-broker.fullname" . }}-httpscert-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-httpscert-configmap
name: {{ include "snyk-broker.fullname" . }}-httpscert-configmap-{{ .Release.Name }}
{{- end }}
{{- if .Values.httpsKey }}
- name: {{ include "snyk-broker.fullname" . }}-httpskey-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-httpskey-configmap
name: {{ include "snyk-broker.fullname" . }}-httpskey-configmap-{{ .Release.Name }}
{{- end }}
{{- if .Values.extraVolumes }}
{{ tpl (toYaml .Values.extraVolumes | indent 6) . }}
Expand Down
10 changes: 5 additions & 5 deletions charts/snyk-broker/templates/broker_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
apiVersion: {{ include "snyk-broker.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}
name: {{ $fullName }}-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down Expand Up @@ -48,11 +48,11 @@ spec:
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $scmType }}-broker-service
name: {{ $scmType }}-broker-service-{{ .Release.Name }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $scmType }}-broker-service
serviceName: {{ $scmType }}-broker-service-{{ .Release.Name }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
Expand All @@ -62,11 +62,11 @@ spec:
- backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $scmType }}-broker-service
name: {{ $scmType }}-broker-service-{{ .Release.Name }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $scmType }}-broker-service
serviceName: {{ $scmType }}-broker-service-{{ .Release.Name }}
servicePort: {{ $servicePort }}
{{- end }}
{{- if $ingressPath }}
Expand Down
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/broker_service.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: "{{ .Values.scmType}}-broker-service"
name: "{{ .Values.scmType}}-broker-service-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/snyk-broker/templates/cacert_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand All @@ -14,7 +14,7 @@ data:
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
6 changes: 3 additions & 3 deletions charts/snyk-broker/templates/code_agent_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Values.scmType}}-code-agent"
name: "{{ .Values.scmType}}-code-agent-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}-ca
Expand All @@ -29,7 +29,7 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}-{{ .Release.Name }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down Expand Up @@ -80,7 +80,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: "code-agent-service"
name: "code-agent-service-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
12 changes: 6 additions & 6 deletions charts/snyk-broker/templates/cra_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: "{{ .Values.scmType}}-cra"
name: "{{ .Values.scmType}}-cra-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}-cr
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: 1
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}-cr
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
Expand All @@ -22,7 +22,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}-cr
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
Expand All @@ -33,7 +33,7 @@ spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: container-registry-agent
- name: container-registry-agent-{{ .Release.Name }}
resources:
limits:
cpu: {{ .Values.crResources.limits.cpu }}
Expand Down Expand Up @@ -67,7 +67,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: "cra-service"
name: "cra-service-{{ .Release.Name }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/httpscert_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "snyk-broker.fullname" . }}-httpscert-configmap
name: {{ include "snyk-broker.fullname" . }}-httpscert-configmap-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/httpskey_configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "snyk-broker.fullname" . }}-httpskey-configmap
name: {{ include "snyk-broker.fullname" . }}-httpskey-configmap-{{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
Loading

0 comments on commit cfcd990

Please sign in to comment.