Skip to content
Merged
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
36 changes: 29 additions & 7 deletions helm/fe-docs/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
{{/*
Chart name helper
*/}}
{{- define "fe-docs.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Chart helper
*/}}
{{- define "fe-docs.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "labels.common" -}}
app: {{ include "name" . | quote }}
{{ include "labels.selector" . }}
application.giantswarm.io/branch: {{ .Values.project.branch | quote }}
application.giantswarm.io/commit: {{ .Values.project.commit | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
{{- define "commonLabels" -}}
app.kubernetes.io/name: {{ include "fe-docs.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
helm.sh/chart: {{ include "fe-docs.chart" . }}
{{- if .Chart.Annotations }}
application.giantswarm.io/team: {{ index .Chart.Annotations "io.giantswarm.application.team" | quote }}
helm.sh/chart: {{ include "chart" . | quote }}
{{- end }}
{{- end -}}

{{/*
Legacy common labels (for backwards compatibility)
*/}}
{{- define "labels.common" -}}
app: {{ include "fe-docs.name" . | quote }}
{{ include "commonLabels" . }}
{{- end -}}
16 changes: 9 additions & 7 deletions helm/fe-docs/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ apiVersion: apps/v1
kind: Deployment
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
labels:
app: {{ .Values.name }}
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: {{ .Values.name }}
app: {{ include "fe-docs.name" . }}
template:
metadata:
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
labels:
app: {{ .Values.name }}
{{- include "commonLabels" . | nindent 8 }}
app: {{ include "fe-docs.name" . }}
spec:
securityContext:
fsGroup: 1337
Expand Down Expand Up @@ -66,5 +68,5 @@ spec:
volumes:
- name: nginx-tmp
emptyDir: {}
serviceAccount: {{ .Values.name }}
serviceAccountName: {{ .Values.name }}
serviceAccount: {{ include "fe-docs.name" . }}
serviceAccountName: {{ include "fe-docs.name" . }}
11 changes: 7 additions & 4 deletions helm/fe-docs/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
namespace: {{ .Release.Namespace }}
labels:
app: {{ .Values.name }}
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
annotations:
cert-manager.io/cluster-issuer: letsencrypt-giantswarm
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
spec:
ingressClassName: nginx
rules:
{{- $serviceName := .Values.name -}}
{{- $serviceName := include "fe-docs.name" . -}}
{{- $port := .Values.port -}}
{{- if or (not (.Values.hostnames)) (eq (len .Values.hostnames) 0) }}
{{- fail "value for .Values.hostnames must not be empty" }}
Expand All @@ -34,4 +36,5 @@ spec:
{{- range .Values.hostnames }}
- {{ . }}
{{- end }}
secretName: {{ .Values.name }}
secretName: {{ include "fe-docs.name" . }}
{{- end }}
8 changes: 4 additions & 4 deletions helm/fe-docs/templates/kyverno-policy-exception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ apiVersion: kyverno.io/v2
kind: PolicyException
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
labels:
app: {{ .Values.name }}
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
spec:
background: true
exceptions:
Expand Down Expand Up @@ -40,9 +41,8 @@ spec:
- ReplicaSet
- Pod
names:
- "{{ .Values.name }}*"
- "{{ include "fe-docs.name" . }}*"
- "fe-docs*"
namespaces:
- "{{ .Release.Namespace }}"
{{- end }}

16 changes: 11 additions & 5 deletions helm/fe-docs/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
rules:
- apiGroups:
- extensions
resourceNames:
- {{ .Values.name }}
- {{ include "fe-docs.name" . }}
resources:
- podsecuritypolicies
verbs:
Expand All @@ -17,14 +20,17 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
subjects:
- kind: ServiceAccount
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
91 changes: 91 additions & 0 deletions helm/fe-docs/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{{- if .Values.route.enabled -}}
{{- $route := .Values.route }}
---
apiVersion: gateway.networking.k8s.io/v1
kind: {{ $route.kind | default "HTTPRoute" }}
metadata:
name: {{ $route.name | default (include "fe-docs.name" .) }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "commonLabels" $ | nindent 4 }}
app: {{ include "fe-docs.name" . }}
{{- with $route.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $route.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $route.parentRefs }}
parentRefs:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $route.hostnames }}
hostnames:
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- if $route.additionalRules }}
{{- tpl (toYaml $route.additionalRules) $ | nindent 4 }}
{{- end }}
- backendRefs:
- name: {{ include "fe-docs.name" . }}
port: {{ .Values.port }}
{{- with $route.filters }}
filters:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $route.matches }}
matches:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if and $route.securityPolicy $route.securityPolicy.enabled }}
{{- $policy := $route.securityPolicy }}
---
apiVersion: gateway.envoyproxy.io/v1alpha1
kind: SecurityPolicy
metadata:
name: {{ $route.name | default (include "fe-docs.name" .) }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "commonLabels" $ | nindent 4 }}
app: {{ include "fe-docs.name" . }}
{{- with $policy.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $policy.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: {{ $route.kind | default "HTTPRoute" }}
name: {{ $route.name | default (include "fe-docs.name" .) }}
{{- with $policy.basicAuth }}
basicAuth:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $policy.cors }}
cors:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $policy.jwt }}
jwt:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $policy.oidc }}
oidc:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $policy.extAuth }}
extAuth:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $policy.authorization }}
authorization:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 4 additions & 1 deletion helm/fe-docs/templates/service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ apiVersion: v1
kind: ServiceAccount
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
labels:
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
7 changes: 4 additions & 3 deletions helm/fe-docs/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ kind: Service
apiVersion: v1
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.name }}
name: {{ include "fe-docs.name" . }}
labels:
app: {{ .Values.name }}
{{- include "commonLabels" . | nindent 4 }}
app: {{ include "fe-docs.name" . }}
spec:
ports:
- port: {{ .Values.port }}
targetPort: http
selector:
app: {{ .Values.name }}
app: {{ include "fe-docs.name" . }}
Loading