Skip to content

Commit 45dc4fc

Browse files
committed
fix: Remove bitnami from bundler chart
1 parent 0b2180c commit 45dc4fc

File tree

17 files changed

+318
-119
lines changed

17 files changed

+318
-119
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: bundler-static-data
5+
data:
6+
{{ (.Files.Glob "static/*.json").AsConfig | indent 2 }}

charts/apps/values.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,45 @@ bundler:
1010
repoUrl: https://github.com/DiamondLightSource/authz.git
1111
targetRevision: HEAD
1212
path: charts/bundler
13+
valuesObject:
14+
15+
extraEnvVars:
16+
- name: BUNDLER_DATABASE_PASSWORD
17+
valueFrom:
18+
secretKeyRef:
19+
name: ispyb
20+
key: password
21+
- name: BUNDLER_DATABASE_URL
22+
value: mysql://ispybdbproxy.diamond.ac.uk:4306/ispyb/ispyb_ro:$(BUNDLER_DATABASE_PASSWORD)
23+
- name: BUNDLER_REQUIRE_TOKEN
24+
valueFrom:
25+
secretKeyRef:
26+
name: token-authorization
27+
key: bearer
28+
- name: BUNDLER_STATIC_DATA
29+
value: /srv/bundler/*.json
30+
31+
volumeMounts:
32+
- name: static-bundler-volume
33+
mountPath: /srv/bundler/
34+
35+
volumes:
36+
- name: static-bundler-volume
37+
configMap:
38+
name: bundler-static-data
39+
40+
autoscaling:
41+
enabled: true
42+
maxReplicas: 10
43+
targetMemoryUtilizationPercentage: 80
44+
45+
ingress:
46+
enabled: true
47+
hosts:
48+
- host: authz.diamond.ac.uk
49+
paths:
50+
- path: /bundle.tar.gz
51+
pathType: Prefix
1352

1453
opa:
1554
enabled: true

charts/bundler/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

charts/bundler/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

charts/bundler/Chart.lock

Lines changed: 0 additions & 6 deletions
This file was deleted.

charts/bundler/Chart.yaml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
apiVersion: v2
22
name: bundler
33
description: A Open Policy Agent (OPA) Data Bundle Server providing permissionable data from ISPyB
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
413
type: application
5-
version: 0.5.3
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.6.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.
624
appVersion: 0.0.16
7-
maintainers:
8-
- name: garryod
9-
email: "garry.o'[email protected]"
10-
dependencies:
11-
- name: common
12-
version: 2.23.0
13-
repository: oci://docker.io/bitnamicharts

charts/bundler/templates/NOTES.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
1. Get the application URL by running these commands:
2+
{{- if .Values.ingress.enabled }}
3+
{{- range $host := .Values.ingress.hosts }}
4+
{{- range .paths }}
5+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
6+
{{- end }}
7+
{{- end }}
8+
{{- else if contains "NodePort" .Values.service.type }}
9+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "bundler.fullname" . }})
10+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
11+
echo http://$NODE_IP:$NODE_PORT
12+
{{- else if contains "LoadBalancer" .Values.service.type }}
13+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
14+
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "bundler.fullname" . }}'
15+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bundler.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
16+
echo http://$SERVICE_IP:{{ .Values.service.port }}
17+
{{- else if contains "ClusterIP" .Values.service.type }}
18+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "bundler.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
19+
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
20+
echo "Visit http://127.0.0.1:8080 to use your application"
21+
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
22+
{{- end }}
Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,62 @@
11
{{/*
2-
Create the database URL environment variable for use by the bundler
2+
Expand the name of the chart.
33
*/}}
4-
{{- define "bundler.databaseURL" -}}
5-
{{- $raw_user_info := printf "%s:$BUNDLER_DATABASE_PASSWORD" .Values.bundler.database.user }}
6-
{{- $raw_database_url := urlJoin (dict "scheme" .Values.bundler.database.scheme "host" .Values.bundler.database.host "path" .Values.bundler.database.path "userinfo" $raw_user_info ) }}
7-
{{- replace "$BUNDLER_DATABASE_PASSWORD" "$(BUNDLER_DATABASE_PASSWORD)" $raw_database_url }}
4+
{{- define "bundler.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "bundler.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "bundler.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "bundler.labels" -}}
37+
helm.sh/chart: {{ include "bundler.chart" . }}
38+
{{ include "bundler.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "bundler.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "bundler.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "bundler.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "bundler.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
862
{{- end }}

charts/bundler/templates/deployment.yaml

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,78 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: {{ include "common.names.fullname" . }}
5-
namespace: {{ .Release.Namespace }}
4+
name: {{ include "bundler.fullname" . }}
65
labels:
7-
{{- include "common.labels.standard" . | nindent 4 }}
6+
{{- include "bundler.labels" . | nindent 4 }}
87
spec:
8+
{{- if not .Values.autoscaling.enabled }}
9+
replicas: {{ .Values.replicaCount }}
10+
{{- end }}
911
selector:
1012
matchLabels:
11-
{{- include "common.labels.matchLabels" . | nindent 6 }}
13+
{{- include "bundler.selectorLabels" . | nindent 6 }}
1214
template:
1315
metadata:
1416
{{- with .Values.podAnnotations }}
1517
annotations:
1618
{{- toYaml . | nindent 8 }}
1719
{{- end }}
1820
labels:
19-
{{- include "common.labels.matchLabels" . | nindent 8 }}
21+
{{- include "bundler.labels" . | nindent 8 }}
22+
{{- with .Values.podLabels }}
23+
{{- toYaml . | nindent 8 }}
24+
{{- end }}
2025
spec:
2126
{{- with .Values.imagePullSecrets }}
2227
imagePullSecrets:
2328
{{- toYaml . | nindent 8 }}
2429
{{- end }}
25-
{{- if .Values.serviceAccount.create }}
26-
serviceAccountName: {{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
27-
{{- else }}
28-
serviceAccountName: {{ default "default" .Values.serviceAccount.name }}
29-
{{- end }}
30+
serviceAccountName: {{ include "bundler.serviceAccountName" . }}
31+
{{- with .Values.podSecurityContext }}
3032
securityContext:
31-
{{- toYaml .Values.podSecurityContext | nindent 8 }}
33+
{{- toYaml . | nindent 8 }}
34+
{{- end }}
3235
containers:
33-
- name: bundler
36+
- name: {{ .Chart.Name }}
37+
{{- with .Values.securityContext }}
3438
securityContext:
35-
{{- toYaml .Values.securityContext | nindent 12 }}
36-
image: "{{ .Values.image.repository}}:{{ default .Chart.AppVersion .Values.image.tag }}"
39+
{{- toYaml . | nindent 12 }}
40+
{{- end }}
41+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3742
imagePullPolicy: {{ .Values.image.pullPolicy }}
3843
args:
3944
- serve
4045
env:
41-
- name: BUNDLER_PORT
42-
value: "80"
43-
- name: BUNDLER_DATABASE_PASSWORD
44-
valueFrom:
45-
secretKeyRef:
46-
name: {{ .Values.bundler.database.passwordSecret.name }}
47-
key: {{ .Values.bundler.database.passwordSecret.key }}
48-
- name: BUNDLER_DATABASE_URL
49-
value: {{ include "bundler.databaseURL" . }}
50-
- name: BUNDLER_REQUIRE_TOKEN
51-
valueFrom:
52-
secretKeyRef:
53-
name: {{ .Values.bundler.requireTokenSecret.name }}
54-
key: {{ .Values.bundler.requireTokenSecret.key }}
5546
- name: BUNDLER_POLLING_INTERVAL
56-
value: {{ .Values.bundler.pollingInterval }}
57-
- name: BUNDLER_STATIC_DATA
58-
value: /srv/bundler/*.json
47+
value: {{ .Values.pollingInterval | quote }}
48+
- name: BUNDLER_PORT
49+
value: {{ .Values.service.port | quote }}
50+
{{- with .Values.extraEnvVars }}
51+
{{- toYaml . | nindent 12 }}
52+
{{- end }}
5953
ports:
6054
- name: http
61-
containerPort: 80
55+
containerPort: {{ .Values.service.port }}
6256
protocol: TCP
57+
{{- with .Values.livenessProbe }}
6358
livenessProbe:
64-
httpGet:
65-
path: /healthz
66-
port: http
59+
{{- toYaml . | nindent 12 }}
60+
{{- end }}
61+
{{- with .Values.readinessProbe }}
6762
readinessProbe:
68-
httpGet:
69-
path: /healthz
70-
port: http
63+
{{- toYaml . | nindent 12 }}
64+
{{- end }}
65+
{{- with .Values.resources }}
7166
resources:
72-
{{- toYaml .Values.resources | nindent 12 }}
73-
{{ if .Values.bundler.staticDataPattern -}}
67+
{{- toYaml . | nindent 12 }}
68+
{{- end }}
69+
{{- with .Values.volumeMounts }}
7470
volumeMounts:
75-
- name: static-bundler-volume
76-
mountPath: /srv/bundler/
71+
{{- toYaml . | nindent 12 }}
7772
{{- end }}
78-
{{ if .Values.bundler.staticDataPattern -}}
73+
{{- with .Values.volumes }}
7974
volumes:
80-
- name: static-bundler-volume
81-
configMap:
82-
name: {{ include "common.names.fullname" . }}-static-data
75+
{{- toYaml . | nindent 8 }}
8376
{{- end }}
8477
{{- with .Values.nodeSelector }}
8578
nodeSelector:

0 commit comments

Comments
 (0)