Skip to content

Commit 0010bf1

Browse files
authored
feat(ext-blockfrost-operator): add helm chart for Blockfrost operator (#364)
1 parent d3b1a4f commit 0010bf1

8 files changed

Lines changed: 279 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v2
2+
name: ext-blockfrost-operator
3+
description: Extension Blockfrost operator
4+
version: 0.0.1
5+
appVersion: "0.0.1"
6+
7+
sources:
8+
- https://github.com/demeter-run/ext-cardano-blockfrost
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: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
name: blockfrostports.demeter.run
5+
spec:
6+
group: demeter.run
7+
scope: Namespaced
8+
names:
9+
kind: BlockfrostPort
10+
plural: blockfrostports
11+
singular: blockfrostport
12+
shortNames:
13+
- bfpts
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: Endpoint URL
28+
jsonPath: .status.endpointUrl
29+
type: string
30+
- name: Authenticated Endpoint URL
31+
jsonPath: .status.authenticatedEndpointUrl
32+
type: string
33+
- name: Auth Token
34+
jsonPath: .status.authToken
35+
type: string
36+
schema:
37+
openAPIV3Schema:
38+
title: BlockfrostPort
39+
description: Auto-generated derived type for BlockfrostPortSpec via `CustomResource`
40+
type: object
41+
required:
42+
- spec
43+
properties:
44+
spec:
45+
type: object
46+
required:
47+
- network
48+
- operatorVersion
49+
- throughputTier
50+
properties:
51+
authToken:
52+
type: string
53+
nullable: true
54+
blockfrostVersion:
55+
type: string
56+
nullable: true
57+
network:
58+
type: string
59+
operatorVersion:
60+
type: string
61+
throughputTier:
62+
type: string
63+
status:
64+
type: object
65+
nullable: true
66+
required:
67+
- authToken
68+
- endpointUrl
69+
properties:
70+
authToken:
71+
type: string
72+
authenticatedEndpointUrl:
73+
type: string
74+
nullable: true
75+
endpointUrl:
76+
type: string
77+
subresources:
78+
status: {}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "extBlockfrostOperator.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
6+
{{- end -}}
7+
8+
{{/*
9+
Create a fully qualified app name.
10+
*/}}
11+
{{- define "extBlockfrostOperator.fullname" -}}
12+
{{- if .Values.fullnameOverride -}}
13+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" | lower -}}
14+
{{- else -}}
15+
{{- $name := default .Chart.Name .Values.nameOverride -}}
16+
{{- if contains $name .Release.Name -}}
17+
{{- .Release.Name | trunc 63 | trimSuffix "-" | lower -}}
18+
{{- else -}}
19+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" | lower -}}
20+
{{- end -}}
21+
{{- end -}}
22+
{{- end -}}
23+
24+
{{/*
25+
Chart name and version for the chart label.
26+
*/}}
27+
{{- define "extBlockfrostOperator.chart" -}}
28+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
29+
{{- end -}}
30+
31+
{{/*
32+
Common labels.
33+
*/}}
34+
{{- define "extBlockfrostOperator.labels" -}}
35+
helm.sh/chart: {{ include "extBlockfrostOperator.chart" . }}
36+
{{ include "extBlockfrostOperator.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 "extBlockfrostOperator.selectorLabels" -}}
47+
app.kubernetes.io/name: {{ include "extBlockfrostOperator.name" . }}
48+
app.kubernetes.io/instance: {{ .Release.Name }}
49+
{{- end -}}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ .Release.Name }}
5+
namespace: {{ .Release.Namespace }}
6+
labels: {{ include "extBlockfrostOperator.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 "extBlockfrostOperator.selectorLabels" . | nindent 6 }}
15+
template:
16+
metadata:
17+
labels: {{ include "extBlockfrostOperator.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: DNS_ZONE
30+
value: {{ .Values.dnsZone | quote }}
31+
- name: EXTENSION_SUBDOMAIN
32+
value: {{ .Values.extensionSubdomain | quote }}
33+
- name: METRICS_DELAY
34+
value: {{ .Values.metricsDelay | quote }}
35+
- name: PROMETHEUS_URL
36+
value: {{ .Values.prometheusUrl | quote }}
37+
resources: {{ toYaml .Values.resources | nindent 12 }}
38+
ports:
39+
- name: metrics
40+
containerPort: 9946
41+
protocol: TCP
42+
{{- if .Values.tolerations }}
43+
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
44+
{{- end }}
45+
{{- if .Values.affinity }}
46+
affinity: {{ toYaml .Values.affinity | nindent 8 }}
47+
{{- 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 "extBlockfrostOperator.labels" . | nindent 4 }}
8+
{{- with .Values.podMonitor.labels }}
9+
{{ toYaml . | indent 4 }}
10+
{{- end }}
11+
spec:
12+
selector:
13+
matchLabels: {{ include "extBlockfrostOperator.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 "extBlockfrostOperator.labels" . | nindent 4 }}
6+
{{- with .Values.serviceAccount.annotations }}
7+
annotations:
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Blockfrost Operator values
2+
replicaCount: 1
3+
4+
updateStrategy:
5+
type: RollingUpdate
6+
7+
image:
8+
repository: ghcr.io/demeter-run/ext-cardano-blockfrost-operator
9+
tag: a7977ca03a96121936e29bd2de1007e7c0ad91b0
10+
pullPolicy: IfNotPresent
11+
12+
# Environment configuration
13+
prometheusUrl: "http://prometheus-operated.mynamespace.svc.cluster.local:9090/api/v1"
14+
metricsDelay: "60"
15+
16+
# Changing the salt will trigger reconciliation for Blockfrost CRs
17+
apiKeySalt: "change-me"
18+
dnsZone: "demeter.run"
19+
extensionSubdomain: "blockfrost-m1"
20+
21+
resources:
22+
limits:
23+
cpu: "500m"
24+
memory: "256Mi"
25+
requests:
26+
cpu: "50m"
27+
memory: "256Mi"
28+
tolerations: []
29+
# Example tolerations:
30+
# - key: "key"
31+
# operator: "Equal"
32+
# value: "value"
33+
# effect: "NoSchedule"
34+
affinity: {}
35+
36+
podMonitor:
37+
enabled: false
38+
labels: {}
39+
40+
serviceAccount:
41+
annotations: {}
42+
# name: ""

0 commit comments

Comments
 (0)