CAST AI will not downscale a node that includes a pod with the autoscaling.cast.ai/removal-disabled="true" label on it, this protects sensitive workloads from being evicted and can be attributed to any pod to protect against unwanted downscaling. This policy will mutate jobs and cronjobs to add the removal-disabled label to protect against eviction.
apiVersion: policies.kyverno.io/v1kind: MutatingPolicymetadata:name: add-castai-removal-disabledannotations:policies.kyverno.io/title: Add CAST AI Removal Disabledpolicies.kyverno.io/category: CAST AIpolicies.kyverno.io/severity: mediumpolicies.kyverno.io/subject: Job, CronJobkyverno.io/kyverno-version: 1.15.0kyverno.io/kubernetes-version: "1.25"policies.kyverno.io/minversion: 1.17.0policies.kyverno.io/description: "CAST AI will not downscale a node that includes a pod with the autoscaling.cast.ai/removal-disabled=\"true\" label on it, this protects sensitive workloads from being evicted and can be attributed to any pod to protect against unwanted downscaling. This policy will mutate jobs and cronjobs to add the removal-disabled label to protect against eviction. "spec:matchConstraints:resourceRules:- apiGroups:- batchapiVersions:- v1operations:- CREATE- UPDATEresources:- jobs- cronjobsmutations:- patchType: ApplyConfigurationapplyConfiguration:expression: |object.kind == "Job" ?Object{spec: Object.spec{template: Object.spec.template{metadata: Object.spec.template.metadata{labels: {"autoscaling.cast.ai/removal-disabled": "true"}}}}} :object.kind == "CronJob" ?Object{spec: Object.spec{jobTemplate: Object.spec.jobTemplate{spec: Object.spec.jobTemplate.spec{template: Object.spec.jobTemplate.spec.template{metadata: Object.spec.jobTemplate.spec.template.metadata{labels: {"autoscaling.cast.ai/removal-disabled": "true"}}}}}}} : Object{}reinvocationPolicy: Never
The Kubernetes cluster autoscaler does not evict pods that use hostPath or emptyDir volumes. To allow eviction of these pods, the annotation cluster-autoscaler.kubernetes.io/safe-to-evict=true must be added to the pods.
In order for Istio to include namespaces in ambient mode, the label `istio.io/dataplane-mode` must be set to `ambient`. As an alternative to rejecting Namespace definitions which don't already contain this label, it can be added automatically. This policy adds the label `istio.io/dataplane-mode` set to `ambient` for all new Namespaces.
In order for Istio to inject sidecars to workloads deployed into Namespaces, the label `istio-injection` must be set to `enabled`. As an alternative to rejecting Namespace definitions which don't already contain this label, it can be added automatically. This policy adds the label `istio-injection` set to `enabled` for all new Namespaces.