Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add affinities to calico-typha and calico-kube-controllers #11122

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions roles/kubernetes-apps/policy_controller/calico/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ calico_policy_controller_memory_limit: 256M
calico_policy_controller_cpu_requests: 30m
calico_policy_controller_memory_requests: 64M
calico_policy_controller_deployment_nodeselector: "kubernetes.io/os: linux"
# calico_policy_controller_affinity:
# nodeAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 100
# preference:
# matchExpressions:
# - key: node-role.kubernetes.io/control-plane
# operator: In
# values:
# - ''

# SSL
calico_cert_dir: "/etc/calico/certs"
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ metadata:
labels:
k8s-app: calico-kube-controllers
spec:
# XXX The controllers can only have a single active instance.
# See: https://github.com/projectcalico/calico/blob/master/charts/calico/templates/calico-kube-controllers.yaml#L10
replicas: 1
strategy:
type: Recreate
Expand All @@ -30,6 +32,10 @@ spec:
operator: Exists
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
{% if calico_policy_controller_affinity is defined %}
affinity:
{{ calico_policy_controller_affinity | to_nice_yaml(indent=2) | indent(8) }}
{% endif %}
{% if policy_controller_extra_tolerations is defined %}
{{ policy_controller_extra_tolerations | list | to_nice_yaml(indent=2) | indent(8) }}
{% endif %}
Expand Down
4 changes: 4 additions & 0 deletions roles/network_plugin/calico/templates/calico-typha.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ spec:
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
{% if calico_typha_affinity is defined %}
affinity:
{{ calico_typha_affinity | to_nice_yaml(indent=2) | indent(8) }}
{% endif %}
# Since Calico can't network a pod until Typha is up, we need to run Typha itself
# as a host-networked pod.
serviceAccountName: calico-node
Expand Down
18 changes: 18 additions & 0 deletions roles/network_plugin/calico_defaults/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ typha_max_connections_lower_limit: 300
# Generate certifcates for typha<->calico-node communication
typha_secure: false

# Add typha affinities
# calico_typha_affinity:
# nodeAffinity:
# preferredDuringSchedulingIgnoredDuringExecution:
# - weight: 100
# preference:
# matchExpressions:
# - key: node-role.kubernetes.io/control-plane
# operator: In
# values:
# - ''
# podAntiAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchLabels:
# k8s-app: calico-typha
# topologyKey: kubernetes.io/hostname

calico_feature_control: {}

# Calico default BGP port
Expand Down