theshire/kubernetes/apps/kyverno/kyverno/policies/schematic-to-pod.yaml
2024-10-29 10:33:33 -05:00

39 lines
1.2 KiB
YAML

---
# yaml-language-server: $schema=https://ks.hsn.dev/kyverno.io/clusterpolicy_v1.json
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: add-talos-factory-schematic-to-node
annotations:
pod-policies.kyverno.io/autogen-controllers: none
policies.kyverno.io/title: Adds talos factory schematic to node
policies.kyverno.io/category: Other
policies.kyverno.io/subject: Pod
kyverno.io/kyverno-version: 1.10.0
policies.kyverno.io/minversion: 1.10.0
kyverno.io/kubernetes-version: "1.30"
spec:
background: false
rules:
- name: project-foo
match:
any:
- resources:
kinds:
- Pod/binding
names:
- apply-talos*
context:
- name: node
variable:
jmesPath: request.object.target.name
default: ""
- name: schematic
apiCall:
urlPath: "/api/v1/nodes/{{node}}"
jmesPath: 'metadata.annotations."extensions.talos.dev/schematic" || ''empty'''
mutate:
patchStrategicMerge:
metadata:
annotations:
extensions.talos.dev/schematic: "{{ schematic }}"