Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/apps/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: authz
description: ArgoCD Apps used to deploy Authorization infrastructure
type: application
version: 0.2.0
version: 0.3.0
File renamed without changes.
5 changes: 5 additions & 0 deletions charts/apps/templates/bundler-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ spec:
repoURL: {{ .Values.bundler.repoUrl }}
targetRevision: {{ .Values.bundler.targetRevision }}
path: {{ .Values.bundler.path }}
{{- if .Values.bundler.valuesObject }}
helm:
valuesObject:
{{ .Values.bundler.valuesObject | toYaml | nindent 10 }}
{{- end }}
destination:
name: {{ .Values.destination.name }}
server: {{ .Values.destination.server }}
Expand Down
6 changes: 6 additions & 0 deletions charts/apps/templates/bundler-static-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: bundler-static-data
data:
{{- ( .Files.Glob "static/*.json" ).AsConfig | nindent 2 }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ spec:
creationTimestamp: null
name: token-authorization
namespace: authz-warehouse

90 changes: 84 additions & 6 deletions charts/apps/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,104 @@ bundler:
repoUrl: https://github.com/DiamondLightSource/authz.git
targetRevision: HEAD
path: charts/bundler
valuesObject:

extraEnvVars:
- name: BUNDLER_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: ispyb
key: password
- name: BUNDLER_DATABASE_URL
value: mysql://ispybdbproxy.diamond.ac.uk:4306/ispyb/ispyb_ro:$(BUNDLER_DATABASE_PASSWORD)
- name: BUNDLER_REQUIRE_TOKEN
valueFrom:
secretKeyRef:
name: token-authorization
key: bearer
- name: BUNDLER_STATIC_DATA
value: /srv/bundler/*.json

volumeMounts:
- name: static-bundler-volume
mountPath: /srv/bundler/

volumes:
- name: static-bundler-volume
configMap:
name: bundler-static-data

autoscaling:
enabled: true
maxReplicas: 10
targetMemoryUtilizationPercentage: 80

ingress:
enabled: true
hosts:
- host: authz.diamond.ac.uk
paths:
- path: /bundle.tar.gz
pathType: Prefix

opa:
enabled: true
repoUrl: https://github.com/DiamondLightSource/authz.git
targetRevision: HEAD
path: charts/opa
valuesObject:
orgData:
bundlerSecret:
name: token-authorization
key: bearer
orgPolicy:
enabled: true

env:
- name: BUNDLER_BEARER_TOKEN
valueFrom:
secretKeyRef:
name: token-authorization
key: bearer
- name: ISSUER
value: https://authn.diamond.ac.uk/realms/master

autoscaling:
enabled: true
minReplicas: 2
maxReplicas: 10
targetMemoryUtilizationPercentage: 80

ingress:
enabled: true
hosts:
- host: authz.diamond.ac.uk
paths:
- path: /
pathType: Prefix

config:
services:
diamond-bundler:
url: https://authz.diamond.ac.uk
credentials:
bearer:
token: ${BUNDLER_BEARER_TOKEN}
ghcr:
url: https://ghcr.io
type: oci
bundles:
diamond-permissionables:
service: diamond-bundler
resource: bundle.tar.gz
polling:
min_delay_seconds: 10
max_delay_seconds: 60
diamond-policies:
service: ghcr
resource: ghcr.io/diamondlightsource/authz-policy:0.0.16
polling:
min_delay_seconds: 30
max_delay_seconds: 120

resources:
requests:
cpu: 1000m
memory: 2Gi
limits:
cpu: 1000m
memory: 2Gi
1 change: 0 additions & 1 deletion charts/bundler/.gitignore

This file was deleted.

23 changes: 23 additions & 0 deletions charts/bundler/.helmignore
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/
6 changes: 0 additions & 6 deletions charts/bundler/Chart.lock

This file was deleted.

27 changes: 19 additions & 8 deletions charts/bundler/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
apiVersion: v2
name: bundler
description: A Open Policy Agent (OPA) Data Bundle Server providing permissionable data from ISPyB

# 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
version: 0.5.3

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.6.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: 0.0.16
maintainers:
- name: garryod
email: "garry.o'donnell@diamond.ac.uk"
dependencies:
- name: common
version: 2.23.0
repository: oci://docker.io/bitnamicharts
22 changes: 22 additions & 0 deletions charts/bundler/templates/NOTES.txt
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 "bundler.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 "bundler.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "bundler.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 "bundler.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 }}
64 changes: 59 additions & 5 deletions charts/bundler/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,62 @@
{{/*
Create the database URL environment variable for use by the bundler
Expand the name of the chart.
*/}}
{{- define "bundler.databaseURL" -}}
{{- $raw_user_info := printf "%s:$BUNDLER_DATABASE_PASSWORD" .Values.bundler.database.user }}
{{- $raw_database_url := urlJoin (dict "scheme" .Values.bundler.database.scheme "host" .Values.bundler.database.host "path" .Values.bundler.database.path "userinfo" $raw_user_info ) }}
{{- replace "$BUNDLER_DATABASE_PASSWORD" "$(BUNDLER_DATABASE_PASSWORD)" $raw_database_url }}
{{- define "bundler.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 "bundler.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 "bundler.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "bundler.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "bundler.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading
Loading