Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/publish-ext-kupo-operator-helm-chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: publish-ext-kupo-operator-helm-chart

on:
push:
branches: ["main"]
paths:
[
"charts/ext-kupo-operator/**",
".github/workflows/publish-ext-kupo-operator-helm-chart.yml",
]

jobs:
build-and-push-ext-kupo-operator-helm-chart:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5
- name: Install Helm
uses: azure/setup-helm@v4
- name: Package and upload chart
shell: bash
env:
REGISTRY: "ghcr.io"
REPOSITORY: "${{ github.repository }}"
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
USER: "${{ github.repository_owner }}"
run: |
rm -rf dist
mkdir dist
helm package charts/ext-kupo-operator/ -d dist/
echo "${TOKEN}" | helm registry login "${REGISTRY}" -u "${USER}" --password-stdin
for file in dist/*; do
helm push "$file" "oci://${REGISTRY}/${REPOSITORY,,}/charts"
done
18 changes: 18 additions & 0 deletions charts/ext-kupo-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: ext-kupo-operator
description: Extention Kupo operator
version: 0.0.1
appVersion: "0.0.1"

sources:
- https://github.com/demeter-run/ext-cardano-kupo

maintainers:
- name: aurora
email: aurora@blinklabs.io
- name: overcookedpanda
email: overcookedpanda@blinklabs.io
- name: verbotenj
email: verbotenj@blinklabs.io
- name: wolf31o2
email: wolf31o2@blinklabs.io
83 changes: 83 additions & 0 deletions charts/ext-kupo-operator/crds/crds.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: kupoports.demeter.run
spec:
group: demeter.run
scope: Namespaced
names:
kind: KupoPort
plural: kupoports
singular: kupoport
shortNames:
- kpts
categories:
- demeter-port
versions:
- name: v1alpha1
served: true
storage: true
additionalPrinterColumns:
- name: Network
jsonPath: .spec.network
type: string
- name: Pruned
jsonPath: .spec.pruneUtxo
type: boolean
- name: Throughput Tier
jsonPath: .spec.throughputTier
type: string
- name: Endpoint URL
jsonPath: .status.endpointUrl
type: string
- name: Authenticated Endpoint URL
jsonPath: .status.authenticatedEndpointUrl
type: string
- name: Auth Token
jsonPath: .status.authToken
type: string
schema:
openAPIV3Schema:
title: KupoPort
description: Auto-generated derived type for KupoPortSpec via `CustomResource`
type: object
required:
- spec
properties:
spec:
type: object
required:
- network
- pruneUtxo
- throughputTier
properties:
authToken:
type: string
nullable: true
kupoVersion:
type: string
nullable: true
network:
type: string
operatorVersion:
type: string
pruneUtxo:
type: boolean
throughputTier:
type: string
status:
type: object
nullable: true
required:
- authToken
- endpointUrl
properties:
authToken:
type: string
authenticatedEndpointUrl:
type: string
nullable: true
endpointUrl:
type: string
subresources:
status: {}
52 changes: 52 additions & 0 deletions charts/ext-kupo-operator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{/*
Expand the name of the chart.
If .Values.nameOverride is not set, use .Chart.Name.
*/}}
{{- define "extKupoOperator.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a fully qualified app name.
If .Values.fullnameOverride is set, use it.
Otherwise, combine .Release.Name and chart name (or nameOverride).
*/}}
{{- define "extKupoOperator.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" | lower -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" | lower -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" | lower -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Chart name and version for the chart label.
*/}}
{{- define "extKupoOperator.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

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

{{/*
Selector labels.
*/}}
{{- define "extKupoOperator.selectorLabels" -}}
app.kubernetes.io/name: {{ include "extKupoOperator.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
47 changes: 47 additions & 0 deletions charts/ext-kupo-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels: {{ include "extKupoOperator.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels: {{ include "extKupoOperator.selectorLabels" . | nindent 6 }}
template:
metadata:
labels: {{ include "extKupoOperator.selectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ .Values.serviceAccount.name | default .Release.Name }}
containers:
- name: main
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: ADDR
value: "0.0.0.0:9946"
- name: PROMETHEUS_URL
value: {{ .Values.prometheusUrl | quote }}
- name: METRICS_DELAY
value: {{ .Values.metricsDelay | quote }}
- name: DCU_PER_REQUEST
value: "mainnet={{ .Values.perRequestDcus.mainnet }},preprod={{ .Values.perRequestDcus.default }},preview={{ .Values.perRequestDcus.default }},sanchonet={{ .Values.perRequestDcus.default }}"
- name: API_KEY_SALT
value: {{ .Values.apiKeySalt | quote }}
- name: DEFAULT_KUPO_VERSION
value: {{ .Values.defaultKupoVersion | quote }}
- name: EXTENSION_SUBDOMAIN
value: {{ .Values.extensionSubdomain | quote }}
- name: DNS_ZONE
value: {{ .Values.dnsZone | quote }}
resources: {{ toYaml .Values.resources | nindent 12 }}
ports:
- name: metrics
containerPort: 9946
protocol: TCP
{{- if .Values.tolerations }}
tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity: {{ toYaml .Values.affinity | nindent 8 }}
{{- end }}
17 changes: 17 additions & 0 deletions charts/ext-kupo-operator/templates/podmonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{ if .Values.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ .Release.Name }}
namespace: {{ .Release.Namespace }}
labels: {{- include "extKupoOperator.labels" . | nindent 4 }}
{{- with .Values.podMonitor.labels }}
{{ toYaml . | indent 4 }}
{{- end }}
spec:
selector:
matchLabels: {{ include "extKupoOperator.selectorLabels" . | nindent 6 }}
podMetricsEndpoints:
- port: metrics
path: /metrics
{{ end }}
21 changes: 21 additions & 0 deletions charts/ext-kupo-operator/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.serviceAccount.name | default .Release.Name }}
rules:
- apiGroups: ["", "demeter.run", "networking.k8s.io", "gateway.networking.k8s.io", "configuration.konghq.com", "coordination.k8s.io"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.serviceAccount.name | default .Release.Name }}
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.name | default .Release.Name }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Values.serviceAccount.name | default .Release.Name }}
apiGroup: rbac.authorization.k8s.io
9 changes: 9 additions & 0 deletions charts/ext-kupo-operator/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name | default .Release.Name }}
labels: {{ include "extKupoOperator.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
46 changes: 46 additions & 0 deletions charts/ext-kupo-operator/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Kupo Operator values
replicaCount: 1
image:
repository: ghcr.io/demeter-run/ext-cardano-kupo-operator
tag: latest
pullPolicy: IfNotPresent

# Environment configuration
prometheusUrl: "http://prometheus-operated.mynamspace.svc.cluster.local:9090/api/v1"
metricsDelay: "60"

apiKeySalt: "change-me"
defaultKupoVersion: "v2"
dnsZone: "example.com"
extensionSubdomain: "kupo.example.com"

# DCU per request configuration
perRequestDcus:
mainnet: "10"
preprod: "5"
preview: "5"
sanchonet: "5"
default: "5"

resources:
limits:
cpu: "100m"
memory: "128Mi"
requests:
cpu: "50m"
memory: "64Mi"
tolerations: []
# Example tolerations:
# - key: "key"
# operator: "Equal"
# value: "value"
# effect: "NoSchedule"
affinity: {}

podMonitor:
enabled: false
labels: {}

serviceAccount:
annotations: {}
name: "kupo-operator"