Skip to content

Commit

Permalink
Commit triggered by a change on the main branch of helm-charts-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rconway committed Jan 8, 2024
1 parent d012dc7 commit f2036b5
Show file tree
Hide file tree
Showing 13 changed files with 565 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/identity-gatekeeper/.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/
24 changes: 24 additions & 0 deletions charts/identity-gatekeeper/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: identity-gatekeeper
description: Policy enforcement integration with Keycloak

# 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

# 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: 1.0.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: "2.8.0"
82 changes: 82 additions & 0 deletions charts/identity-gatekeeper/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "identity-gatekeeper.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 "identity-gatekeeper.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 "identity-gatekeeper.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "identity-gatekeeper.labels" -}}
helm.sh/chart: {{ include "identity-gatekeeper.chart" . }}
{{ include "identity-gatekeeper.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Values.deployment.image.tag | default .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

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

{{/*
Return the appropriate apiVersion for ingress
*/}}
{{- define "identity-gatekeeper.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" (include "identity-gatekeeper.kubeVersion" $) -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" (include "identity-gatekeeper.kubeVersion" $) -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the target Kubernetes version
*/}}
{{- define "identity-gatekeeper.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
{{- end -}}
10 changes: 10 additions & 0 deletions charts/identity-gatekeeper/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "identity-gatekeeper.fullname" . }}
labels:
{{- include "identity-gatekeeper.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
data:
config.yaml: |
{{- tpl (.Values.config | toYaml) $ | nindent 4 }}
117 changes: 117 additions & 0 deletions charts/identity-gatekeeper/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
{{- $adminPort := regexFind ":[0-9]+" (index .Values.config "listen-admin") | trimPrefix ":" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "identity-gatekeeper.name" . }}
labels:
{{- include "identity-gatekeeper.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.deployment.replicaCount }}
{{- end }}
strategy:
{{- toYaml .Values.deployment.strategy | nindent 4 }}
selector:
matchLabels:
{{- include "identity-gatekeeper.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ print .Values.config | sha256sum | quote }}
{{- if and (index .Values.config "enable-metrics") .Values.metrics.addPrometheusScrapeAnnotation }}
prometheus.io/path: "/oauth/metrics"
prometheus.io/port: {{ $adminPort | quote }}
prometheus.io/scrape: "true"
{{- end }}
{{- with .Values.deployment.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "identity-gatekeeper.selectorLabels" . | nindent 8 }}
{{- range $key, $value := .Values.deployment.podLabels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
{{- with .Values.deployment.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
automountServiceAccountToken: {{ .Values.deployment.automountServiceAccountToken }}
serviceAccountName: {{ include "identity-gatekeeper.serviceAccountName" . }}
{{- if .Values.deployment.podSecurityContext.enabled }}
securityContext:
{{- omit .Values.deployment.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.deployment.containerSecurityContext.enabled }}
securityContext:
{{- omit .Values.deployment.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
image: "{{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
args:
- --config
- /etc/gatekeeper/config.yaml
{{- with .Values.deployment.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.deployment.extraEnvVars }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
envFrom:
{{- with .Values.deployment.extraEnvFrom }}
{{- tpl . $ | nindent 12 }}
{{- end }}
- secretRef:
name: {{ include "identity-gatekeeper.name" . }}
ports:
- name: proxy
containerPort: {{ regexFind ":[0-9]+" .Values.config.listen | trimPrefix ":" }}
protocol: TCP
- name: admin
containerPort: {{ $adminPort }}
protocol: TCP
{{- if .Values.deployment.livenessProbe.enabled }}
livenessProbe:
{{- omit .Values.deployment.livenessProbe "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.deployment.readinessProbe.enabled }}
readinessProbe:
{{- omit .Values.deployment.readinessProbe "enabled" | toYaml | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.deployment.resources | nindent 12 }}
volumeMounts:
- mountPath: /etc/gatekeeper
name: config
{{- with .Values.deployment.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- configMap:
name: {{ include "identity-gatekeeper.fullname" . }}
name: config
{{- with .Values.deployment.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.deployment.priorityClassName }}
priorityClassName: {{ . | quote }}
{{- end }}
{{- with .Values.deployment.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.deployment.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.deployment.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.deployment.hostAliases }}
hostAliases: {{ toYaml .Values.deployment.hostAliases | nindent 8 }}
{{- end }}
29 changes: 29 additions & 0 deletions charts/identity-gatekeeper/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "identity-gatekeeper.fullname" . }}
labels:
{{- include "identity-gatekeeper.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "identity-gatekeeper.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
{{- end }}
51 changes: 51 additions & 0 deletions charts/identity-gatekeeper/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.ingress.enabled -}}
{{- $name := include "identity-gatekeeper.name" . -}}
{{- $svcPort := .Values.service.proxy.port -}}
apiVersion: {{ include "identity-gatekeeper.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $name }}
labels:
{{- include "identity-gatekeeper.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ .Release.Namespace }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" (include "identity-gatekeeper.kubeVersion" $)) }}
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 and .pathType (semverCompare ">=1.18-0" (include "identity-gatekeeper.kubeVersion" $)) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" (include "identity-gatekeeper.kubeVersion" $) }}
service:
name: {{ $name }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $name }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/identity-gatekeeper/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.pdb.create }}
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ include "identity-gatekeeper.fullname" . }}
labels:
{{- include "identity-gatekeeper.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
minAvailable: {{ .Values.pdb.minAvailable }}
selector:
matchLabels:
{{- include "identity-gatekeeper.selectorLabels" . | nindent 6 }}
{{- end }}
11 changes: 11 additions & 0 deletions charts/identity-gatekeeper/templates/sealedsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
name: {{ include "identity-gatekeeper.name" . }}
labels:
{{- include "identity-gatekeeper.labels" . | nindent 4 }}
namespace: {{ .Release.Namespace }}
spec:
encryptedData:
PROXY_CLIENT_SECRET: "{{ .Values.secrets.clientSecret }}"
PROXY_ENCRYPTION_KEY: "{{ .Values.secrets.encryptionKey }}"
Loading

0 comments on commit f2036b5

Please sign in to comment.