Skip to content

Commit d3b1a4f

Browse files
authored
feat(ext-utxorpc-operator): add helm chart for UTxO RPC operator (#361)
1 parent 10cbf06 commit d3b1a4f

9 files changed

Lines changed: 334 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: publish-ext-utxorpc-operator-helm-chart
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
paths:
7+
[
8+
'charts/ext-utxorpc-operator/**',
9+
'.github/workflows/publish-ext-utxorpc-operator-helm-chart.yml',
10+
]
11+
12+
jobs:
13+
build-and-push-ext-utxorpc-operator-helm-chart:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
- name: Install Helm
21+
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
22+
- name: Package and upload chart
23+
shell: bash
24+
env:
25+
REGISTRY: 'ghcr.io'
26+
REPOSITORY: '${{ github.repository }}'
27+
TOKEN: '${{ secrets.GITHUB_TOKEN }}'
28+
USER: '${{ github.repository_owner }}'
29+
run: |
30+
rm -rf dist
31+
mkdir dist
32+
helm package charts/ext-utxorpc-operator/ -d dist/
33+
echo "${TOKEN}" | helm registry login "${REGISTRY}" -u "${USER}" --password-stdin
34+
for file in dist/*; do
35+
helm push "$file" "oci://${REGISTRY}/${REPOSITORY,,}/charts"
36+
done
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v2
2+
name: ext-utxorpc-operator
3+
description: Extension UTxO RPC operator
4+
version: 0.0.1
5+
appVersion: "0.0.1"
6+
7+
sources:
8+
- https://github.com/demeter-run/ext-cardano-utxorpc
9+
10+
maintainers:
11+
- name: aurora
12+
email: aurora@blinklabs.io
13+
- name: verbotenj
14+
email: verbotenj@blinklabs.io
15+
- name: wolf31o2
16+
email: wolf31o2@blinklabs.io
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: utxorpcports.demeter.run
5+
spec:
6+
group: demeter.run
7+
scope: Namespaced
8+
names:
9+
kind: UtxoRpcPort
10+
plural: utxorpcports
11+
singular: utxorpcport
12+
shortNames:
13+
- utxoport
14+
categories:
15+
- demeter-port
16+
versions:
17+
- name: v1alpha1
18+
served: true
19+
storage: true
20+
additionalPrinterColumns:
21+
- name: Network
22+
jsonPath: .spec.network
23+
type: string
24+
- name: Throughput Tier
25+
jsonPath: .spec.throughputTier
26+
type: string
27+
- name: UtxoRPC Version
28+
jsonPath: .spec.utxorpcVersion
29+
type: string
30+
- name: Endpoint
31+
jsonPath: .status.grpcEndpointUrl
32+
type: string
33+
- name: Auth Token
34+
jsonPath: .status.authToken
35+
type: string
36+
schema:
37+
openAPIV3Schema:
38+
title: UtxoRpcPort
39+
description: Auto-generated derived type for UtxoRpcPortSpec via `CustomResource`
40+
type: object
41+
required:
42+
- spec
43+
properties:
44+
spec:
45+
type: object
46+
required:
47+
- network
48+
properties:
49+
authToken:
50+
type: string
51+
nullable: true
52+
network:
53+
type: string
54+
operatorVersion:
55+
type: string
56+
nullable: true
57+
throughputTier:
58+
type: string
59+
nullable: true
60+
utxorpcVersion:
61+
type: string
62+
nullable: true
63+
status:
64+
type: object
65+
nullable: true
66+
required:
67+
- authToken
68+
- grpcEndpointUrl
69+
properties:
70+
authToken:
71+
type: string
72+
grpcEndpointUrl:
73+
type: string
74+
subresources:
75+
status: {}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{{/*
2+
Expand the name of the chart.
3+
If .Values.nameOverride is not set, use .Chart.Name.
4+
*/}}
5+
{{- define "extUtxorpcOperator.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a fully qualified app name.
11+
If .Values.fullnameOverride is set, use it.
12+
Otherwise, combine .Release.Name and chart name (or nameOverride).
13+
*/}}
14+
{{- define "extUtxorpcOperator.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" | lower -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" | lower -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" | lower -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Chart name and version for the chart label.
29+
*/}}
30+
{{- define "extUtxorpcOperator.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Common labels.
36+
*/}}
37+
{{- define "extUtxorpcOperator.labels" -}}
38+
helm.sh/chart: {{ include "extUtxorpcOperator.chart" . }}
39+
{{ include "extUtxorpcOperator.selectorLabels" . }}
40+
{{- if .Chart.AppVersion }}
41+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
42+
{{- end }}
43+
app.kubernetes.io/managed-by: {{ .Release.Service }}
44+
{{- end -}}
45+
46+
{{/*
47+
Selector labels.
48+
*/}}
49+
{{- define "extUtxorpcOperator.selectorLabels" -}}
50+
app.kubernetes.io/name: {{ include "extUtxorpcOperator.name" . }}
51+
app.kubernetes.io/instance: {{ .Release.Name }}
52+
{{- end -}}
53+
54+
{{/*
55+
Build the EXTENSION_URL_PER_NETWORK value from the extensionUrlsPerNetwork map.
56+
*/}}
57+
{{- define "extUtxorpcOperator.extensionUrlsPerNetwork" -}}
58+
{{- $pairs := list -}}
59+
{{- range $network, $url := .Values.extensionUrlsPerNetwork -}}
60+
{{- $pairs = append $pairs (printf "%s=%s" $network $url) -}}
61+
{{- end -}}
62+
{{- sortAlpha $pairs | join "," -}}
63+
{{- end -}}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: {{ .Release.Namespace }}
6+
labels: {{ include "extUtxorpcOperator.labels" . | nindent 4 }}
7+
spec:
8+
replicas: {{ .Values.replicaCount }}
9+
{{- if .Values.updateStrategy }}
10+
strategy:
11+
type: {{ .Values.updateStrategy.type }}
12+
{{- end }}
13+
selector:
14+
matchLabels: {{ include "extUtxorpcOperator.selectorLabels" . | nindent 6 }}
15+
template:
16+
metadata:
17+
labels: {{ include "extUtxorpcOperator.selectorLabels" . | nindent 8 }}
18+
spec:
19+
serviceAccountName: {{ .Values.serviceAccount.name | default .Release.Name }}
20+
containers:
21+
- name: main
22+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
23+
imagePullPolicy: {{ .Values.image.pullPolicy }}
24+
env:
25+
- name: ADDR
26+
value: "0.0.0.0:9946"
27+
- name: API_KEY_SALT
28+
value: {{ .Values.apiKeySalt | quote }}
29+
- name: EXTENSION_URL_PER_NETWORK
30+
value: {{ include "extUtxorpcOperator.extensionUrlsPerNetwork" . | quote }}
31+
- name: METRICS_DELAY
32+
value: {{ .Values.metricsDelay | quote }}
33+
- name: METRICS_STEP
34+
value: {{ .Values.metricsStep | quote }}
35+
- name: DEFAULT_UTXORPC_VERSION
36+
value: {{ .Values.defaultUtxorpcVersion | quote }}
37+
- name: PROMETHEUS_URL
38+
value: {{ .Values.prometheusUrl | quote }}
39+
resources: {{ toYaml .Values.resources | nindent 12 }}
40+
ports:
41+
- name: metrics
42+
containerPort: 9946
43+
protocol: TCP
44+
{{- if .Values.tolerations }}
45+
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
46+
{{- end }}
47+
{{- if .Values.affinity }}
48+
affinity: {{ toYaml .Values.affinity | nindent 8 }}
49+
{{- end }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{ if .Values.podMonitor.enabled }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: PodMonitor
4+
metadata:
5+
name: {{ .Release.Name }}
6+
namespace: {{ .Release.Namespace }}
7+
labels: {{- include "extUtxorpcOperator.labels" . | nindent 4 }}
8+
{{- with .Values.podMonitor.labels }}
9+
{{ toYaml . | indent 4 }}
10+
{{- end }}
11+
spec:
12+
selector:
13+
matchLabels: {{ include "extUtxorpcOperator.selectorLabels" . | nindent 6 }}
14+
podMetricsEndpoints:
15+
- port: metrics
16+
path: /metrics
17+
{{ end }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
name: {{ .Values.serviceAccount.name | default .Release.Name }}
5+
rules:
6+
- apiGroups: ["", "demeter.run", "networking.k8s.io", "gateway.networking.k8s.io", "configuration.konghq.com", "coordination.k8s.io"]
7+
resources: ["*"]
8+
verbs: ["*"]
9+
---
10+
apiVersion: rbac.authorization.k8s.io/v1
11+
kind: ClusterRoleBinding
12+
metadata:
13+
name: {{ .Values.serviceAccount.name | default .Release.Name }}
14+
subjects:
15+
- kind: ServiceAccount
16+
name: {{ .Values.serviceAccount.name | default .Release.Name }}
17+
namespace: {{ .Release.Namespace }}
18+
roleRef:
19+
kind: ClusterRole
20+
name: {{ .Values.serviceAccount.name | default .Release.Name }}
21+
apiGroup: rbac.authorization.k8s.io
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: {{ .Values.serviceAccount.name | default .Release.Name }}
5+
labels: {{ include "extUtxorpcOperator.labels" . | nindent 4 }}
6+
{{- with .Values.serviceAccount.annotations }}
7+
annotations:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# UTxO RPC Operator values
2+
replicaCount: 1
3+
4+
updateStrategy:
5+
type: RollingUpdate
6+
7+
image:
8+
repository: ghcr.io/demeter-run/ext-cardano-utxorpc-operator
9+
tag: 5bba0eb4bb3d76f6ce17233138c5c5cb08b2da62
10+
pullPolicy: IfNotPresent
11+
12+
# Environment configuration
13+
prometheusUrl: "http://prometheus-operated.mynamespace.svc.cluster.local:9090/api/v1"
14+
metricsDelay: "60"
15+
metricsStep: "30s"
16+
defaultUtxorpcVersion: "v1"
17+
18+
# Changing the salt will trigger reconciliation for UTxO RPC CRs
19+
apiKeySalt: "change-me"
20+
21+
# Map of network names to extension URLs, e.g.:
22+
# extensionUrlsPerNetwork:
23+
# mainnet: "https://utxorpc.mainnet.example.com"
24+
# preprod: "https://utxorpc.preprod.example.com"
25+
extensionUrlsPerNetwork: {}
26+
27+
resources:
28+
limits:
29+
cpu: "1"
30+
memory: "256Mi"
31+
requests:
32+
cpu: "50m"
33+
memory: "256Mi"
34+
tolerations: []
35+
# Example tolerations:
36+
# - key: "key"
37+
# operator: "Equal"
38+
# value: "value"
39+
# effect: "NoSchedule"
40+
affinity: {}
41+
42+
podMonitor:
43+
enabled: false
44+
labels: {}
45+
46+
serviceAccount:
47+
annotations: {}
48+
# name: "utxorpc-operator"

0 commit comments

Comments
 (0)