Skip to content

Commit

Permalink
Merge branch 'main' into feat/quarkus-keycloak-proto
Browse files Browse the repository at this point in the history
  • Loading branch information
NithinKuruba committed Jun 3, 2024
2 parents bd165ae + 236924d commit d04a322
Show file tree
Hide file tree
Showing 18 changed files with 282 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish-helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- "charts/**/Chart.yaml"
- ".github/workflows/publish-helm-chart.yml"
workflow_dispatch:

jobs:
build-and-push-helm:
Expand Down
4 changes: 2 additions & 2 deletions charts/keycloak/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: sso-keycloak
version: 1.14.4
appVersion: 7.6.25-build.1
version: 1.15.2
appVersion: 7.6.39-build.1
description: Open Source Identity and Access Management For Modern Applications and Services
dependencies:
- name: patroni
Expand Down
3 changes: 3 additions & 0 deletions charts/keycloak/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ The following table lists the configurable parameters of the Keycloak chart and
| `tolerations` | toleration settings | `[]` |
| `affinity` | affinity settings | `{}` |
| `affinityTemplate` | a template string to use to generate the affinity settings | |
| `podDisruptionBudget.enabled` | does keycloak have a pod disruption budget | false |
| `podDisruptionBudget.minAvailable` | min number of keycloak pods available | |
| `podDisruptionBudget.maxUnavailable` | max number of keycloak pods unavailable | |
| `maintenancePage.enabled` | deploy maintenance page app | `false` |
| `maintenancePage.active` | forward incoming traffic to maintenance page app | `false` |
| `maintenancePage.replicaCount` | number of maintenance app pods to create | `1` |
Expand Down
11 changes: 11 additions & 0 deletions charts/keycloak/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,14 @@ Maintenance Selector labels
app.kubernetes.io/name: {{ include "sso-keycloak.name" . }}-maintenance
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "sso-keycloak.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "sso-keycloak.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
25 changes: 25 additions & 0 deletions charts/keycloak/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,31 @@ spec:
{{- end }}
labels: {{ include "sso-keycloak.labels" . | nindent 8 }}
spec:
initContainers:
- name: {{ .Chart.Name }}-init
image: openshift/origin-cli:latest
command:
- "/bin/sh"
- "-c"
- |
namespace="{{ .Release.Namespace }}"
name={{ .Values.patroni.nameOverride }}
echo "Current Namespace: $namespace"
echo "Patroni Statefulset: $name"
check_master_ready(){
if kubectl -n $namespace get pods -l app.kubernetes.io/name=$name,spilo-role=master -o custom-columns='ready:status.containerStatuses[*].ready' | grep true -c; then
echo "Master pod is ready"
return 0
else
echo "Master pod is not ready"
return 1
fi
}
while ! check_master_ready; do
echo "Waiting for master pod to be ready..."
sleep 5
done
serviceAccountName: {{ include "sso-keycloak.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Expand Down
17 changes: 17 additions & 0 deletions charts/keycloak/templates/poddisruptionbudget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ template "sso-keycloak.fullname" . }}-pdb
labels: {{ include "sso-keycloak.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- else if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- else }}
minAvailable: 0
{{- end }}
selector:
matchLabels: {{ include "sso-keycloak.selectorLabels" . | nindent 6 }}
{{- end }}
32 changes: 32 additions & 0 deletions charts/keycloak/templates/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{- if .Values.rbac.create }}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ include "sso-keycloak.fullname" . }}
labels: {{ include "sso-keycloak.labels" . | nindent 4 }}
rules:
- apiGroups: ["apps"]
resources: ["statefulsets"]
verbs:
- get
- list
- apiGroups: [""]
resources: ["pods"]
verbs:
- get
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ include "sso-keycloak.fullname" . }}
labels: {{ include "sso-keycloak.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "sso-keycloak.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ include "sso-keycloak.fullname" . }}
---
{{- end }}
7 changes: 7 additions & 0 deletions charts/keycloak/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "sso-keycloak.fullname" . }}
labels: {{ include "sso-keycloak.labels" . | nindent 4 }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/keycloak/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ affinityTemplate: |
labelSelector:
matchLabels: {{ include "sso-keycloak.selectorLabels" . | nindent 10 }}
podDisruptionBudget:
enabled: false
minAvailable:
maxUnavailable:

serviceAccount:
create: true

rbac:
# Specifies whether RBAC resources should be created
create: true

patroni:
replicaCount: 3
# RH-SSO v7.5-9 is not tested with PostgreSQL 14
Expand Down
4 changes: 2 additions & 2 deletions charts/patroni/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v1
name: patroni
description: "Highly available: HA PostgreSQL cluster."
version: 1.5.2
appVersion: 2.1-p5
version: 1.6.0
appVersion: 3.2-p1
home: https://github.com/bcgov/sso-helm-charts/tree/main/charts/patroni
sources:
- https://github.com/zalando/patroni
Expand Down
6 changes: 3 additions & 3 deletions charts/patroni/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ replicaCount: 3

image:
# see https://github.com/zalando/spilo/releases
repository: registry.opensource.zalan.do/acid/spilo-14
repository: ghcr.io/zalando/spilo-15
pullPolicy: Always
tag: 2.1-p5
tag: 3.2-p1

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

postgresMajorVersion: 14
postgresMajorVersion: 15

# Credentials used by Patroni
credentials:
Expand Down
5 changes: 5 additions & 0 deletions charts/saml-playground/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
name: saml-playground
version: 1.0.0
appVersion: 1.0.0
description: SAML Playground built using NodeJS
32 changes: 32 additions & 0 deletions charts/saml-playground/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "..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 "..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 "..chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
40 changes: 40 additions & 0 deletions charts/saml-playground/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "..fullname" . }}
labels:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "..chart" . }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- containerPort: 8080
name: http
protocol: TCP
env:
{{- range $key, $val := .Values.env }}
- name: {{ $key | quote | upper }}
value: {{ $val | quote }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
20 changes: 20 additions & 0 deletions charts/saml-playground/templates/network-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# see https://docs.openshift.com/container-platform/4.7/networking/network_policy/multitenant-network-policy.html#nw-networkpolicy-multitenant-isolation_multitenant-network-policy
# only allow connections from the OpenShift Container Platform Ingress Controller.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-from-openshift-ingress-{{ include "..name" . }}
labels:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "..chart" . }}
spec:
ingress:
- from:
- namespaceSelector:
matchLabels:
policy-group.network.openshift.io/ingress: ""
podSelector: {}
policyTypes:
- Ingress
23 changes: 23 additions & 0 deletions charts/saml-playground/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: {{ include "..fullname" . }}
labels:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "..chart" . }}
annotations:
haproxy.router.openshift.io/balance: roundrobin
haproxy.router.openshift.io/disable_cookies: 'true'
haproxy.router.openshift.io/timeout: 120s
spec:
{{- if .Values.route.host }}
host: {{ .Values.route.host }}
{{- end }}
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: {{ include "..fullname" . }}
19 changes: 19 additions & 0 deletions charts/saml-playground/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "..fullname" . }}
labels:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "..chart" . }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
protocol: TCP
name: http
targetPort: http
selector:
app.kubernetes.io/name: {{ include "..name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
28 changes: 28 additions & 0 deletions charts/saml-playground/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
replicaCount: 1

image:
repository: ghcr.io/bcgov/pathfinder-sso/saml-playground
tag: dev
pullPolicy: Always

nameOverride: saml-playground
fullnameOverride: saml-playground

service:
type: ClusterIP
port: 8080

route:
host:

env:
APP_URI: "https://saml-playground-c6af30-dev.apps.gold.devops.gov.bc.ca"
SERVER_PORT: 8080

resources:
limits:
cpu: 50m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi

0 comments on commit d04a322

Please sign in to comment.