Skip to content

Commit

Permalink
labels for automatic chaos testing (#11830)
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov authored Jan 22, 2024
1 parent 41f2497 commit f0543e6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ spec:
selector:
matchLabels:
app: {{ $.Release.Name }}-db
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: db
havoc-network-group: db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
template:
metadata:
labels:
app: {{ $.Release.Name }}-db
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: db
havoc-network-group: db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
{{- range $key, $value := $.Values.labels }}
Expand Down
25 changes: 19 additions & 6 deletions charts/chainlink-cluster/templates/chainlink-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $.Release.Name }}-{{ $cfg.name }}
name: {{ if eq $index 0 }}{{ $.Release.Name }}-{{ $cfg.name }}-bootstrap{{ else }}{{ $.Release.Name }}-{{ $cfg.name }}{{ end }}
spec:
strategy:
# Need to recreate the pod to deal with lease lock held by old pod.
type: Recreate
selector:
matchLabels:
app: {{ $.Release.Name }}
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
{{ if eq $index 0 }}{{ else }}
havoc-component-group: node
{{ end }}
{{ if eq $index 0 }}{{ else }}
havoc-network-group: {{ if gt $index 2 }}"1"{{ else }}"2"{{ end }}
{{ end }}
instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
template:
metadata:
labels:
app: {{ $.Release.Name }}
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
{{ if eq $index 0 }}{{ else }}
havoc-component-group: node
{{ end }}
{{ if eq $index 0 }}{{ else }}
havoc-network-group: {{ if gt $index 2 }}"1"{{ else }}"2"{{ end }}
{{ end }}

instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
# Used for testing. Role value should either be: bootstrap or node.
# There should only be one "bootstrap" node, the rest should be "node".
# Here we set the first node to be bootstrap, the rest to be node.
role: {{ if eq $index 0 }}bootstrap{{ else }}node{{ end }}
{{- range $key, $value := $.Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
Expand All @@ -43,7 +56,7 @@ spec:
{{- toYaml $.Values.chainlink.securityContext | nindent 12 }}
image: {{ default "public.ecr.aws/chainlink/chainlink" $cfg.image }}
imagePullPolicy: Always
command: ["bash", "-c", "while ! pg_isready -U postgres --host {{ $.Release.Name }}-db-{{ $cfg.name }} --port 5432; do echo \"waiting for database to start\"; sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials"]
command: [ "bash", "-c", "while ! pg_isready -U postgres --host {{ $.Release.Name }}-db-{{ $cfg.name }} --port 5432; do echo \"waiting for database to start\"; sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials" ]
ports:
- name: access
containerPort: {{ $.Values.chainlink.web_port }}
Expand Down
8 changes: 8 additions & 0 deletions charts/chainlink-cluster/templates/geth-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ spec:
selector:
matchLabels:
app: geth
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: "blockchain"
havoc-network-group: "blockchain"
release: {{ .Release.Name }}
template:
metadata:
labels:
app: geth
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: "blockchain"
havoc-network-group: "blockchain"
release: {{ .Release.Name }}
annotations:
{{- range $key, $value := .Values.podAnnotations }}
Expand Down

0 comments on commit f0543e6

Please sign in to comment.