Skip to content

Commit

Permalink
feat: add disablesuffixes option for backwards compat
Browse files Browse the repository at this point in the history
  • Loading branch information
aarlaud committed Oct 17, 2023
1 parent 1f6eb93 commit a2618f3
Show file tree
Hide file tree
Showing 38 changed files with 1,785 additions and 95 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: 2.0.3
version: 2.1.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" . }}-{{ .Release.Name }}
app.kubernetes.io/name: {{ include "snyk-broker.name" . }}{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/accept_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" . }}-accept-configmap-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-accept-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
56 changes: 28 additions & 28 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-{{ .Release.Name }}"
name: "{{ .Values.scmType}}-broker{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
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" . }}-{{ .Release.Name }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: "{{ .Values.scmType}}-broker-{{ .Release.Name }}"
- name: "{{ .Values.scmType}}-broker{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: GITHUB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: BITBUCKET_USERNAME
value: {{ .Values.bitbucketUsername }}
- name: BITBUCKET_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: GITLAB_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: AZURE_REPOS_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType }}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: BASE_NEXUS_URL
valueFrom:
secretKeyRef:
name: {{ .Values.scmType }}-base-nexus-url-{{ .Release.Name }}
name: {{ .Values.scmType }}-base-nexus-url{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-base-nexus-url"
- name: NEXUS_URL
valueFrom:
secretKeyRef:
name: {{ .Values.scmType }}-nexus-url-{{ .Release.Name }}
name: {{ .Values.scmType }}-nexus-url{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: JIRA_USERNAME
value: {{ .Values.jiraUsername }}
- name: JIRA_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-token-key"
- name: JIRA_HOSTNAME
value: {{ .Values.jiraHostname }}
Expand All @@ -267,10 +267,10 @@ spec:
- name: BROKER_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-broker-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-broker-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-broker-token-key"
- name: CR_AGENT_URL
value: http://cra-service-{{ .Release.Name }}:{{ .Values.deployment.container.crSnykPort | toString }}
value: http://cra-service{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}:{{ .Values.deployment.container.crSnykPort | toString }}
- name: CR_TYPE
value: {{ .Values.crType }}
- name: CR_BASE
Expand All @@ -280,12 +280,12 @@ spec:
- name: CR_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-token-key"
- name: CR_TOKEN
valueFrom:
secretKeyRef:
name: {{ .Values.scmType}}-token-{{ .Release.Name }}
name: {{ .Values.scmType}}-token{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
key: "{{ .Values.scmType}}-token-key"
- name: CR_ROLE_ARN
value: {{ .Values.crRoleArn }}
Expand All @@ -298,7 +298,7 @@ spec:
- name: BROKER_CLIENT_URL
value: {{ .Values.brokerClientUrl }}
- name: BROKER_CLIENT_VALIDATION_URL
value: http://cra-service-{{ .Release.Name }}:{{ .Values.deployment.container.crSnykPort | toString }}/healthcheck
value: http://cra-service{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}:{{ .Values.deployment.container.crSnykPort | toString }}/healthcheck
{{- end }}
{{- if .Values.enableCodeAgent }}
# Code Agent
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-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-accept-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
{{- end }}
{{- if .Values.caCert }}
- name: {{ include "snyk-broker.fullname" . }}-cacert-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
{{- end }}
{{- if .Values.httpsCert }}
- name: {{ include "snyk-broker.fullname" . }}-httpscert-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-httpscert-configmap-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-httpscert-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
{{- end }}
{{- if .Values.httpsKey }}
- name: {{ include "snyk-broker.fullname" . }}-httpskey-volume
configMap:
name: {{ include "snyk-broker.fullname" . }}-httpskey-configmap-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-httpskey-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
{{- end }}
{{- if .Values.extraVolumes }}
{{ tpl (toYaml .Values.extraVolumes | indent 6) . }}
Expand Down
11 changes: 6 additions & 5 deletions charts/snyk-broker/templates/broker_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
{{- $ingressPathType := .Values.brokerIngress.pathType -}}
{{- $extraPaths := .Values.brokerIngress.extraPaths -}}
{{- $releaseName := .Release.Name -}}
{{- $disableSuffixes := .Values.disableSuffixes }}
apiVersion: {{ include "snyk-broker.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $fullName }}-{{ .Release.Name }}
name: {{ $fullName }}{{ if not $disableSuffixes}}-{{ .Release.Name }}{{ end }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down Expand Up @@ -49,11 +50,11 @@ spec:
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $scmType }}-broker-service-{{ $releaseName }}
name: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $scmType }}-broker-service-{{ $releaseName }}
serviceName: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
servicePort: {{ $servicePort }}
{{- end }}
{{- end }}
Expand All @@ -63,11 +64,11 @@ spec:
- backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $scmType }}-broker-service-{{ .Release.Name }}
name: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $scmType }}-broker-service-{{ .Release.Name }}
serviceName: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
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-{{ .Release.Name }}"
name: "{{ .Values.scmType}}-broker-service{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
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-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}
name: {{ include "snyk-broker.fullname" . }}-cacert-configmap{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}"
name: "{{ .Values.scmType}}-code-agent{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
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" . }}-{{ .Release.Name }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
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-{{ .Release.Name }}"
name: "code-agent-service{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
16 changes: 8 additions & 8 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-{{ .Release.Name }}"
name: "{{ .Values.scmType}}-cra{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/name: {{ .Release.Name }}-cr{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: 1
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/name: {{ .Release.Name }}-cr{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
Expand All @@ -22,18 +22,18 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/name: {{ .Release.Name }}-cr{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}-{{ .Release.Name }}
serviceAccountName: {{ include "snyk-broker.serviceAccountName" . }}{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: container-registry-agent-{{ .Release.Name }}
- name: container-registry-agent{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
resources:
limits:
cpu: {{ .Values.crResources.limits.cpu }}
Expand Down Expand Up @@ -67,7 +67,7 @@ spec:
apiVersion: v1
kind: Service
metadata:
name: "cra-service-{{ .Release.Name }}"
name: "cra-service{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand All @@ -77,6 +77,6 @@ spec:
- port: {{ .Values.deployment.container.crSnykPort }}
targetPort: {{ .Values.deployment.container.crSnykPort}}
selector:
app.kubernetes.io/name: {{ .Release.Name }}-cr-{{ .Release.Name }}
app.kubernetes.io/name: {{ .Release.Name }}-cr{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
Loading

0 comments on commit a2618f3

Please sign in to comment.