Skip to content

Commit

Permalink
Merge pull request #256 from MinaFoundation/PM-1952-open-mina-create-…
Browse files Browse the repository at this point in the history
…helm-chart

PM-1952 - Openmina Node - Add Ingress + Service
  • Loading branch information
kaozenn authored Sep 5, 2024
2 parents 4994d8b + eb37043 commit d12a185
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 4 deletions.
8 changes: 7 additions & 1 deletion openmina-node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@ helmfile status
| image.repository | string | `"openmina/openmina"` | The image repository |
| image.tag | string | `"v0.8.1"` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | The secrets used to pull the image |
| ingress.annotations | object | `{}` | The Ingress Annotations |
| ingress.className | string | `""` | The Ingress Class Name to use |
| ingress.enabled | bool | `false` | Whether to create an Ingress |
| ingress.hosts | list | `[{"host":"chart-example.local","paths":[{"path":"/","pathType":"ImplementationSpecific"}]}]` | The Ingress Hosts |
| ingress.tls | list | `[]` | The TLS configuration |
| livenessProbe | string | `nil` | Liveness check configuration |
| nameOverride | string | `""` | The release name override |
| node.args | list | `[]` | The arguments to pass at runtime |
| node.envVars | object | `{}` | The environment variables to set |
| node.libp2p.privateKey | string | `""` | The libp2p private key |
| node.libp2p.publicKey | string | `""` | The libp2p public key |
| node.port | int | `3000` | The port the openmina container listens on |
| node.wallet.privateKey | string | `""` | The wallet private key |
| node.wallet.publicKey | string | `""` | The wallet public key |
| nodeSelector | object | `{}` | Node selector labels |
Expand All @@ -65,6 +69,8 @@ helmfile status
| replicaCount | int | `1` | The number of replicas |
| resources | object | `{}` | Resource limitations for the pods |
| securityContext | object | `{}` | The Security Context |
| service.port | int | `3000` | The service port |
| service.type | string | `"ClusterIP"` | The service type |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials? |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
Expand Down
2 changes: 1 addition & 1 deletion openmina-node/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
{{- end }}
ports:
- name: http
containerPort: {{ .Values.node.port }}
containerPort: {{ .Values.service.port }}
protocol: TCP
env:
{{- if .Values.node.envVars }}
Expand Down
61 changes: 61 additions & 0 deletions openmina-node/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "openmina-node.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "openmina-node.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
15 changes: 15 additions & 0 deletions openmina-node/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "openmina-node.fullname" . }}
labels:
{{- include "openmina-node.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "openmina-node.selectorLabels" . | nindent 4 }}
29 changes: 27 additions & 2 deletions openmina-node/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,34 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

node:
# -- The port the openmina container listens on
service:
# -- The service type
type: ClusterIP
# -- The service port
port: 3000

ingress:
# -- Whether to create an Ingress
enabled: false
# -- The Ingress Class Name to use
className: ""
# -- The Ingress Annotations
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# -- The Ingress Hosts
hosts:
- host: chart-example.local
paths:
- path: /
pathType: ImplementationSpecific
# -- The TLS configuration
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

node:
wallet:
# -- The wallet private key
privateKey: ""
Expand Down

0 comments on commit d12a185

Please sign in to comment.