Init commit
This commit is contained in:
28
examples/extensions/flux2/crd-configmap.yaml
Normal file
28
examples/extensions/flux2/crd-configmap.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
{{/*
|
||||
We have to create individual configmaps for each CRD - they exceed the total
|
||||
allowed length for a configmap if they are combined.
|
||||
*/}}
|
||||
{{ $currentScope := . }}
|
||||
{{- if .Values.crds.install }}
|
||||
{{- range $path, $_ := .Files.Glob "crd-base/**" }}
|
||||
{{- with $currentScope }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "crdInstall" . }}-{{ $path | base | trimSuffix ".yaml" }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-5"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
data:
|
||||
content: |
|
||||
{{ tpl (.Files.Get $path) . | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
80
examples/extensions/flux2/crd-job.yaml
Normal file
80
examples/extensions/flux2/crd-job.yaml
Normal file
@ -0,0 +1,80 @@
|
||||
{{- if .Values.crds.install }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: {{ include "crdInstallJob" . }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-1"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
spec:
|
||||
ttlSecondsAfterFinished: 3600
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 8 }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "crdInstall" . }}
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 2000
|
||||
{{- if ge (int .Capabilities.KubeVersion.Minor) 19 }}
|
||||
{{- with .Values.crds.podSeccompProfile }}
|
||||
seccompProfile:
|
||||
{{- . | toYaml | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
effect: NoSchedule
|
||||
- key: node-role.kubernetes.io/control-plane
|
||||
effect: NoSchedule
|
||||
containers:
|
||||
- name: kubectl
|
||||
image: "{{ .Values.images.registry }}/giantswarm/docker-kubectl:1.23.6"
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
set -o errexit ; set -o xtrace ; set -o nounset
|
||||
|
||||
# piping stderr to stdout means kubectl's errors are surfaced
|
||||
# in the pod's logs.
|
||||
|
||||
kubectl apply -f /data/ 2>&1
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
{{- if ge (int .Capabilities.KubeVersion.Minor) 19 }}
|
||||
{{- with .Values.crds.seccompProfile }}
|
||||
seccompProfile:
|
||||
{{- . | toYaml | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- range $path, $_ := .Files.Glob "crd-base/**" }}
|
||||
- name: {{ $path | base | trimSuffix ".yaml" }}
|
||||
mountPath: /data/{{ $path | base }}
|
||||
subPath: {{ $path | base }}
|
||||
{{- end }}
|
||||
resources: {{- toYaml .Values.crds.resources | nindent 10 }}
|
||||
volumes:
|
||||
{{ $currentScope := . }}
|
||||
{{- range $path, $_ := .Files.Glob "crd-base/**" }}
|
||||
{{- with $currentScope }}
|
||||
- name: {{ $path | base | trimSuffix ".yaml" }}
|
||||
configMap:
|
||||
name: {{ include "crdInstall" . }}-{{ $path | base | trimSuffix ".yaml" }}
|
||||
items:
|
||||
- key: content
|
||||
path: {{ $path | base }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
restartPolicy: Never
|
||||
backoffLimit: 4
|
||||
{{- end }}
|
59
examples/extensions/flux2/crd-np.yaml
Normal file
59
examples/extensions/flux2/crd-np.yaml
Normal file
@ -0,0 +1,59 @@
|
||||
{{- if .Values.crds.install }}
|
||||
{{- if .Capabilities.APIVersions.Has "cilium.io/v2/CiliumNetworkPolicy" }}
|
||||
apiVersion: cilium.io/v2
|
||||
kind: CiliumNetworkPolicy
|
||||
metadata:
|
||||
name: {{ include "crdInstall" . }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-7"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
spec:
|
||||
egress:
|
||||
- toEntities:
|
||||
- kube-apiserver
|
||||
endpointSelector: {}
|
||||
{{- else }}
|
||||
kind: NetworkPolicy
|
||||
apiVersion: networking.k8s.io/v1
|
||||
metadata:
|
||||
name: {{ include "crdInstall" . }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-7"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 6 }}
|
||||
# allow egress traffic to the Kubernetes API
|
||||
egress:
|
||||
- ports:
|
||||
- port: 443
|
||||
protocol: TCP
|
||||
# legacy port kept for compatibility
|
||||
- port: 6443
|
||||
protocol: TCP
|
||||
to:
|
||||
{{- range tuple "10.0.0.0/8" "172.16.0.0/12" "192.168.0.0/16" "100.64.0.0/10" }}
|
||||
- ipBlock:
|
||||
cidr: {{ . }}
|
||||
{{- end }}
|
||||
# deny ingress traffic
|
||||
ingress: []
|
||||
policyTypes:
|
||||
- Egress
|
||||
- Ingress
|
||||
{{- end }}
|
||||
{{- end }}
|
62
examples/extensions/flux2/crd-rbac.yaml
Normal file
62
examples/extensions/flux2/crd-rbac.yaml
Normal file
@ -0,0 +1,62 @@
|
||||
{{- if .Values.crds.install }}
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "crdInstall" . }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-3"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- jobs
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- apiGroups:
|
||||
- apiextensions.k8s.io
|
||||
resources:
|
||||
- customresourcedefinitions
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- patch
|
||||
- apiGroups:
|
||||
- policy
|
||||
resources:
|
||||
- podsecuritypolicies
|
||||
resourceNames:
|
||||
- {{ include "crdInstall" . }}
|
||||
verbs:
|
||||
- use
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "crdInstall" . }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-2"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.common" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "crdInstall" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "crdInstall" . }}
|
||||
namespace: {{ .Release.Namespace | quote }}
|
||||
{{- end }}
|
15
examples/extensions/flux2/crd-serviceaccount.yaml
Normal file
15
examples/extensions/flux2/crd-serviceaccount.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
{{- if .Values.crds.install }}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "crdInstall" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
annotations:
|
||||
# create hook dependencies in the right order
|
||||
"helm.sh/hook-weight": "-4"
|
||||
{{- include "crdInstallAnnotations" . | nindent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/component: {{ include "crdInstall" . | quote }}
|
||||
{{- include "labels.selector" . | nindent 4 }}
|
||||
role: {{ include "crdInstallSelector" . | quote }}
|
||||
{{- end }}
|
30
examples/extensions/vaultwarden/virtual-service.yaml
Normal file
30
examples/extensions/vaultwarden/virtual-service.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
{{- if .Values.virtualservice.enabled -}}
|
||||
{{- $fullName := include "vaultwarden.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- if $.Capabilities.APIVersions.Has "networking.istio.io/v1beta1" }}
|
||||
apiVersion: networking.istio.io/v1beta1
|
||||
kind: VirtualService
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
{{- include "vaultwarden.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
gateways:
|
||||
- {{ .Values.virtaulservice.gatewayRef }}
|
||||
hosts:
|
||||
- ci.badhouseplants.ne
|
||||
http:
|
||||
- match:
|
||||
- uri:
|
||||
prefix: /
|
||||
route:
|
||||
- destination:
|
||||
host: woodpecker-ci-server
|
||||
port:
|
||||
number: 80
|
||||
{{- end }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user