Skip to content

Commit

Permalink
parameterized relayers
Browse files Browse the repository at this point in the history
  • Loading branch information
sampocs committed Aug 8, 2024
1 parent bee4da4 commit 6ce2ed0
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 72 deletions.
47 changes: 0 additions & 47 deletions integration-tests/network/templates/hermes.yaml

This file was deleted.

46 changes: 32 additions & 14 deletions integration-tests/network/templates/relayer.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,49 @@
{{- $root := .Values -}}
{{- range $index, $relayer := .Values.relayers }}
{{- $appName := printf "%s-%s" $relayer.type $relayer.name -}}

{{- $image := "" -}}
{{- if eq $relayer.type "relayer" -}}
{{- $image = $root.images.relayer -}}
{{- else if eq $relayer.type "hermes" -}}
{{- $image = $root.images.hermes -}}
{{- else -}}
{{- fail (printf "Unknown relayer type: %s" $relayer.type) -}}
{{- end -}}

{{- $chainMnemonicIndexA := mul $index 2 }}
{{- $chainMnemonicIndexB := add $chainMnemonicIndexA 1 }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: relayer-stride-cosmoshub
namespace: integration
name: {{ $appName }}
namespace: {{ $root.namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: relayer-stride-cosmoshub
app: {{ $appName }}
template:
metadata:
labels:
app: relayer-stride-cosmoshub
app: {{ $appName }}
spec:
containers:
- name: relayer-stride-cosmoshub
image: gcr.io/stride-nodes/integration-tests/relayer:v2.5.2
- name: {{ $appName }}
image: {{ $image }}
imagePullPolicy: Always
env:
- name: PATH_NAME
value: stride-cosmoshub
value: {{ $relayer.name }}
- name: CHAIN_NAME_A
value: stride
value: {{ $relayer.chainA }}
- name: CHAIN_NAME_B
value: cosmoshub
value: {{ $relayer.chainB }}
- name: CHAIN_A_MNEMONIC_INDEX
value: "0"
value: "{{ $chainMnemonicIndexA }}"
- name: CHAIN_B_MNEMONIC_INDEX
value: "1"
value: "{{ $chainMnemonicIndexB }}"
resources:
limits:
cpu: "200m"
Expand All @@ -37,13 +53,15 @@ spec:
memory: "1000M"
volumeMounts:
- name: configs
mountPath: /home/relayer/configs
mountPath: "/home/{{ $relayer.type }}/configs"
- name: scripts
mountPath: /home/relayer/scripts
mountPath: "/home/{{ $relayer.type }}/scripts"
volumes:
- name: configs
configMap:
name: configs
- name: scripts
configMap:
name: scripts
name: scripts
---
{{- end }}
17 changes: 8 additions & 9 deletions integration-tests/network/templates/validator.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- $root := .Values -}}

{{- define "chain.env" -}}
- name: CHAIN_NAME
value: {{ .name }}
Expand All @@ -17,19 +19,16 @@
fieldPath: metadata.namespace
{{- end -}}

{{- $namespace := .Values.namespace -}}
{{- $imageRepo := .Values.chainImagesRepo -}}

{{- range $chain := .Values.chains }}
{{- $appName := printf "%s-validator" $chain.name -}}
{{- $chainHomeDirectory := printf "/home/validator/%s" $chain.home -}}
{{- $image := printf "%s/%s:%s" $imageRepo $chain.name $chain.version -}}
{{- $appName := printf "%s-validator" $chain.name -}}
{{- $chainHomeDirectory := printf "/home/validator/%s" $chain.home -}}
{{- $image := printf "%s/%s:%s" $root.images.chains $chain.name $chain.version -}}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ $appName }}
namespace: {{ $namespace }}
namespace: {{ $root.namespace }}
spec:
replicas: {{ $chain.numValidators }}
selector:
Expand Down Expand Up @@ -121,7 +120,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ $appName }}
namespace: {{ $namespace }}
namespace: {{ $root.namespace }}
spec:
clusterIP: None
selector:
Expand All @@ -144,7 +143,7 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $appName }}
namespace: {{ $namespace }}
namespace: {{ $root.namespace }}
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/proxy-connect-timeout: "360"
Expand Down
15 changes: 13 additions & 2 deletions integration-tests/network/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
namespace: integration
chainImagesRepo: gcr.io/stride-nodes/integration-tests/chains

images:
chains: gcr.io/stride-nodes/integration-tests/chains
relayer: gcr.io/stride-nodes/integration-tests/relayer:v2.5.2
hermes: gcr.io/stride-nodes/integration-tests/hermes:v1.9.0

chains:
- name: stride
Expand All @@ -18,4 +22,11 @@ chains:
home: .gaia
denom: uatom
decimals: 6
command: ["gaiad", "start"]
command: ["gaiad", "start"]

# type can be either "relayer" or "hermes"
relayers:
- name: stride-cosmoshub
type: relayer
chainA: stride
chainB: cosmoshub

0 comments on commit 6ce2ed0

Please sign in to comment.