From c244f9aefda0c01a079d507d17899df85f6df4e5 Mon Sep 17 00:00:00 2001 From: Igor Belikov Date: Tue, 11 Feb 2020 23:42:08 +0100 Subject: [PATCH] [stable/opa] Add affinity settings to OPA deployment (#20628) Signed-off-by: Igor Belikov --- stable/opa/Chart.yaml | 2 +- stable/opa/README.md | 1 + stable/opa/templates/deployment.yaml | 2 ++ stable/opa/values.yaml | 24 ++++++++++++++++++++---- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/stable/opa/Chart.yaml b/stable/opa/Chart.yaml index e548745436..a982e79899 100644 --- a/stable/opa/Chart.yaml +++ b/stable/opa/Chart.yaml @@ -6,7 +6,7 @@ keywords: - opa - admission control - policy -version: 1.13.3 +version: 1.13.4 home: https://www.openpolicyagent.org icon: https://raw.githubusercontent.com/open-policy-agent/opa/master/logo/logo.png sources: diff --git a/stable/opa/README.md b/stable/opa/README.md index 95ce331cda..f209b45a12 100644 --- a/stable/opa/README.md +++ b/stable/opa/README.md @@ -75,6 +75,7 @@ Reference](https://www.openpolicyagent.org/docs/configuration.html). | `logLevel` | Log level that OPA outputs at, (`debug`, `info` or `error`) | `info` | | `logFormat` | Log format that OPA produces (`text` or `json`) | `text` | | `replicas` | Number of admission controller replicas to deploy. | `1` | +| `affinity` | Pod/Node affinity and anti-affinity | `{}` | | `tolerations` | List of node taint tolerations. | `[]` | | `nodeSelector` | Node labels for pod assignment. | `{}` | | `resources` | CPU and memory limits for OPA container. | `{}` | diff --git a/stable/opa/templates/deployment.yaml b/stable/opa/templates/deployment.yaml index 8fc7246fdb..4c00ea4e24 100644 --- a/stable/opa/templates/deployment.yaml +++ b/stable/opa/templates/deployment.yaml @@ -188,6 +188,8 @@ spec: - name: bootstrap emptyDir: {} {{- end }} + affinity: +{{ toYaml .Values.affinity | indent 8 }} nodeSelector: {{ toYaml .Values.nodeSelector | indent 8 }} tolerations: diff --git a/stable/opa/values.yaml b/stable/opa/values.yaml index 8c466ab87a..b8d764fb16 100644 --- a/stable/opa/values.yaml +++ b/stable/opa/values.yaml @@ -146,11 +146,27 @@ logFormat: text # or more replicas. replicas: 1 -# To control how the OPA is scheduled on the cluster, set the tolerations and -# nodeSelector values below. For example, to deploy OPA onto the master nodes: +# To control how the OPA is scheduled on the cluster, set the affinity, +# tolerations and nodeSelector values below. For example, to deploy OPA onto +# the master nodes, 1 replica per node: # -# tolerations: [{key: "node-role.kubernetes.io/master", effect: NoSchedule, operator: Exists}] -# nodeSelector: {"kubernetes.io/role": "master"} +# affinity: +# podAntiAffinity: +# requiredDuringSchedulingIgnoredDuringExecution: +# - labelSelector: +# matchExpressions: +# - key: "app" +# operator: In +# values: +# - opa +# topologyKey: "kubernetes.io/hostname" +# tolerations: +# - key: "node-role.kubernetes.io/master" +# effect: NoSchedule +# operator: Exists +# nodeSelector: +# kubernetes.io/role: "master" +affinity: {} tolerations: [] nodeSelector: {}