diff --git a/infrastructure/charts/mev-commit-points-service/Chart.yaml b/infrastructure/charts/mev-commit-points-service/Chart.yaml new file mode 100644 index 000000000..e363f6f04 --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: mev-commit-points-service +description: A Helm chart for deploying mev-commit-points-service service +type: application +version: 0.1.0 +appVersion: "v0.2.0" diff --git a/infrastructure/charts/mev-commit-points-service/templates/_helpers.tpl b/infrastructure/charts/mev-commit-points-service/templates/_helpers.tpl new file mode 100644 index 000000000..cbadabc10 --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/templates/_helpers.tpl @@ -0,0 +1,51 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "points-service.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +*/}} +{{- define "points-service.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 "points-service.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | replace "/" "-" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "points-service.labels" -}} +helm.sh/chart: {{ include "points-service.chart" . }} +{{ include "points-service.selectorLabels" . }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.commonLabels }} +{{ toYaml .Values.commonLabels }} +{{- end }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "points-service.selectorLabels" -}} +app.kubernetes.io/name: {{ include "points-service.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app: {{ include "points-service.name" . }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-points-service/templates/configmap.yaml b/infrastructure/charts/mev-commit-points-service/templates/configmap.yaml new file mode 100644 index 000000000..03f0ae00f --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/templates/configmap.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "points-service.fullname" . }}-config + labels: + {{- include "points-service.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +data: + POINTS_DB_PATH: {{ .Values.config.dbPath | quote }} + POINTS_LOG_LEVEL: {{ .Values.config.logLevel | quote }} + POINTS_LOG_FMT: {{ .Values.config.logFormat | quote }} + POINTS_ETH_RPC_URL: {{ .Values.config.ethRpcUrl | quote }} + POINTS_START_BLOCK: {{ .Values.config.startBlock | quote }} + POINTS_MAINNET: {{ .Values.config.mainnet | quote }} + POINTS_API_AUTH_TOKEN: {{ .Values.config.apiAuthToken | quote }} diff --git a/infrastructure/charts/mev-commit-points-service/templates/deployment.yaml b/infrastructure/charts/mev-commit-points-service/templates/deployment.yaml new file mode 100644 index 000000000..b8d953e80 --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/templates/deployment.yaml @@ -0,0 +1,73 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "points-service.fullname" . }} + labels: + {{- include "points-service.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + replicas: {{ .Values.replicaCount }} + strategy: + type: Recreate + selector: + matchLabels: + {{- include "points-service.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "points-service.selectorLabels" . | nindent 8 }} + {{- with .Values.commonLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + runAsUser: 0 # Run as root + runAsGroup: 0 + ports: + - containerPort: {{ .Values.service.port }} + name: http + envFrom: + - configMapRef: + name: {{ include "points-service.fullname" . }}-config + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + {{- end }} + volumeMounts: + - name: points-data + mountPath: {{ .Values.persistence.mountPath | default "/app/data" }} + livenessProbe: + httpGet: + path: {{ .Values.probes.liveness.path }} + port: {{ .Values.probes.liveness.port }} + initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.liveness.periodSeconds }} + readinessProbe: + httpGet: + path: {{ .Values.probes.readiness.path }} + port: {{ .Values.probes.readiness.port }} + initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.readiness.periodSeconds }} + volumes: + - name: points-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ include "points-service.fullname" . }}-pvc + {{- else }} + emptyDir: {} + {{- end }} diff --git a/infrastructure/charts/mev-commit-points-service/templates/ingress.yaml b/infrastructure/charts/mev-commit-points-service/templates/ingress.yaml new file mode 100644 index 000000000..c04fba95f --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/templates/ingress.yaml @@ -0,0 +1,48 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ include "points-service.fullname" . }} + labels: + {{- include "points-service.labels" . | nindent 4 }} + annotations: + {{- with .Values.commonAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.ingress.className }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - secretName: {{ .secretName }} + {{- if .hosts }} + hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + {{- end }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - {{- if .host }} + host: {{ .host | quote }} + {{- end }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + pathType: {{ .pathType | default "Prefix" }} + backend: + service: + name: {{ include "points-service.fullname" $ }} + port: + number: {{ $.Values.service.port }} + {{- end }} + {{- end }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-points-service/templates/pvc.yaml b/infrastructure/charts/mev-commit-points-service/templates/pvc.yaml new file mode 100644 index 000000000..22f08c7db --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/templates/pvc.yaml @@ -0,0 +1,34 @@ +{{- if .Values.persistence.enabled -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "points-service.fullname" . }}-pvc + labels: + {{- include "points-service.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.persistence.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + accessModes: + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{- if .Values.persistence.storageClass }} + {{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: {{ .Values.persistence.storageClass | quote }} + {{- end }} + {{- end }} + {{- if .Values.persistence.selector }} + selector: + {{- toYaml .Values.persistence.selector | nindent 4 }} + {{- end }} +{{- end }} diff --git a/infrastructure/charts/mev-commit-points-service/templates/service.yaml b/infrastructure/charts/mev-commit-points-service/templates/service.yaml new file mode 100644 index 000000000..bac9879c6 --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/templates/service.yaml @@ -0,0 +1,23 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "points-service.fullname" . }} + labels: + {{- include "points-service.labels" . | nindent 4 }} + {{- with .Values.commonAnnotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.targetPort }} + protocol: TCP + name: http + selector: + {{- if .Values.service.customSelectors }} + {{- toYaml .Values.service.customSelectors | nindent 4 }} + {{- else }} + {{- include "points-service.selectorLabels" . | nindent 4 }} + {{- end }} diff --git a/infrastructure/charts/mev-commit-points-service/values.yaml b/infrastructure/charts/mev-commit-points-service/values.yaml new file mode 100644 index 000000000..ac316e63a --- /dev/null +++ b/infrastructure/charts/mev-commit-points-service/values.yaml @@ -0,0 +1,96 @@ +replicaCount: 1 + +image: + repository: + tag: + pullPolicy: IfNotPresent + +nameOverride: "" +fullnameOverride: "mev-commit-points-service" + +# Common labels to apply to all resources +commonLabels: {} + # team: mev-commit + # environment: production + +# Common annotations to apply to all resources +commonAnnotations: {} + # prometheus.io/scrape: "true" + # prometheus.io/port: "8080" + +# Node selector for pod assignment +nodeSelector: {} + # disktype: ssd + # kubernetes.io/os: linux + +service: + type: ClusterIP + port: 8080 + targetPort: 8080 + # Custom selectors for the service (if empty, uses the default selector labels) + customSelectors: {} + # app: points-service + # tier: backend + # environment: production + +# Resource limits and requests +resources: + limits: + cpu: 2000m + memory: 1Gi + requests: + cpu: 250m + memory: 256Mi + +# Persistent Volume Configuration +persistence: + enabled: true + size: 2Gi + accessModes: + - ReadWriteOnce + storageClass: "standard" + mountPath: /app/data + annotations: {} + selector: {} + +# Ingress configuration +ingress: + enabled: true + className: "nginx" + annotations: + nginx.ingress.kubernetes.io/rewrite-target: "/" + # Optional: ExternalDNS annotation + external-dns.alpha.kubernetes.io/hostname: "" + hosts: + - host: + paths: + - path: / + pathType: Prefix + # TLS configuration using Cloudflare Origin Certificate + tls: + - secretName: + hosts: + - + +# Configuration for the Points Service +config: + dbPath: "/app/data/points.db" + logLevel: "info" + logFormat: "json" + ethRpcUrl: "" + startBlock: "" + mainnet: "true" + apiAuthToken: "" + +# Probe configuration +probes: + liveness: + path: /health + port: 8080 + initialDelaySeconds: 30 + periodSeconds: 30 + readiness: + path: /health + port: 8080 + initialDelaySeconds: 10 + periodSeconds: 10