Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adds labels to broker deployment [HYB-560] #120

Merged
merged 10 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions charts/snyk-broker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ helm.sh/chart: {{ include "snyk-broker.chart" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.labels }}
{{ toYaml . }}
saumilmac marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}
{{- end }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ should render artifactoryUrl and brokerClientValidationUrl as secrets:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: artifactory-broker-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -107,6 +109,8 @@ should render artifactoryUrl and brokerClientValidationUrl as secrets:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: artifactory-broker-service-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -150,5 +154,7 @@ should render artifactoryUrl and brokerClientValidationUrl as secrets:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ cacert:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: github-com-broker-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -116,6 +118,8 @@ cacert:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: github-com-broker-service-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -158,6 +162,8 @@ cacert:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: RELEASE-NAME-snyk-broker-cacert-configmap-RELEASE-NAME
namespace: NAMESPACE
4: |
Expand All @@ -177,6 +183,8 @@ cacert:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
cacertfile:
Expand All @@ -189,6 +197,8 @@ cacertfile:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: github-com-broker-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -297,6 +307,8 @@ cacertfile:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: github-com-broker-service-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand All @@ -318,6 +330,8 @@ cacertfile:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: RELEASE-NAME-snyk-broker-cacert-configmap-RELEASE-NAME
namespace: NAMESPACE
4: |
Expand All @@ -337,5 +351,7 @@ cacertfile:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ should render render nexusUrl, baseNexusUrl and brokerClientValidationUrl as sec
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: nexus-broker-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -110,6 +112,8 @@ should render render nexusUrl, baseNexusUrl and brokerClientValidationUrl as sec
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: nexus-broker-service-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -161,5 +165,7 @@ should render render nexusUrl, baseNexusUrl and brokerClientValidationUrl as sec
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
149 changes: 149 additions & 0 deletions charts/snyk-broker/tests/__snapshot__/broker_deployment_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,149 @@ HTTPS enabled:
helm.sh/chart: snyk-broker-0.0.0
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
add deployment labels:
1: |
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-0.0.0
node1: test1
node2: test2
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_CODE
value: "true"
- name: ACCEPT_IAC
value: tf,yaml,yml,json,tpl
- 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
scheme: HTTP
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
scheme: HTTP
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: null
securityContext: {}
serviceAccountName: snyk-broker-RELEASE-NAME
volumes: null
2: |
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-0.0.0
node1: test1
node2: test2
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
3: |
apiVersion: v1
data:
github-com-broker-token-key: MTIz
kind: Secret
metadata:
name: github-com-broker-token-RELEASE-NAME
type: Opaque
4: |
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-0.0.0
node1: test1
node2: test2
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
default values:
1: |
apiVersion: apps/v1
Expand All @@ -442,6 +585,8 @@ default values:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: github-com-broker-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -540,6 +685,8 @@ default values:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: github-com-broker-service-RELEASE-NAME
namespace: NAMESPACE
spec:
Expand Down Expand Up @@ -567,6 +714,8 @@ default values:
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: snyk-broker-RELEASE-NAME
helm.sh/chart: snyk-broker-0.0.0
node1: test1
node2: test2
name: snyk-broker-RELEASE-NAME
namespace: NAMESPACE
preflight checks off:
Expand Down
5 changes: 5 additions & 0 deletions charts/snyk-broker/tests/broker_deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ tests:
- ./fixtures/default_values_ha_on_4_replicas.yaml
asserts:
- matchSnapshot: {}
- it: add deployment labels
values:
- ./fixtures/default_values.yaml
asserts:
- matchSnapshot: {}
saumilmac marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions charts/snyk-broker/tests/fixtures/default_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ highAvailabilityMode:
enabled: false
brokerDispatcherUrl: "https://api.test.snyk.io"

labels:
node1: test1
node2: test2
3 changes: 3 additions & 0 deletions charts/snyk-broker/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ brokerDispatcherUrl: "https://api.snyk.io"
# This number if only used if enableHighAvailabilityMode is true
replicaCount: 2

# Adds additional labels to broker deployment
saumilmac marked this conversation as resolved.
Show resolved Hide resolved
labels: {}

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

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