Skip to content

Commit

Permalink
fix: addressing feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
saumilmac committed Jul 29, 2024
1 parent 7d5e2e8 commit 1a820f4
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 15 deletions.
7 changes: 4 additions & 3 deletions charts/snyk-broker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@ Create the name of the broker service to use
*/}}
{{- define "snyk-broker.brokerServiceName" -}}
{{- if not .Values.disableSuffixes -}}
{{- $suffixLength := 16 -}}
{{- $service := "-broker-service-" -}}
{{- $serviceLength := len $service -}}
{{- $releaseNameLength := len .Release.Name -}}
{{- $truncatedLength := int (sub 63 (add $suffixLength $releaseNameLength)) -}}
{{- .Values.scmType | trunc $truncatedLength }}-broker-service-{{ .Release.Name }}
{{- $truncatedLength := int (sub 63 (add $serviceLength $releaseNameLength)) -}}
{{- .Values.scmType | trunc $truncatedLength }}{{ $service }}{{ .Release.Name }}
{{- else }}
{{- .Values.scmType | trunc 47 }}-broker-service
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ templates:
- broker_service.yaml
- secrets.yaml
- serviceaccount.yaml
values:
- ./fixtures/default_values.yaml

tests:
- it: default values
Expand Down
2 changes: 0 additions & 2 deletions charts/snyk-broker/tests/broker_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ templates:
- broker_service.yaml
- secrets.yaml
- serviceaccount.yaml
values:
- ./fixtures/default_values.yaml

tests:
- it: default values
Expand Down
16 changes: 16 additions & 0 deletions charts/snyk-broker/tests/broker_servicename_length_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
suite: test broker servicename length
chart:
version: 0.0.0
templates:
- broker_service.yaml

tests:
- it: should truncate scmType correctly when combined with release name and suffix
values:
- ./fixtures/default_values_cra.yaml
release:
name: "myrelease-really-long-release-name"
asserts:
- equal:
path: metadata.name
value: "container-reg-broker-service-myrelease-really-long-release-name"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative
brokerToken: "12345a6b-78d9-1e2f-3abc-456def789123"

snykToken: "12345a6b-78d9-1e2f-3abc-456def789123"
# brokerClientUrl is the address of the broker. This needs to be the address of itself. In the case of Kubernetes, you need to ensure that you are pointing to the cluster ingress you have setup.
# Ex: http://kubernetes-ingress.domain.com:8000/broker
brokerClientUrl: "http://brokerclient"
Expand Down
3 changes: 3 additions & 0 deletions charts/snyk-broker/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
},
"additionalProperties": false
},
"disableSuffixes": {
"type": "boolean"
},
"brokerDispatcherUrl": {
"type": "string",
"default": "https://api.snyk.io",
Expand Down
4 changes: 4 additions & 0 deletions charts/snyk-broker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ replicaCount: 2
# Adds additional labels to broker deployment
labels: {}

# Beginning with version 2.0.0, all created objects have a suffix based on the release name, allowing for multiple Brokers in the same namespace.
# For backward compatibility, version 2.1.0 introduces a disableSuffixes flag to revert to the 1.x.x behavior.
disableSuffixes: false

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

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

0 comments on commit 1a820f4

Please sign in to comment.