Initial commit - working through the Flux D1 reference architecture@
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- sync-configmaps.yaml
|
||||
- sync-git-token.yaml
|
||||
@@ -0,0 +1,29 @@
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: sync-flux-configmaps
|
||||
annotations:
|
||||
kustomize.toolkit.fluxcd.io/force: "Enabled"
|
||||
spec:
|
||||
validationFailureAction: Enforce
|
||||
background: false
|
||||
generateExisting: true
|
||||
rules:
|
||||
# This rule ensures that all namespaces
|
||||
# have a copy of the flux-runtime-info configmap from the flux-system namespace.
|
||||
- name: sync-configmaps
|
||||
match:
|
||||
any:
|
||||
- resources:
|
||||
kinds:
|
||||
- v1/Namespace
|
||||
generate:
|
||||
namespace: "{{request.object.metadata.name}}"
|
||||
synchronize: true
|
||||
cloneList:
|
||||
namespace: flux-system
|
||||
kinds:
|
||||
- v1/ConfigMap
|
||||
selector:
|
||||
matchLabels:
|
||||
toolkit.fluxcd.io/runtime: "true"
|
||||
@@ -0,0 +1,27 @@
|
||||
apiVersion: kyverno.io/v1
|
||||
kind: ClusterPolicy
|
||||
metadata:
|
||||
name: sync-git-token
|
||||
spec:
|
||||
mutateExistingOnPolicyUpdate: true
|
||||
rules:
|
||||
- name: copy-token-from-password
|
||||
match:
|
||||
any:
|
||||
- resources:
|
||||
kinds:
|
||||
- Secret
|
||||
names:
|
||||
- flux-system
|
||||
namespaces:
|
||||
- flux-system
|
||||
mutate:
|
||||
targets:
|
||||
- apiVersion: v1
|
||||
kind: Secret
|
||||
name: flux-system
|
||||
namespace: flux-system
|
||||
patchesJson6902: |-
|
||||
- op: add
|
||||
path: "/data/token"
|
||||
value: "{{ request.object.data.password }}"
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- rbac.yaml
|
||||
- kyverno.yaml
|
||||
@@ -0,0 +1,51 @@
|
||||
apiVersion: source.toolkit.fluxcd.io/v1
|
||||
kind: HelmRepository
|
||||
metadata:
|
||||
name: kyverno
|
||||
namespace: kyverno
|
||||
spec:
|
||||
interval: 12h
|
||||
type: oci
|
||||
url: oci://ghcr.io/kyverno/charts
|
||||
---
|
||||
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||
kind: HelmRelease
|
||||
metadata:
|
||||
name: kyverno
|
||||
namespace: kyverno
|
||||
spec:
|
||||
serviceAccountName: flux
|
||||
interval: 1h
|
||||
chart:
|
||||
spec:
|
||||
version: "3.6.0" # {"$imagepolicy": "flux-system:kyverno:tag"}
|
||||
chart: kyverno
|
||||
sourceRef:
|
||||
kind: HelmRepository
|
||||
name: kyverno
|
||||
interval: 12h
|
||||
install:
|
||||
crds: Create
|
||||
timeout: 9m
|
||||
upgrade:
|
||||
crds: CreateReplace
|
||||
timeout: 9m
|
||||
values:
|
||||
admissionController:
|
||||
serviceMonitor:
|
||||
enabled: true
|
||||
rbac:
|
||||
clusterRole:
|
||||
extraResources:
|
||||
- apiGroups: [""]
|
||||
resources: [secrets]
|
||||
verbs: [get, list]
|
||||
backgroundController:
|
||||
serviceMonitor:
|
||||
enabled: true
|
||||
rbac:
|
||||
clusterRole:
|
||||
extraResources:
|
||||
- apiGroups: [""]
|
||||
resources: [secrets]
|
||||
verbs: [get, list, create, update, delete]
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kyverno
|
||||
labels:
|
||||
app.kubernetes.io/component: admission
|
||||
toolkit.fluxcd.io/tenant: platform-team
|
||||
pod-security.kubernetes.io/enforce: baseline
|
||||
@@ -0,0 +1,24 @@
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/component: admission
|
||||
toolkit.fluxcd.io/tenant: platform-team
|
||||
name: flux-admission
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: flux
|
||||
namespace: kyverno
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: flux
|
||||
namespace: kyverno
|
||||
labels:
|
||||
app.kubernetes.io/component: admission
|
||||
toolkit.fluxcd.io/tenant: platform-team
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ../base
|
||||
@@ -0,0 +1,4 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ../base
|
||||
Reference in New Issue
Block a user