Skip to content

Commit

Permalink
feat: helm chart for deploying saml-playground
Browse files Browse the repository at this point in the history
  • Loading branch information
NithinKuruba committed May 13, 2024
1 parent b128e4e commit dc3e300
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 0 deletions.
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:
SERVER_HOST: 'localhost'
SERVER_PORT: 8080

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

0 comments on commit dc3e300

Please sign in to comment.