File size: 1,697 Bytes
df0899b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
apiVersion: templates.gatekeeper.sh/v1
kind: ConstraintTemplate
metadata:
  name: verifydeprecatedapi
  annotations:
    metadata.gatekeeper.sh/title: "Verify deprecated APIs"
    metadata.gatekeeper.sh/version: 1.0.0
    description: >-
      Verifies deprecated Kubernetes APIs to ensure all the API versions are up to date. This template does not apply to audit as audit looks at the resources which are already present in the cluster with non-deprecated API versions.
spec:
  crd:
    spec:
      names:
        kind: VerifyDeprecatedAPI
      validation:
        openAPIV3Schema:
          type: object
          properties:
            kvs:
              type: array
              description: Deprecated api versions and corresponding kinds
              items:
                type: object
                properties:
                  deprecatedAPI:
                    type: string
                    description: deprecated api
                    example: flowcontrol.apiserver.k8s.io/v1beta2
                  kinds:
                    type: array
                    items:
                      type: string
                    description: impacted list of kinds
                    example: '["FlowSchema", "PriorityLevelConfiguration"]'
                  targetAPI:
                    type: string
                    description: target api
                    example: flowcontrol.apiserver.k8s.io/v1beta3
            k8sVersion:
              type: number
              description: kubernetes version
  targets:
    - target: admission.k8s.gatekeeper.sh
      rego: |
{{ file.Read "src/general/verifydeprecatedapi/src.rego" | strings.Indent 8 | strings.TrimSuffix "\n" }}