Browse Source

fix node policies and add descheduler/vpa checks

Alexander Belanger 3 years ago
parent
commit
91a9c6085e

+ 15 - 1
internal/opa/config.yaml

@@ -132,4 +132,18 @@ node:
   - path: "./policies/node/porter_run_taints.rego"
     name: "node.porter_run_taints"
   - path: "./policies/node/porter_run_labels.rego"
-    name: "node.porter_run_labels"
+    name: "node.porter_run_labels"
+descheduler:
+  kind: "helm_release"
+  match:
+    name: descheduler
+    namespace: kube-system
+  mustExist: true
+  policies: []
+vpa:
+  kind: "helm_release"
+  match:
+    name: vpa
+    namespace: kube-system
+  mustExist: true
+  policies: []

+ 1 - 1
internal/opa/policies/node/k8s_version.rego

@@ -2,7 +2,7 @@ package node.k8s_version
 
 import future.keywords
 
-POLICY_ID := "k8s_version"
+POLICY_ID := sprintf("k8s_version_%s", [input.metadata.name])
 
 POLICY_VERSION := "v0.0.1"
 

+ 1 - 1
internal/opa/policies/node/porter_run_labels.rego

@@ -2,7 +2,7 @@ package node.porter_run_labels
 
 import future.keywords
 
-POLICY_ID := "porter_run_labels"
+POLICY_ID := sprintf("porter_run_labels_%s", [input.metadata.name])
 
 POLICY_VERSION := "v0.0.1"
 

+ 1 - 1
internal/opa/policies/node/porter_run_taints.rego

@@ -2,7 +2,7 @@ package node.porter_run_taints
 
 import future.keywords
 
-POLICY_ID := "porter_run_taints"
+POLICY_ID := sprintf("porter_run_taints_%s", [input.metadata.name])
 
 POLICY_VERSION := "v0.0.1"