Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Central opa deployment #167

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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.1.0
version: 0.2.0
28 changes: 28 additions & 0 deletions charts/apps/templates/opa-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{ if .Values.opa.enabled }}
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: opa
namespace: {{ .Release.Namespace }}
finalizers:
- resources-finalizer.argocd.arogproj.io
spec:
project: {{ default .Release.Namespace .Values.project }}
source:
repoURL: {{ .Values.opa.repoUrl }}
targetRevision: {{ .Values.opa.targetRevision }}
path: {{ .Values.opa.path }}
{{- if .Values.opa.valuesObject }}
helm:
valuesObject:
{{ .Values.opa.valuesObject | toYaml | nindent 10 }}
{{- end }}
destination:
name: {{ .Values.destination.name }}
server: {{ .Values.destination.server }}
namespace: {{ default .Release.Namespace .Values.destination.namespace }}
syncPolicy:
automated:
prune: true
selfHeal: true
{{- end }}
21 changes: 21 additions & 0 deletions charts/apps/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,24 @@ bundler:
repoUrl: https://github.com/DiamondLightSource/authz.git
targetRevision: HEAD
path: charts/bundler

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
userinfoEndpoint: https://auth.diamond.ac.uk/cas/oidc/oidcProfile
ingress:
enabled: true
hosts:
- host: authz.diamond.ac.uk
paths:
- path: /
pathType: Prefix
2 changes: 1 addition & 1 deletion charts/bundler/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: bundler
description: A Open Policy Agent (OPA) Data Bundle Server providing permissionable data from ISPyB
type: application
version: 0.2.1
version: 0.3.0
appVersion: 0.0.11
maintainers:
- name: garryod
Expand Down
4 changes: 2 additions & 2 deletions charts/bundler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ ingress:
hosts:
- host: authz.diamond.ac.uk
paths:
- path: /
pathType: Prefix
- path: /bundle.tar.gz
pathType: ImplementationSpecific
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought Diamond Kyverno policy disallowed this?

Copy link
Member Author

@garryod garryod Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an exception which can be granted. If Prefix or Exact are used then paths with separators (.) in them are disallowed

tls: []

resources: {}
Expand Down
2 changes: 1 addition & 1 deletion charts/opa/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: opa
description: An OPA deployment to run alongside applications requiring authorization
type: application
version: 0.4.0
version: 0.5.0
appVersion: 0.59.0
maintainers:
- name: garryod
Expand Down
6 changes: 5 additions & 1 deletion charts/opa/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "common.names.fullname" . }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ default (include "common.names.fullname" .) .Values.serviceAccount.name }}
{{- else }}
serviceAccountName: {{ default "default" .Values.serviceAccount.name }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down
44 changes: 44 additions & 0 deletions charts/opa/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "common.names.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "common.labels.standard" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
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 .pathType }}
pathType: {{ .pathType }}
{{- end }}
backend:
service:
name: {{ include "common.names.fullname" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}
9 changes: 8 additions & 1 deletion charts/opa/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ extraEnv: []
portOverride: ""

serviceAccount:
create: false
create: true
name: ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended to create a SA with name "default"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the name of the deployment


podAnnotations: {}
Expand All @@ -40,6 +40,13 @@ service:
type: ClusterIP
port: 80

ingress:
enabled: false
className: ""
annotations: {}
hosts: []
tls: []

resources: {}

replicaCount: 1
Expand Down
Loading