From 047673c6afbd4f2a6a1c1e368f6906d7915a98d9 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sun, 24 Apr 2022 16:59:27 -0500 Subject: [PATCH] feat(test): add example and rule to insert image pull policy --- rules/kubernetes-fix.yml | 23 +++++++++++++++++++++ test/examples/kubernetes-resources-pull.yml | 20 ++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 rules/kubernetes-fix.yml create mode 100644 test/examples/kubernetes-resources-pull.yml diff --git a/rules/kubernetes-fix.yml b/rules/kubernetes-fix.yml new file mode 100644 index 0000000..665f729 --- /dev/null +++ b/rules/kubernetes-fix.yml @@ -0,0 +1,23 @@ +name: kubernetes-fix +rules: + - name: kubernetes-container-pull-policy + desc: all containers should have a pull policy + level: info + tags: + - kubernetes + - image + - optional + + select: '$..containers.*' + check: + type: object + required: [image, imagePullPolicy] + properties: + imagePullPolicy: + type: string + default: IfNotPresent + enum: + - Always + - IfNotPresent + - Never + diff --git a/test/examples/kubernetes-resources-pull.yml b/test/examples/kubernetes-resources-pull.yml new file mode 100644 index 0000000..25914e5 --- /dev/null +++ b/test/examples/kubernetes-resources-pull.yml @@ -0,0 +1,20 @@ +# test rules kubernetes +# test tags kubernetes +# test exit-status 1 + +metadata: + name: example + labels: {} +spec: + template: + spec: + containers: + - name: test + image: foo + resources: + limits: + cpu: 4000m + memory: 5Gi + requests: + cpu: 4000m + memory: 5Gi