Skip to content

Commit

Permalink
Merge pull request #6 from tokamak-network/OR-1988-Integrate-mini-bri…
Browse files Browse the repository at this point in the history
…dge-to-thanos-stack

[OR-1988] Mini bridge helm charts
  • Loading branch information
ohbyeongmin authored Dec 20, 2024
2 parents e0aabd2 + 3bf0878 commit 5439d97
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/op-bridge/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
5 changes: 5 additions & 0 deletions charts/op-bridge/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: op-bridge
description: A Helm chart to deploy Optimistic bridge
version: 1.0.0
type: application
62 changes: 62 additions & 0 deletions charts/op-bridge/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "op-bridge.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "op-bridge.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "op-bridge.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "op-bridge.labels" -}}
helm.sh/chart: {{ include "op-bridge.chart" . }}
{{ include "op-bridge.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "op-bridge.selectorLabels" -}}
app.kubernetes.io/name: {{ include "op-bridge.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "op-bridge.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "op-bridge.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/op-bridge/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "op-bridge.fullname" . }}
data:
.env: |-
{{- range $key, $value := .Values.op_bridge.env }}
NEXT_PUBLIC_{{ $key | upper }}: {{ $value | quote }}
{{- end }}
36 changes: 36 additions & 0 deletions charts/op-bridge/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "op-bridge.fullname" . }}
spec:
selector:
matchLabels:
app: {{ include "op-bridge.fullname" . }}
replicas: {{ .Values.op_bridge.spec.replicas }}
template:
metadata:
labels:
app: {{ include "op-bridge.fullname" . }}
spec:
terminationGracePeriodSeconds: 10
restartPolicy: Always
containers:
- name: bridge
image: "tokamaknetwork/trh-op-bridge-app:latest"
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
protocol: TCP
volumeMounts:
- name: app-config
mountPath: "/app/.env.local"
subPath: .env.local
readOnly: true
volumes:
- name: app-config
configMap:
defaultMode: 0777
items:
- key: .env
path: .env.local
name: {{ include "op-bridge.fullname" . }}
53 changes: 53 additions & 0 deletions charts/op-bridge/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{- if .Values.op_bridge.ingress.enabled }}
{{- $fullName := include "op-bridge.fullname" . -}}
{{- if and .Values.op_bridge.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-ingress
labels:
app: {{ $fullName }}
{{- with .Values.op_bridge.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.op_bridge.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.op_bridge.ingress.className }}
{{- end }}
{{- if .Values.op_bridge.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.op_bridge.ingress.hostname | quote }}
{{- end }}
rules:
- host: {{ .Values.op_bridge.ingress.hostname | quote }}
http:
paths:
{{- range .Values.op_bridge.ingress.paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: 3000
{{- else }}
serviceName: {{ $fullName }}
servicePort: 3000
{{- end }}
{{- end }}
{{- end}}
11 changes: 11 additions & 0 deletions charts/op-bridge/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "op-bridge.fullname" . }}
spec:
selector:
app: {{ include "op-bridge.fullname" . }}
ports:
- name: http
port: 3000
targetPort: 3000
48 changes: 48 additions & 0 deletions charts/op-bridge/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
nameOverride: ""

fullnameOverride: ""

op_bridge:
spec:
replicas: 1

env:
l1_chain_name:
l1_chain_id:
l1_rpc:
l1_native_currency_name:
l1_native_currency_symbol:
l1_native_currency_decimals:
l1_block_explorer:

l2_chain_name:
l2_chain_id:
l2_rpc:
l2_native_currency_name:
l2_native_currency_symbol:
l2_native_currency_decimals:
l2_block_explorer:

native_token_l1_address:
l1_usdc_address:
l1_usdt_address:
l2_usdt_address:

standard_bridge_address:
address_manager_address:
l1_cross_domain_messenger_address:
optimism_portal_address:
l2_output_oracle_address:
l1_usdc_bridge_address:
dispute_game_factory_address:

ingress:
enabled: false
className: ""
annotations: {}
hostname: ""
tls:
enabled: false
paths:
- path: /
pathType: Prefix

0 comments on commit 5439d97

Please sign in to comment.