Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion playbooks/byo/calico/roles

This file was deleted.

25 changes: 0 additions & 25 deletions playbooks/byo/calico/upgrade_versions.yml

This file was deleted.

2 changes: 1 addition & 1 deletion playbooks/openshift-master/private/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
when: openshift_use_nuage | default(false) | bool
- role: nuage_master
when: openshift_use_nuage | default(false) | bool
- role: calico_master
- role: calico
when: openshift_use_calico | default(false) | bool
tasks:
- import_role:
Expand Down
49 changes: 47 additions & 2 deletions roles/calico/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
# Calico
# Calico (Master)

Please see [calico_master](../calico_master/README.md)
Configure Calico components for the Master host.

## Requirements

* Ansible 2.2

## Installation

To install, set the following inventory configuration parameters:

* `openshift_use_calico=True`
* `openshift_use_openshift_sdn=False`
* `os_sdn_network_plugin_name='cni'`

By default, Calico will share the etcd used by OpenShift.
To configure Calico to use a separate instance of etcd, place etcd SSL client certs on your master,
then set the following variables in your inventory.ini:

* `calico_etcd_ca_cert_file=/path/to/etcd-ca.crt`
* `calico_etcd_cert_file=/path/to/etcd-client.crt`
* `calico_etcd_key_file=/path/to/etcd-client.key`
* `calico_etcd_endpoints=https://etcd:2379`

## Upgrading

OpenShift-Ansible installs Calico as a self-hosted install. Previously, Calico ran as a systemd service. Running Calico
in this manner is now deprecated, and must be upgraded to a hosted cluster. Please run the Legacy Upgrade playbook to
upgrade your existing Calico deployment to a hosted deployment:

ansible-playbook -i inventory.ini playbooks/byo/calico/legacy_upgrade.yml

## Additional Calico/Node and Felix Configuration Options

Additional parameters that can be defined in the inventory are:


| Environment | Description | Schema | Default |
|---------|----------------------|---------|---------|
| CALICO_IPV4POOL_IPIP | IPIP Mode to use for the IPv4 POOL created at start up. | off, always, cross-subnet | always |
| CALICO_LOG_DIR | Directory on the host machine where Calico Logs are written.| String | /var/log/calico |

### Contact Information

Author: Dan Osborne <dan@projectcalico.org>

For support, join the `#openshift` channel on the [calico users slack](calicousers.slack.com).
File renamed without changes.
2 changes: 0 additions & 2 deletions roles/calico/files/calico.conf

This file was deleted.

2 changes: 1 addition & 1 deletion roles/calico/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ galaxy_info:
- cloud
- system
dependencies:
- role: lib_utils
- role: openshift_facts
- role: container_runtime
File renamed without changes.
96 changes: 56 additions & 40 deletions roles/calico/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,63 @@
---
- name: Check for legacy service
stat:
path: /lib/systemd/system/calico.service
get_checksum: false
get_attributes: false
get_mime: false
register: sym
- fail:
msg: You are running a systemd based installation of Calico. Please run the calico upgrade playbook to upgrade to a self-hosted installation.
when: sym.stat.exists

- name: Configure NetworkManager to ignore Calico interfaces

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vrutkovs This would explain why you're having issues connecting to services. Calico requires that NetworkManager be disabled on it's interfaces (cali*/tunl0), which you've removed in your PR. If NetworkManager is not disabled for these interfaces you will see frequent connectivity issues to pods (and therefore services).

@dcbw dcbw Aug 30, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kprabhak that's somewhat surprising; what are the issues here and which versions of NM do you typically see them with? OpenShift installations (including ones with many, many nodes like OpenShift Online) typically run NetworkManager and we haven't had problems in those configurations.

Might we worth opening a discussion with the NetworkManager project ( https://github.com/NetworkManager/NetworkManager ) about it, since I'm sure they want to figure out if/how NM is interacting.

@thom311 @bengal @lkundrak

@kprabhak kprabhak Aug 31, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dcbw This is due to the design elements for scale that are leveraged by Calico that are not exercised in the same way by ovs. Specifically, when all the pod interfaces on a node are reset by NetworkManager every few minutes, Calico has to withdraw the bgp route, and then wait for bgp route propagation & convergence on subsequent restore of the interfaces.

This is a design artifact of L3 routing protocols (avoiding route flapping in large-scale topologies), and something that will not be exposed in ovs.

Also, to clarify, the requirement is that NetworkManager be configured to ignore calico interfaces only, it can continue to operate on other interfaces on the system.
https://docs.projectcalico.org/v3.2/usage/troubleshooting/#configure-networkmanager

@ozdanborne @mgleung @dmmcquay

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add the NetworkManager config back in so that it will properly ignore any changes to the calico interfaces. This means that we will need to add the calico role that runs on each node back in.

copy:
src: files/calico.conf
dest: /etc/NetworkManager/conf.d/
when: using_network_manager | default(true) | bool
register: nm

- name: restart NetworkManager
systemd:
name: NetworkManager
state: restarted
when: nm.changed

# TODO: Move into shared vars file
- name: Load default node image
- include_tasks: certs.yml

- name: Calico Master | oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:calico-node
oc_adm_policy_user:
user: system:serviceaccount:kube-system:calico-node
resource_kind: scc
resource_name: privileged
state: present

- name: Calico Master | oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:calico-kube-controllers
oc_adm_policy_user:
user: system:serviceaccount:kube-system:calico-kube-controllers
resource_kind: scc
resource_name: privileged
state: present

- name: Calico Master | oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:calico-upgrade-job
oc_adm_policy_user:
user: system:serviceaccount:kube-system:calico-upgrade-job
resource_kind: scc
resource_name: privileged
state: present

- name: Set default selector for kube-system
command: >
{{ openshift_client_binary }}
--config={{ openshift.common.config_base }}/master/admin.kubeconfig
annotate ns kube-system openshift.io/node-selector="" --overwrite

- name: Calico Master | Create temp directory
command: mktemp -d /tmp/openshift-ansible-XXXXXXX
register: mktemp
changed_when: False

- name: Calico Master | Parse node version
set_fact:
calico_node_image: "quay.io/calico/node:v2.6.7"
when: calico_node_image is not defined
node_version: "{{ calico_node_image | regex_replace('^.*node:v?(.*)$', '\\1') }}"
cnx: "{{ calico_node_image | regex_replace('[^-]*', '\\0') }}"

- name: Prepull Images
command: "{{ openshift_container_cli }} pull {{ calico_node_image }}"

- name: Apply node label
delegate_to: "{{ groups.oo_first_master.0 }}"
- name: Calico Master | Write Calico v3
template:
dest: "{{ mktemp.stdout }}/calico.yml"
src: calicov3.yml.j2
when: (node_version | regex_search('^[0-9]\.[0-9]\.[0-9]') and node_version >= '3.0.0') or (node_version == 'master') or (cnx == "cnx" and node_version >= '2.0.0')

- name: Calico Master | Launch Calico
command: >
{{ openshift_client_binary }} --config={{ openshift.common.config_base }}/master/admin.kubeconfig label node {{ openshift.node.nodename | lower }} --overwrite projectcalico.org/ds-ready=true

- name: Wait for node running
uri:
url: http://localhost:9099/readiness
status_code: 204
delay: 3
retries: 10
register: result
until: result.status == 204
{{ openshift_client_binary }} apply
-f {{ mktemp.stdout }}/calico.yml
--config={{ openshift.common.config_base }}/master/admin.kubeconfig
register: calico_create_output
failed_when: "('already exists' not in calico_create_output.stderr) and ('created' not in calico_create_output.stdout) and calico_create_output.rc != 0"
changed_when: ('created' in calico_create_output.stdout)

- name: Calico Master | Delete temp directory
file:
name: "{{ mktemp.stdout }}"
state: absent
changed_when: False
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ metadata:
data:
# Configure this with the location of your etcd cluster.
etcd_endpoints: "{{ calico_etcd_endpoints }}"

# Configure the Calico backend to use.
calico_backend: "bird"

Expand Down Expand Up @@ -126,8 +126,6 @@ spec:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
nodeSelector:
projectcalico.org/ds-ready: "true"
hostNetwork: true
tolerations:
# Make sure calico/node gets scheduled on all nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ spec:
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
nodeSelector:
projectcalico.org/ds-ready: "true"
hostNetwork: true
tolerations:
# Make sure calico/node gets scheduled on all nodes.
Expand Down Expand Up @@ -290,7 +288,7 @@ spec:
# chosen from this range. Changing this value after installation will have
# no effect. This should fall within '--cluster-cidr'.
- name: CALICO_IPV4POOL_CIDR
value: "{{ openshift.master.sdn_cluster_network_cidr }}"
value: "{{ openshift_cluster_network_cidr }}"
- name: CALICO_IPV4POOL_IPIP
value: "{{ calico_ipv4pool_ipip }}"
# Disable IPv6 on Kubernetes.
Expand Down
48 changes: 0 additions & 48 deletions roles/calico_master/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions roles/calico_master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
-f {{ mktemp.stdout }}/calico.yml
--config={{ openshift.common.config_base }}/master/admin.kubeconfig
register: calico_create_output
failed_when: "calico_create_output.rc != 0"
changed_when: "('created' in calico_create_output.stdout) or ('configured' in calico_create_output.stdout)"
failed_when: "('already exists' not in calico_create_output.stderr) and ('created' not in calico_create_output.stdout) and calico_create_output.rc != 0"
changed_when: ('created' in calico_create_output.stdout)

- name: Calico Master | Delete temp directory
file:
Expand Down