Skip to content

Commit

Permalink
Adding helm chart to the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
zer0stars committed Oct 12, 2023
1 parent a931137 commit c247973
Show file tree
Hide file tree
Showing 21 changed files with 1,181 additions and 0 deletions.
9 changes: 9 additions & 0 deletions helm/tableland/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
description: Official Tableland helm chart for
home: https://github.com/tablelandnetwork/go-tableland
maintainers:
- email: [email protected]
name: Tableland
name: tableland
version: 0.5.0
appVersion: v1.8.1
6 changes: 6 additions & 0 deletions helm/tableland/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1. Watch the tableland node come up .
$ kubectl get pods --namespace={{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "tableland.name" . }} -w
2. Watch the node logs .
$ kubectl logs --namespace={{ .Release.Namespace }} -l app.kubernetes.io/name={{ include "tableland.name" . }} -c tableland -f
2. Port forward the pod to your local pc .
$ kubectl port-forward --namespace={{ .Release.Namespace }} svc/{{ template "tableland.uname" . }} {{ .Values.httpPort }}
108 changes: 108 additions & 0 deletions helm/tableland/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Tableland Validator Node Helm Chart

This Helm chart installs a Tableland Validator Node in a Kubernetes cluster.

## Prerequisites

- Kubernetes 1.18+
- Helm 3.0+

## Get Repo Info

```shell
helm repo add [repo-name] [repo-url]
helm repo update
```


# Install Chart

```shell
helm install [release-name] [chart] -f values.yaml
```


# Uninstall Chart
```shell
helm uninstall [release-name]
```

Configuration
-------------

The following table lists the configurable parameters of the Tableland Validator Node chart and their default values, specified in `values.yaml`.

| Parameter | Description | Default |
| --- | --- | --- |
| `fullnameOverride` | Override the full resource names | `""` |
| `image` | Tableland image | `textile/tableland` |
| `imageTag` | Image tag | `"v1.8.1-beta-3"` |
| `imagePullPolicy` | Image pull policy | `"IfNotPresent"` |
| `imagePullSecrets` | Specify image pull secrets | `[]` |
| `httpPort` | Http port of the application | `8080` |
| `httpsPort` | Https port of the application | `8443` |
| `metricsPort` | Metrics port of the application | `8888` |
| `...` | ... | ... |

You can specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```shell
helm install [release-name] [repo-name]/tableland-validator-node --set imagePullPolicy=Always
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,


```shell
helm install [release-name] [repo-name]/tableland-validator-node -f values.yaml
``````

### Image

| Parameter | Description | Default |
| --- | --- | --- |
| `image.repository` | Tableland image name | `textile/tableland` |
| `image.tag` | Image tag | `v1.8.1-beta-3` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `imagePullSecrets` | Specify image pull secrets | `[]` |

### Pod Settings

| Parameter | Description | Default |
| --- | --- | --- |
| `podAnnotations` | Annotations for pods | `{}` |
| `resources` | Resource limits and requests | `{}` |
| `terminationGracePeriod` | Time to wait for clean shutdown | `120` |
| `...` | ... | ... |

### Configurations

Specify configurations for Tableland in `config` key. You can edit the configuration provided to the node under the values.yaml config key.

### Configurations

### Extra Environment Variables

`extraEnvs` provides a way to add extra environment variables. Use this to insert additional secret environment variables.

### Ingress

| Parameter | Description | Default |
| --- | --- | --- |
| `ingress.enabled` | Enables Ingress | `false` |
| `ingress.className` | Ingress Class Name | `nginx` |
| `ingress.hosts` | Ingress accepted hostnames | `[]` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.tls` | Ingress TLS configuration | `[]` |

### RBAC settings, Persistence, etc.

The rest of the parameters (RBAC settings, Persistence, Extra Containers, etc.) can be found in the provided `values.yaml` file. Ensure to review and tailor them according to your use-case.

### Note

Ensure to review and customize the `values.yaml` file as per your deployment strategy to provide specific settings for environment variables, resources, etc.

# Configuration

The following table lists the configurable parameters of the Tableland Validator Node chart and their default values, specified in values.yaml.
68 changes: 68 additions & 0 deletions helm/tableland/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "tableland.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "tableland.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "tableland.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "tableland.uname" -}}
{{- 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 }}

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

{{/*
Selector labels
*/}}
{{- define "tableland.selectorLabels" -}}
app.kubernetes.io/name: {{ include "tableland.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "tableland.endpoints" -}}
{{- $replicas := int (toString (.Values.replicas)) }}
{{- $uname := (include "tableland.uname" .) }}
{{- range $i, $e := untilStep 0 $replicas 1 -}}
{{ $uname }}-{{ $i }},
{{- end -}}
{{- end -}}

{{/*
Use the fullname if the serviceAccount value is not set
*/}}
{{- define "tableland.serviceAccount" -}}
{{- .Values.rbac.serviceAccountName | default (include "tableland.uname" .) -}}
{{- end -}}
14 changes: 14 additions & 0 deletions helm/tableland/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "tableland.uname" . }}-config
labels:
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
chart: "{{ .Chart.Name }}"
app: "{{ template "tableland.uname" . }}"
data:
{{- range $path, $config := .Values.config }}
{{ $path }}: |-
{{ $config | indent 4 -}}
{{- end -}}
61 changes: 61 additions & 0 deletions helm/tableland/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "tableland.uname" . -}}
{{- $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 "tableland.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: 8080
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
11 changes: 11 additions & 0 deletions helm/tableland/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.maxUnavailable }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: "{{ template "tableland.uname" . }}-pdb"
spec:
maxUnavailable: {{ .Values.maxUnavailable }}
selector:
matchLabels:
app: "{{ template "tableland.uname" . }}"
{{- end }}
22 changes: 22 additions & 0 deletions helm/tableland/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
kind: Service
apiVersion: v1
metadata:
name: {{ template "tableland.uname" . }}
labels:
{{- include "tableland.labels" . | nindent 4 }}
{{- if .Values.service.labels }}
{{ toYaml .Values.service.labels | indent 4 }}
{{- end }}
annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
publishNotReadyAddresses: true
selector:
{{- include "tableland.selectorLabels" . | nindent 4 }}
ports:
- name: {{ .Values.service.httpPortName | default "http" }}
port: {{ .Values.httpPort }}
- name: {{ .Values.service.httpsPortName | default "https" }}
port: {{ .Values.httpsPort }}
- name: {{ .Values.service.monHttpsPortName | default "mon-http" }}
port: {{ .Values.metricsPort }}
13 changes: 13 additions & 0 deletions helm/tableland/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.rbac.create -}}
{{- $fullName := include "tableland.uname" . -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: "{{ template "tableland.serviceAccount" . }}"
annotations:
{{- with .Values.rbac.serviceAccountAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "tableland.labels" . | nindent 4 }}
{{- end -}}
22 changes: 22 additions & 0 deletions helm/tableland/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "tableland.uname" . }}-monitor
namespace: {{ .Release.Namespace }}
labels:
{{- include "tableland.labels" . | nindent 4 }}
spec:
selector:
matchLabels:
{{- include "tableland.selectorLabels" . | nindent 6 }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: {{ .Values.serviceMonitor.port }}
{{- if .Values.serviceMonitor.interval }}
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
path: {{ .Values.serviceMonitor.path | quote }}
{{- end }}
Loading

0 comments on commit c247973

Please sign in to comment.