Skip to content

Commit

Permalink
fix: configure broker client service url
Browse files Browse the repository at this point in the history
Signed-off-by: iuliams <[email protected]>
Signed-off-by: Iulia Manda <[email protected]>
  • Loading branch information
iuliams committed Oct 27, 2023
1 parent 81452db commit 09cca1a
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 10 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 @@ -99,3 +99,14 @@ Return if ingress supports pathType.
{{- define "snyk-broker.ingress.supportsPathType" -}}
{{- or (eq (include "snyk-broker.ingress.isStable" .) "true") (and (eq (include "snyk-broker.ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18-0" .Capabilities.KubeVersion.Version)) -}}
{{- end -}}

{{/*
Create the name of the broker service to use
*/}}
{{- define "snyk-broker.brokerServiceName" -}}
{{- if not .Values.disableSuffixes -}}
{{ .Values.scmType }}-broker-service-{{ .Release.Name }}
{{- else }}
{{ .Values.scmType}}-broker-service
{{- end -}}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/snyk-broker/templates/broker_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ spec:
- name: PORT
value: {{ .Values.deployment.container.containerPort | squote }}
- name: BROKER_CLIENT_URL
value: {{ .Values.brokerClientUrl }}
value: "http://{{ include "snyk-broker.brokerServiceName" . }}:{{ .Values.service.port }}"
- name: BROKER_CLIENT_VALIDATION_URL
value: http://cra-service{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}:{{ .Values.deployment.container.crSnykPort | toString }}/healthcheck
{{- end }}
Expand Down
8 changes: 4 additions & 4 deletions charts/snyk-broker/templates/broker_ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
{{- $ingressSupportsIngressClassName := eq (include "snyk-broker.ingress.supportsIngressClassName" .) "true" -}}
{{- $ingressSupportsPathType := eq (include "snyk-broker.ingress.supportsPathType" .) "true" -}}
{{- $fullName := include "snyk-broker.fullname" . -}}
{{- $scmType := .Values.scmType -}}
{{- $servicePort := .Values.service.port -}}
{{- $scmType := .Values.scmType -}}
{{- $ingressPath := .Values.brokerIngress.path -}}
{{- $ingressPathType := .Values.brokerIngress.pathType -}}
{{- $extraPaths := .Values.brokerIngress.extraPaths -}}
Expand Down Expand Up @@ -50,7 +50,7 @@ spec:
backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
name: {{ include "snyk-broker.brokerServiceName" $ }}
port:
number: {{ $servicePort }}
{{- else }}
Expand All @@ -64,11 +64,11 @@ spec:
- backend:
{{- if $ingressApiIsStable }}
service:
name: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
name: {{ include "snyk-broker.brokerServiceName" . }}
port:
number: {{ $servicePort }}
{{- else }}
serviceName: {{ $scmType }}-broker-service{{ if not $disableSuffixes}}-{{ $releaseName }}{{ end }}
serviceName: {{ include "snyk-broker.brokerServiceName" . }}
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{{if not .Values.disableSuffixes }}-{{ .Release.Name }}{{ end }}"
name: {{ include "snyk-broker.brokerServiceName" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "snyk-broker.labels" . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ with CRA:
- name: PORT
value: "8000"
- name: BROKER_CLIENT_URL
value: http://brokerclient
value: http://container-registry-agent-broker-service-RELEASE-NAME:8000
- name: BROKER_CLIENT_VALIDATION_URL
value: http://cra-service-RELEASE-NAME:8081/healthcheck
- name: LOG_LEVEL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ with CRA:
- name: PORT
value: "8000"
- name: BROKER_CLIENT_URL
value: http://brokerclient
value: http://container-registry-agent-broker-service-RELEASE-NAME:8000
- name: BROKER_CLIENT_VALIDATION_URL
value: http://cra-service-RELEASE-NAME:8081/healthcheck
- name: LOG_LEVEL
Expand Down
2 changes: 0 additions & 2 deletions charts/snyk-broker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ brokerDispatcherUrl: "https://api.snyk.io"
# This number if only used if enableHighAvailabilityMode is true
replicaCount: 2



##### SCM Generic #####

# scmType is used to define the Source Control that you are connecting to.
Expand Down

0 comments on commit 09cca1a

Please sign in to comment.