-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Naive output of `helm create tiled` * Update Chart and values * Mount API key, config, set default port * Working example from single_catalog_single_user * Make use of fastapi healthz endpoint * Add docs and enforce mounting api key as Secret * Add github action to publish Helm chart * Switch Service type to ClusterIP to prevent exposing prematurely * Whitespace * Example deployment level configuration * Linting * Adjust names of secrets to match RFC requirements * Whitespace * Ensure semVer compliance * Remove leading v on tag if present to ensure semVer compatible * Ensure Helm chart valid prior to first publish * Defer SemVer parsing to docker metadata action
- Loading branch information
1 parent
8e9608a
commit 8b14aa8
Showing
17 changed files
with
590 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Run Tiled Server from the Helm chart | ||
|
||
There is an official Tiled helm chart image for use with | ||
[Helm](https://helm.sh/) and [Kubernetes](https://kubernetes.io/). | ||
|
||
## Quickstart | ||
|
||
This quickstart guide installs the Tiled server configured with a single API key | ||
with permissions to write and access all data. It is not intended for production use, | ||
and is just a useful default with minimal configuration. | ||
|
||
Installing the Helm chart with default values: | ||
|
||
``` | ||
helm install tiled oci://ghcr.io/bluesky/charts/tiled | ||
``` | ||
|
||
This Helm chart additionally refers to, but does not create, a Secret that contains | ||
the value to use as the API key. It is highly recommended to use a | ||
[SealedSecret](https://github.com/bitnami-labs/sealed-secrets#readme) if kubeseal is | ||
available on the cluster you are installing into. | ||
|
||
See the [Docker documentation](./docker.md) for instructions on creating a secure key. | ||
|
||
```sh | ||
# This will only decrypt in your namespace, in your cluster, and is safe to commit | ||
$ echo -n <key> | kubeseal --raw --namespace <your namespace> --name tiled-secrets | ||
AgCC... | ||
``` | ||
|
||
Use the result as the body of a SealedSecret: | ||
|
||
```yaml | ||
apiVersion: bitnami.com/v1alpha1 | ||
kind: SealedSecret | ||
metadata: | ||
name: tiled-secrets | ||
spec: | ||
encryptedData: | ||
TILED_SINGLE_USER_API_KEY: AgCC... | ||
``` | ||
Apply the SealedSecret to the cluster with kubernetes: | ||
```sh | ||
kubectl apply -f secret.yaml | ||
``` | ||
|
||
## Further Configuration | ||
|
||
A common pattern for managing the configuration of a Helm chart is to wrap the config | ||
as another layer of chart, with the bundled instance configuration and the dependent | ||
charts kept under source control. | ||
|
||
``` | ||
( | ||
| Chart.yaml | ||
| values.yaml | ||
| \templates | ||
| secret.yaml | ||
| .git | ||
``` | ||
|
||
The dependent chart(s): tiled and any other services that *should live and die with the | ||
tiled instance* can be referenced from the Chart.yaml: | ||
|
||
```yaml | ||
apiVersion: v2 | ||
name: my-install-of-tiled | ||
description: tiled configured for use at... | ||
|
||
version: 0.1.0 | ||
appVersion: v0.1.0b12 | ||
|
||
type: application | ||
|
||
dependencies: | ||
# Fetches the tiled Helm chart with version 0.1.0 | ||
- name: tiled | ||
version: "0.1.0" | ||
repository: "oci://ghcr.io/bluesky/charts" | ||
``` | ||
While overrides for the bundled values.yaml in each dependency chart can be passed | ||
as part of the values.yaml. | ||
Note that the `name` in the `dependencies` in the Chart.yaml give the top-level key | ||
to use in the values.yaml: | ||
|
||
```yaml | ||
tiled: | ||
# This is mounted as config.yaml to the tiled container | ||
# Replacing `config` value in the helm/tiled/values.yaml file in this repository | ||
config: {} | ||
``` | ||
Additional templates to be deployed alongside the tiled server can be defined- for | ||
example the SealedSecret defined above. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: v2 | ||
name: tiled | ||
description: Tiled is a data access service for data-aware portals and data science tools. | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# Chart version, automatically incremented by CI during release | ||
version: 0.0.1 | ||
|
||
# Container version, automatically incremented by CI during release | ||
appVersion: v0.1.0b12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "tiled.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "tiled.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tiled.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tiled.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "tiled.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | 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). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "tiled.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 "tiled.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "tiled.labels" -}} | ||
helm.sh/chart: {{ include "tiled.chart" . }} | ||
{{ include "tiled.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "tiled.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "tiled.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "tiled.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "tiled.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "tiled.fullname" . }}-config | ||
data: | ||
config.yaml: |- | ||
{{- toYaml .Values.config | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "tiled.fullname" . }} | ||
labels: | ||
{{- include "tiled.labels" . | nindent 4 }} | ||
spec: | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ .Values.replicaCount }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "tiled.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "tiled.labels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "tiled.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
{{- toYaml .Values.livenessProbe | nindent 12 }} | ||
readinessProbe: | ||
{{- toYaml .Values.readinessProbe | nindent 12 }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
volumeMounts: | ||
{{- with .Values.volumeMounts }} | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
{{- with .Values.extraEnvVars }} | ||
env: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
volumes: | ||
- name: config | ||
projected: | ||
sources: | ||
- configMap: | ||
name: {{ include "tiled.fullname" . }}-config | ||
{{- with .Values.volumes }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Oops, something went wrong.