Skip to content

Commit ca6e578

Browse files
committed
feat(balius): Add Balius chart
Signed-off-by: Ales Verbic <verbotenj@blinklabs.io>
1 parent c88b7dd commit ca6e578

10 files changed

Lines changed: 407 additions & 0 deletions

File tree

charts/balius/Chart.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v2
2+
name: Balius
3+
description: Balius server
4+
version: 0.0.1
5+
appVersion: "0.0.1"
6+
7+
sources:
8+
- https://github.com/demeter-run/ext-balius
9+
10+
maintainers:
11+
- name: aurora
12+
email: aurora@blinklabs.io
13+
- name: overcookedpanda
14+
email: overcookedpanda@blinklabs.io
15+
- name: verbotenj
16+
email: verbotenj@blinklabs.io
17+
- name: wolf31o2
18+
email: wolf31o2@blinklabs.io

charts/balius/crds/crds.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: baliusworkers.demeter.run
5+
spec:
6+
group: demeter.run
7+
names:
8+
categories:
9+
- demeter-worker
10+
kind: BaliusWorker
11+
plural: baliusworkers
12+
shortNames:
13+
- bwapts
14+
singular: baliusworker
15+
scope: Namespaced
16+
versions:
17+
- name: v1alpha1
18+
served: true
19+
storage: true
20+
additionalPrinterColumns:
21+
- jsonPath: .spec.displayName
22+
name: Display Name
23+
type: string
24+
- jsonPath: .spec.network
25+
name: Network
26+
type: string
27+
- jsonPath: .spec.throughputTier
28+
name: Throughput Tier
29+
type: string
30+
- jsonPath: .status.endpointUrl
31+
name: Endpoint URL
32+
type: string
33+
- jsonPath: .status.authenticatedEndpointUrl
34+
name: Authenticated Endpoint URL
35+
type: string
36+
- jsonPath: .status.authToken
37+
name: Auth Token
38+
type: string
39+
schema:
40+
openAPIV3Schema:
41+
title: BaliusWorker
42+
description: Auto-generated derived type for BaliusWorkerSpec via `CustomResource`
43+
type: object
44+
required:
45+
- spec
46+
properties:
47+
spec:
48+
type: object
49+
required:
50+
- authToken
51+
- config
52+
- displayName
53+
- network
54+
- throughputTier
55+
- url
56+
- version
57+
properties:
58+
authToken:
59+
type: string
60+
config:
61+
type: object
62+
additionalProperties: true
63+
displayName:
64+
type: string
65+
network:
66+
type: string
67+
throughputTier:
68+
type: string
69+
url:
70+
type: string
71+
version:
72+
type: string
73+
status:
74+
type: object
75+
nullable: true
76+
required:
77+
- authToken
78+
- endpointUrl
79+
properties:
80+
authToken:
81+
type: string
82+
authenticatedEndpointUrl:
83+
type: string
84+
nullable: true
85+
endpointUrl:
86+
type: string
87+
subresources:
88+
status: {}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "balius.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
6+
{{- end -}}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
*/}}
11+
{{- define "balius.fullname" -}}
12+
{{- if .Values.fullnameOverride -}}
13+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
14+
{{- else -}}
15+
{{- $name := default .Chart.Name .Values.nameOverride -}}
16+
{{- if contains $name .Release.Name -}}
17+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
18+
{{- else -}}
19+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
20+
{{- end -}}
21+
{{- end -}}
22+
{{- end -}}
23+
24+
{{/*
25+
Create chart name and version as used by the chart label.
26+
*/}}
27+
{{- define "balius.chart" -}}
28+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
29+
{{- end -}}
30+
31+
{{/*
32+
Common labels
33+
*/}}
34+
{{- define "balius.labels" -}}
35+
helm.sh/chart: {{ include "balius.chart" . }}
36+
{{ include "balius.selectorLabels" . }}
37+
{{- if .Chart.AppVersion }}
38+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
39+
{{- end }}
40+
app.kubernetes.io/managed-by: {{ .Release.Service }}
41+
{{- end }}
42+
43+
{{/*
44+
Selector labels
45+
*/}}
46+
{{- define "balius.selectorLabels" -}}
47+
app.kubernetes.io/name: {{ include "balius.name" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
cardano_network: {{ .Values.balius.network }}
50+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: baliusd-{{ .Values.balius.network }}-config
5+
namespace: {{ .Release.Namespace }}
6+
data:
7+
baliusd.toml: |
8+
network = "{{ .Values.balius.network }}"
9+
lease_name = "balius-chainsync-lease-{{ .Values.balius.network }}"
10+
prometheus_addr = "0.0.0.0:{{ .Values.balius.prometheusPort }}"
11+
12+
[rpc]
13+
listen_address = "0.0.0.0:{{ .Values.balius.containerPort }}"
14+
15+
[ledger]
16+
endpoint_url = "{{ .Values.balius.configMap.utxorpc_url }}"
17+
18+
[chainsync]
19+
endpoint_url = "{{ .Values.balius.configMap.utxorpc_url }}"
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: balius-{{ .Values.balius.network }}-{{ .Values.balius.salt }}
5+
namespace: {{ default .Release.Namespace }}
6+
labels:
7+
app.kubernetes.io/kind: Deployment
8+
app.kubernetes.io/instance: {{ .Release.Name }}
9+
cardano_network: {{ .Values.balius.network }}
10+
spec:
11+
replicas: {{ .Values.balius.replicas }}
12+
strategy:
13+
type: RollingUpdate
14+
rollingUpdate:
15+
maxSurge: {{ .Values.balius.rollingUpdate.maxSurge }}
16+
maxUnavailable: {{ .Values.balius.rollingUpdate.maxUnavailable }}
17+
selector:
18+
matchLabels: {{- include "balius.selectorLabels" . | nindent 6 }}
19+
template:
20+
metadata:
21+
name: balius-{{ .Values.balius.network }}-{{ .Values.balius.salt }}
22+
labels: {{- include "balius.selectorLabels" . | nindent 8 }}
23+
{{- with .Values.balius.podLabels }}
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
annotations:
27+
{{- with .Values.balius.podAnnotations }}
28+
{{- toYaml . | nindent 8 }}
29+
{{- end }}
30+
spec:
31+
restartPolicy: Always
32+
{{- if .Values.balius.serviceAccount.create }}
33+
serviceAccountName: {{ .Values.balius.serviceAccount.name }}
34+
{{- end }}
35+
securityContext: {{toYaml .Values.balius.securityContext | nindent 6 }}
36+
containers:
37+
- name: main
38+
image: {{ .Values.balius.image.repository }}:{{ .Values.balius.image.tag }}
39+
imagePullPolicy: {{ .Values.balius.image.pullPolicy }}
40+
env:
41+
- name: BALIUSD_CONFIG
42+
value: {{ .Values.balius.env.BALIUSD_CONFIG }}
43+
- name: POSTGRES_USER
44+
valueFrom:
45+
secretKeyRef:
46+
name: {{ .Values.balius.postgres.usernameSecret.name }}
47+
key: {{ .Values.balius.postgres.usernameSecret.key }}
48+
- name: POSTGRES_PASSWORD
49+
valueFrom:
50+
secretKeyRef:
51+
name: {{ .Values.balius.postgres.passwordSecret.name }}
52+
key: {{ .Values.balius.postgres.passwordSecret.key }}
53+
- name: POSTGRES_HOST
54+
value: {{ .Values.balius.postgres_host }}
55+
- name: BALIUSD_CONNECTION
56+
value: postgres://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@$(POSTGRES_HOST):5432/{{ .Values.balius.network | replace "-" "" }}
57+
- name: BALIUSD_POD
58+
valueFrom:
59+
fieldRef:
60+
fieldPath: metadata.name
61+
- name: BALIUSD_NAMESPACE
62+
valueFrom:
63+
fieldRef:
64+
fieldPath: metadata.namespace
65+
- name: AWS_REGION
66+
valueFrom:
67+
secretKeyRef:
68+
name: {{ .Values.balius.credentialsSecretName }}
69+
key: aws_region
70+
- name: AWS_ACCESS_KEY_ID
71+
valueFrom:
72+
secretKeyRef:
73+
name: {{ .Values.balius.credentialsSecretName }}
74+
key: aws_access_key_id
75+
- name: AWS_SECRET_ACCESS_KEY
76+
valueFrom:
77+
secretKeyRef:
78+
name: {{ .Values.balius.credentialsSecretName }}
79+
key: aws_secret_access_key
80+
ports:
81+
- name: api
82+
containerPort: {{ .Values.balius.containerPort }}
83+
- name: metrics
84+
containerPort: {{ .Values.balius.prometheusPort }}
85+
volumeMounts:
86+
- name: config
87+
mountPath: /etc/config
88+
resources:
89+
{{- toYaml .Values.balius.resources | nindent 12 }}
90+
volumes:
91+
- name: config
92+
configMap:
93+
name: baliusd-{{ .Values.balius.network }}-config
94+
{{- with .Values.balius.tolerations }}
95+
tolerations:
96+
{{- toYaml . | nindent 8 }}
97+
{{- end }}
98+
{{- with .Values.balius.affinity }}
99+
affinity:
100+
{{- toYaml . | nindent 8 }}
101+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: monitoring.coreos.com/v1
2+
kind: PodMonitor
3+
metadata:
4+
name: balius-{{ .Values.balius.network }}-{{ .Values.balius.salt }}
5+
namespace: {{ .Values.balius.namespace | default .Release.Namespace }}
6+
labels:
7+
{{- with .Values.balius.podmonitor.labels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
spec:
11+
selector:
12+
matchLabels: {{- include "balius.selectorLabels" . | nindent 6 }}
13+
podMetricsEndpoints:
14+
- port: metrics
15+
path: /metrics
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Secret for AWS S3 Workers Credentials
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ .Values.s3.secret_name | default (printf "balius-%s-%s" .Values.balius.network .Values.balius.salt) }}
6+
namespace: {{ .Release.Namespace }}
7+
type: Opaque
8+
data:
9+
aws_region: {{ .Values.s3.aws_region | b64enc }}
10+
aws_access_key_id: {{ .Values.s3.aws_access_key_id | b64enc }}
11+
aws_secret_access_key: {{ .Values.s3.aws_secret_access_key | b64enc }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "balius.fullname" . }}
5+
labels:
6+
{{- include "balius.labels" . | nindent 4 }}
7+
spec:
8+
type: {{ .Values.balius.service.type }}
9+
ports:
10+
- name: api
11+
port: {{ .Values.balius.service.ports.api }}
12+
targetPort: {{ .Values.balius.containerPort }}
13+
protocol: TCP
14+
- name: metrics
15+
port: {{ .Values.balius.service.ports.metrics }}
16+
targetPort: {{ .Values.balius.prometheusPort }}
17+
protocol: TCP
18+
selector:
19+
{{- include "balius.selectorLabels" . | nindent 4 }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if and .Values.balius.serviceAccount.create (ne .Values.balius.serviceAccount.name "default") }}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
{{- if .Values.balius.serviceAccount.name }}
6+
name: {{ .Values.balius.serviceAccount.name }}
7+
{{- end }}
8+
labels:
9+
{{- include "balius.labels" . | nindent 4 }}
10+
{{- with .Values.balius.serviceAccount.annotations }}
11+
annotations:
12+
{{- toYaml . | nindent 4 }}
13+
{{- end }}
14+
{{- end }}

0 commit comments

Comments
 (0)