Skip to content

Commit 0da844a

Browse files
Merge pull request #1 from EOPF-Sample-Service/stac-browser
Add Helm chart for STAC Browser
2 parents 0863ecf + 8480058 commit 0da844a

File tree

6 files changed

+136
-0
lines changed

6 files changed

+136
-0
lines changed

helm-chart/browser/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: browser
3+
description: STAC Browser for eoAPI
4+
# A chart can be either an 'application' or a 'library' chart.
5+
#
6+
# Application charts are a collection of templates that can be packaged into versioned archives
7+
# to be deployed.
8+
#
9+
# Library charts provide useful utilities or functions for the chart developer. They're included as
10+
# a dependency of application charts to inject those utilities and functions into the rendering
11+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
12+
type: application
13+
kubeVersion: ">=1.23.0-0"
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: "0.1.0"
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "3.3.3"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{{- if (.Values.browser.enabled) }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: browser-envvar-configmap-{{ $.Release.Name }}
6+
data:
7+
{{- range $envKey, $envValue := index .Values.browser.settings.envVars }}
8+
{{ $envKey }}: {{ $envValue | quote }}
9+
{{- end }}
10+
{{- end }}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{{- if (.Values.browser.enabled) }}
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: browser-{{ .Release.Name }}
6+
spec:
7+
replicas: {{.Values.browser.replicaCount}}
8+
selector:
9+
matchLabels:
10+
app: browser-{{ .Release.Name }}
11+
template:
12+
metadata:
13+
labels:
14+
app: browser-{{ .Release.Name }}
15+
spec:
16+
containers:
17+
- name: browser
18+
image: {{ .Values.browser.image.name }}:{{ .Values.browser.image.tag }}
19+
ports:
20+
- containerPort: 8080
21+
envFrom:
22+
# NOTE: there's no reason we need to use a `ConfigMap` or `Secret` here to get os env vars into the pod.
23+
# we could just template them out here immediately with `value: $_` but this allows us
24+
# to store them in k8s intermediately and change them and then bounce deploys if needed
25+
- configMapRef:
26+
name: browser-envvar-configmap-{{ $.Release.Name }}
27+
{{- end }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- if (and (.Values.ingress.enabled) (eq .Values.ingress.className "nginx")) }}
2+
{{- if (.Values.browser.enabled) }}
3+
# We need a separate ingress because browser does not play well with nginx rewrite_path directive
4+
apiVersion: networking.k8s.io/v1
5+
kind: Ingress
6+
metadata:
7+
name: nginx-browser-ingress-shared-{{ $.Release.Name }}
8+
labels:
9+
app: nginxsharedingress
10+
annotations:
11+
nginx.ingress.kubernetes.io/use-regex: "true"
12+
nginx.ingress.kubernetes.io/enable-cors: "true"
13+
# enable-access-log is required for nginx to dump metrics about path rewrites for prometheus to scrape
14+
nginx.ingress.kubernetes.io/enable-access-log: "true"
15+
{{- if (and (.Values.ingress.tls.enabled) (.Values.ingress.tls.certManager)) }}
16+
cert-manager.io/issuer: {{ .Values.ingress.tls.certManagerIssuer }}
17+
{{- end }}
18+
spec:
19+
ingressClassName: {{ .Values.ingress.className }}
20+
rules:
21+
- http:
22+
paths:
23+
- pathType: Prefix
24+
path: /
25+
backend:
26+
service:
27+
name: browser
28+
port:
29+
number: {{ $.Values.service.port }}
30+
{{/* END: if (.Values.browser.enabled) */}}
31+
{{- end }}
32+
{{/* END: if (and (.Values.ingress.enabled) (eq .Values.ingress.className "nginx")) */}}
33+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{- if (.Values.browser.enabled) }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
app: browser
7+
name: browser
8+
spec:
9+
{{- if (and ($.Values.ingress.className) (eq $.Values.ingress.className "nginx")) }}
10+
type: "ClusterIP"
11+
{{- else }}
12+
type: "NodePort"
13+
{{- end }}
14+
ports:
15+
- name: '{{ $.Values.service.port }}'
16+
port: {{ $.Values.service.port }}
17+
targetPort: {{ $.Values.service.port }}
18+
selector:
19+
app: browser-{{ .Release.Name }}
20+
{{- end }}

helm-chart/browser/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
ingress:
3+
enabled: true
4+
className: "nginx"
5+
host: ""
6+
tls:
7+
enabled: false
8+
secretName: eoapi-tls
9+
certManager: false
10+
certManagerIssuer: letsencrypt-prod
11+
certManagerEmail: ""
12+
13+
browser:
14+
enabled: true
15+
image:
16+
name: ghcr.io/radiantearth/stac-browser
17+
tag: 3.3.3
18+
replicaCount: 1
19+
settings:
20+
envVars:
21+
SB_catalogUrl: "/stac"
22+
SB_detectLocaleFromBrowser: "false"

0 commit comments

Comments
 (0)