All Policies

Advertise Node Extended Resources

Kubernetes Nodes, in addition to standard compute resources like CPU and memory, may offer extended resources such as FPGAs and GPUs, both of which can be defined per custom design. These extended resources are advertised in the `status` object of a Node. This policy, functional only starting in Kyverno 1.9, adds the extended resource `example.com/dongle` with a value/capacity of `2` to Kubernetes Nodes.

Policy Definition

/other/advertise-node-extended-resources/advertise-node-extended-resources.yaml

 1apiVersion: kyverno.io/v1
 2kind: ClusterPolicy
 3metadata:
 4  name: advertise-node-extended-resources
 5  annotations:
 6    policies.kyverno.io/title: Advertise Node Extended Resources
 7    policies.kyverno.io/category: Other
 8    policies.kyverno.io/severity: medium
 9    kyverno.io/kyverno-version: 1.9.0
10    policies.kyverno.io/minversion: 1.9.0
11    kyverno.io/kubernetes-version: "1.24"
12    policies.kyverno.io/subject: Node
13    policies.kyverno.io/description: >-
14      Kubernetes Nodes, in addition to standard compute resources like
15      CPU and memory, may offer extended resources such as FPGAs and GPUs, both
16      of which can be defined per custom design. These extended resources are
17      advertised in the `status` object of a Node. This policy, functional only
18      starting in Kyverno 1.9, adds the extended resource `example.com/dongle` with
19      a value/capacity of `2` to Kubernetes Nodes.
20spec:
21  background: false
22  rules:
23    - name: advertise-dongle
24      match:
25        any:
26        - resources:
27            kinds:
28            - Node/status
29      mutate:
30        patchStrategicMerge:
31          status:
32            capacity:
33              example.com/dongle: 2