From 684ac09c1ceb92017fbc4387713c420fe2cfedd6 Mon Sep 17 00:00:00 2001 From: Antoine Arlaud Date: Tue, 17 Oct 2023 12:22:31 +0200 Subject: [PATCH] fix: add suffix to custom accept file --- charts/snyk-broker/Chart.yaml | 2 +- .../templates/accept_configmap.yaml | 2 +- .../broker_cra_deployment_test.yaml.snap | 6 +- ...broker_deployment_configmap_test.yaml.snap | 16 +- ...ker_deployment_customaccept_test.yaml.snap | 152 ++++++++++++++++++ .../broker_deployment_ingress_test.yaml.snap | 8 +- .../broker_deployment_test.yaml.snap | 24 +-- .../cra_deployment_test.yaml.snap | 2 +- .../broker_deployment_customaccept_test.yaml | 15 ++ .../tests/fixtures/customaccept_values.yaml | 25 +++ 10 files changed, 222 insertions(+), 30 deletions(-) create mode 100644 charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap create mode 100644 charts/snyk-broker/tests/broker_deployment_customaccept_test.yaml create mode 100644 charts/snyk-broker/tests/fixtures/customaccept_values.yaml diff --git a/charts/snyk-broker/Chart.yaml b/charts/snyk-broker/Chart.yaml index d87a1c7..7a75138 100644 --- a/charts/snyk-broker/Chart.yaml +++ b/charts/snyk-broker/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 name: snyk-broker -version: 2.0.2 +version: 2.0.3 description: A Helm chart for Kubernetes type: application diff --git a/charts/snyk-broker/templates/accept_configmap.yaml b/charts/snyk-broker/templates/accept_configmap.yaml index 00f163c..1e13069 100644 --- a/charts/snyk-broker/templates/accept_configmap.yaml +++ b/charts/snyk-broker/templates/accept_configmap.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "snyk-broker.fullname" . }}-accept-configmap + name: {{ include "snyk-broker.fullname" . }}-accept-configmap-{{ .Release.Name }} namespace: {{ .Release.Namespace }} labels: {{- include "snyk-broker.labels" . | nindent 4 }} diff --git a/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap index 548caeb..91cda2d 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_cra_deployment_test.yaml.snap @@ -7,7 +7,7 @@ with CRA: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: container-registry-agent-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -120,7 +120,7 @@ with CRA: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: container-registry-agent-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -147,6 +147,6 @@ with CRA: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_configmap_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_configmap_test.yaml.snap index 288aaf5..50901fe 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_configmap_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_configmap_test.yaml.snap @@ -7,7 +7,7 @@ cacert: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -111,7 +111,7 @@ cacert: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -153,7 +153,7 @@ cacert: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: RELEASE-NAME-snyk-broker-cacert-configmap-RELEASE-NAME namespace: NAMESPACE 4: | @@ -172,7 +172,7 @@ cacert: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE cacertfile: @@ -184,7 +184,7 @@ cacertfile: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -280,7 +280,7 @@ cacertfile: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -301,7 +301,7 @@ cacertfile: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: RELEASE-NAME-snyk-broker-cacert-configmap-RELEASE-NAME namespace: NAMESPACE 4: | @@ -320,6 +320,6 @@ cacertfile: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap new file mode 100644 index 0000000..ff6a303 --- /dev/null +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_customaccept_test.yaml.snap @@ -0,0 +1,152 @@ +customaccept values: + 1: | + apiVersion: v1 + data: + accept.json: test + kind: ConfigMap + metadata: + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-2.0.3 + name: RELEASE-NAME-snyk-broker-accept-configmap-RELEASE-NAME + namespace: NAMESPACE + 2: | + apiVersion: apps/v1 + kind: Deployment + metadata: + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-2.0.3 + name: github-com-broker-RELEASE-NAME + namespace: NAMESPACE + spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + template: + metadata: + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + spec: + containers: + - env: + - name: BROKER_SERVER_URL + value: https://broker.test.snyk.io + - name: BROKER_HEALTHCHECK_PATH + value: /healthcheck + - name: BROKER_SYSTEMCHECK_PATH + value: /systemcheck + - name: BROKER_TOKEN + valueFrom: + secretKeyRef: + key: github-com-broker-token-key + name: github-com-broker-token-RELEASE-NAME + - name: GITHUB_TOKEN + valueFrom: + secretKeyRef: + key: github-com-token-key + name: github-com-token-RELEASE-NAME + - name: PORT + value: "8000" + - name: BROKER_CLIENT_URL + value: http://brokerclient + - name: LOG_LEVEL + value: info + - name: LOG_ENABLE_BODY + value: "false" + - name: ACCEPT + value: /home/node/private/accept.json + - name: BROKER_DISPATCHER_BASE_URL + value: https://api.test.snyk.io + image: snyk/broker:github-com + imagePullPolicy: Always + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthcheck + port: 8000 + initialDelaySeconds: 3 + periodSeconds: 10 + timeoutSeconds: 1 + name: github-com-broker-RELEASE-NAME + ports: + - containerPort: 8000 + name: http + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthcheck + port: 8000 + initialDelaySeconds: 3 + periodSeconds: 10 + timeoutSeconds: 1 + resources: + limits: + cpu: 1 + memory: 256Mi + requests: + cpu: 1 + memory: 256Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 1000 + volumeMounts: + - mountPath: /home/node/private + name: RELEASE-NAME-snyk-broker-accept-volume + readOnly: true + securityContext: {} + serviceAccountName: snyk-broker-RELEASE-NAME + volumes: + - configMap: + name: RELEASE-NAME-snyk-broker-accept-configmap-RELEASE-NAME + name: RELEASE-NAME-snyk-broker-accept-volume + 3: | + apiVersion: v1 + kind: Service + metadata: + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-2.0.3 + name: github-com-broker-service-RELEASE-NAME + namespace: NAMESPACE + spec: + ports: + - port: 8000 + targetPort: 8000 + selector: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + type: ClusterIP + 4: | + apiVersion: v1 + data: + github-com-broker-token-key: MTIz + kind: Secret + metadata: + name: github-com-broker-token-RELEASE-NAME + type: Opaque + 5: | + apiVersion: v1 + kind: ServiceAccount + metadata: + labels: + app.kubernetes.io/instance: RELEASE-NAME + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: snyk-broker-RELEASE-NAME + helm.sh/chart: snyk-broker-2.0.3 + name: snyk-broker-RELEASE-NAME + namespace: NAMESPACE diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap index 37627a9..a255530 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_ingress_test.yaml.snap @@ -7,7 +7,7 @@ ingress: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -103,7 +103,7 @@ ingress: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: RELEASE-NAME-snyk-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -123,7 +123,7 @@ ingress: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -150,6 +150,6 @@ ingress: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE diff --git a/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap index d558921..085b34e 100644 --- a/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap @@ -7,7 +7,7 @@ HA mode on: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -105,7 +105,7 @@ HA mode on: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -132,7 +132,7 @@ HA mode on: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE HA mode on with 4 replicas: @@ -144,7 +144,7 @@ HA mode on with 4 replicas: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -242,7 +242,7 @@ HA mode on with 4 replicas: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -269,7 +269,7 @@ HA mode on with 4 replicas: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE default values: @@ -281,7 +281,7 @@ default values: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -377,7 +377,7 @@ default values: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -404,7 +404,7 @@ default values: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE preflight checks off: @@ -416,7 +416,7 @@ preflight checks off: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-RELEASE-NAME namespace: NAMESPACE spec: @@ -514,7 +514,7 @@ preflight checks off: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: github-com-broker-service-RELEASE-NAME namespace: NAMESPACE spec: @@ -541,6 +541,6 @@ preflight checks off: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: snyk-broker-RELEASE-NAME namespace: NAMESPACE diff --git a/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap b/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap index d3c7910..3e28938 100644 --- a/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap +++ b/charts/snyk-broker/tests/__snapshot__/cra_deployment_test.yaml.snap @@ -55,7 +55,7 @@ default values: app.kubernetes.io/instance: RELEASE-NAME app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: snyk-broker-RELEASE-NAME - helm.sh/chart: snyk-broker-2.0.2 + helm.sh/chart: snyk-broker-2.0.3 name: cra-service-RELEASE-NAME namespace: NAMESPACE spec: diff --git a/charts/snyk-broker/tests/broker_deployment_customaccept_test.yaml b/charts/snyk-broker/tests/broker_deployment_customaccept_test.yaml new file mode 100644 index 0000000..a4891f6 --- /dev/null +++ b/charts/snyk-broker/tests/broker_deployment_customaccept_test.yaml @@ -0,0 +1,15 @@ +suite: test broker deployment +templates: + - broker_deployment.yaml + - broker_service.yaml + - secrets.yaml + - serviceaccount.yaml + - accept_configmap.yaml + +tests: + - it: customaccept values + values: + - ./fixtures/customaccept_values.yaml + asserts: + - matchSnapshot: {} + diff --git a/charts/snyk-broker/tests/fixtures/customaccept_values.yaml b/charts/snyk-broker/tests/fixtures/customaccept_values.yaml new file mode 100644 index 0000000..d999e04 --- /dev/null +++ b/charts/snyk-broker/tests/fixtures/customaccept_values.yaml @@ -0,0 +1,25 @@ +# Default values for snyk-broker. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +##### Snyk Specific Values ##### + +# Broker Token is a value from Snyk. Get this from the integration settings page or your Snyk Representative +brokerToken: "123" + +# 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" + +# Do not touch unless directed by a Snyk Representative +brokerServerUrl: "https://broker.test.snyk.io" + +preflightChecks: + enabled: true + +highAvailabilityMode: + enabled: false +brokerDispatcherUrl: "https://api.test.snyk.io" + +acceptJson: | + test \ No newline at end of file