Skip to content

Commit

Permalink
Merge branch 'kubernetes-sigs:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mzaian authored Nov 11, 2021
2 parents 611f34d + 0d0468e commit c25f339
Show file tree
Hide file tree
Showing 81 changed files with 1,054 additions and 166 deletions.
5 changes: 3 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ variables:
RECOVER_CONTROL_PLANE_TEST: "false"
RECOVER_CONTROL_PLANE_TEST_GROUPS: "etcd[2:],kube_control_plane[1:]"
TERRAFORM_VERSION: 1.0.8
ANSIBLE_MAJOR_VERSION: "2.10"

before_script:
- ./tests/scripts/rebase.sh
- update-alternatives --install /usr/bin/python python /usr/bin/python3 1
- python -m pip uninstall -y ansible
- python -m pip install -r tests/requirements.txt
- python -m pip uninstall -y ansible ansible-base ansible-core
- python -m pip install -r tests/requirements-${ANSIBLE_MAJOR_VERSION}.txt
- mkdir -p /.ssh

.job: &job
Expand Down
39 changes: 26 additions & 13 deletions .gitlab-ci/packet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,41 @@
extends: .packet

packet_ubuntu18-calico-aio:
stage: deploy-part1
stage: deploy-part2
extends: .packet_pr
when: on_success

# Future AIO job
# The ubuntu20-calico-aio jobs are meant as early stages to prevent running the full CI if something is horribly broken
packet_ubuntu20-calico-aio:
stage: deploy-part1
extends: .packet_pr
when: on_success
variables:
RESET_CHECK: "true"

# Exericse ansible variants
packet_ubuntu20-calico-aio-ansible-2_9:
stage: deploy-part1
extends: .packet_pr
when: on_success
variables:
ANSIBLE_MAJOR_VERSION: "2.9"
RESET_CHECK: "true"

packet_ubuntu20-calico-aio-ansible-2_11:
stage: deploy-part1
extends: .packet_pr
when: on_success
variables:
ANSIBLE_MAJOR_VERSION: "2.11"
RESET_CHECK: "true"

# ### PR JOBS PART2

packet_centos7-flannel-containerd-addons-ha:
extends: .packet_pr
stage: deploy-part2
when: on_success
variables:
MITOGEN_ENABLE: "true"
allow_failure: true

packet_centos8-crio:
Expand All @@ -52,8 +69,6 @@ packet_ubuntu18-crio:
extends: .packet_pr
stage: deploy-part2
when: manual
variables:
MITOGEN_ENABLE: "true"

packet_ubuntu16-canal-kubeadm-ha:
stage: deploy-part2
Expand Down Expand Up @@ -89,8 +104,6 @@ packet_debian10-containerd:
stage: deploy-part2
extends: .packet_pr
when: on_success
variables:
MITOGEN_ENABLE: "true"

packet_debian11-calico:
stage: deploy-part2
Expand Down Expand Up @@ -200,6 +213,11 @@ packet_amazon-linux-2-aio:
extends: .packet_pr
when: manual

packet_centos8-calico-nodelocaldns-secondary:
stage: deploy-part2
extends: .packet_pr
when: manual

packet_fedora34-kube-ovn-containerd:
stage: deploy-part2
extends: .packet_periodic
Expand All @@ -214,31 +232,26 @@ packet_centos7-weave-upgrade-ha:
when: on_success
variables:
UPGRADE_TEST: basic
MITOGEN_ENABLE: "false"

# Calico HA Wireguard
packet_ubuntu20-calico-ha-wireguard:
stage: deploy-part2
extends: .packet_pr
when: manual
variables:
MITOGEN_ENABLE: "true"

packet_debian9-calico-upgrade:
stage: deploy-part3
extends: .packet_pr
when: on_success
variables:
UPGRADE_TEST: graceful
MITOGEN_ENABLE: "false"

packet_debian9-calico-upgrade-once:
stage: deploy-part3
extends: .packet_periodic
when: on_success
variables:
UPGRADE_TEST: graceful
MITOGEN_ENABLE: "false"

packet_ubuntu18-calico-ha-recover:
stage: deploy-part3
Expand Down
4 changes: 0 additions & 4 deletions .gitlab-ci/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,6 @@ tf-validate-upcloud:
OS_INTERFACE: public
OS_IDENTITY_API_VERSION: "3"
TF_VAR_router_id: "ab95917c-41fb-4881-b507-3a6dfe9403df"
# Since ELASTX is in Stockholm, Mitogen helps with latency
MITOGEN_ENABLE: "false"
# Mitogen doesn't support interpreter discovery yet
ANSIBLE_PYTHON_INTERPRETER: "/usr/bin/python3"

tf-elastx_cleanup:
stage: unit-tests
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mitogen:
ansible-playbook -c local mitogen.yml -vv
@echo Mitogen support is deprecated.
@echo Please run the following command manually:
@echo ansible-playbook -c local mitogen.yml -vv
clean:
rm -rf dist/
rm *.retry
1 change: 0 additions & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pipelining=True
ssh_args = -o ControlMaster=auto -o ControlPersist=30m -o ConnectionAttempts=100 -o UserKnownHostsFile=/dev/null
#control_path = ~/.ssh/ansible-%%r@%%h:%%p
[defaults]
strategy_plugins = plugins/mitogen/ansible_mitogen/plugins/strategy
# https://github.com/ansible/ansible/issues/56930 (to ignore group names with - and .)
force_valid_group_names = ignore

Expand Down
2 changes: 1 addition & 1 deletion ansible_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
vars:
minimal_ansible_version: 2.9.0
minimal_ansible_version_2_10: 2.10.11
maximal_ansible_version: 2.11.0
maximal_ansible_version: 2.12.0
ansible_connection: local
tags: always
tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
changed_when: false

- name: "Kubernetes Apps | Deploy cluster role binding."
when: "clusterrolebinding_state.stdout | length > 0"
when: "clusterrolebinding_state.stdout | length == 0"
command: "{{ bin_dir }}/kubectl create clusterrolebinding heketi-gluster-admin --clusterrole=edit --serviceaccount=default:heketi-service-account"

- name: Get clusterrolebindings again
Expand All @@ -31,7 +31,7 @@
mode: 0644

- name: "Deploy Heketi config secret"
when: "secret_state.stdout | length > 0"
when: "secret_state.stdout | length == 0"
command: "{{ bin_dir }}/kubectl create secret generic heketi-config-secret --from-file={{ kube_config_dir }}/heketi.json"

- name: Get the heketi-config-secret secret again
Expand All @@ -41,5 +41,5 @@

- name: Make sure the heketi-config-secret secret exists now
assert:
that: "secret_state.stdout != \"\""
that: "secret_state.stdout | length > 0"
msg: "Heketi config secret is not present."
2 changes: 1 addition & 1 deletion docs/ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ For more information about Ansible and bastion hosts, read

## Mitogen

You can use [mitogen](/docs/mitogen.md) to speed up kubespray.
Mitogen support is deprecated, please see [mitogen related docs](/docs/mitogen.md) for useage and reasons for deprecation.

## Beyond ansible 2.9

Expand Down
14 changes: 14 additions & 0 deletions docs/cert_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ Certificates issued by public ACME servers are typically trusted by client’s c
- [DNS01 Challenges](https://cert-manager.io/v1.5-docs/configuration/acme/dns01/)
- [ACME FAQ](https://cert-manager.io/v1.5-docs/faq/acme/)

#### ACME With An Internal Certificate Authority

The ACME Issuer with an internal certificate authority requires cert-manager to trust the certificate authority. This trust must be done at the cert-manager deployment level.
To add a trusted certificate authority to cert-manager, add it's certificate to `group_vars/k8s-cluster/addons.yml`:

```yaml
cert_manager_trusted_internal_ca: |
-----BEGIN CERTIFICATE-----
[REPLACE with your CA certificate]
-----END CERTIFICATE-----
```

Once the CA is trusted, you can define your issuer normally.

### Create New TLS Root CA Certificate and Key

#### Install Cloudflare PKI/TLS `cfssl` Toolkit
Expand Down
16 changes: 16 additions & 0 deletions docs/dns-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,22 @@ nodelocaldns_external_zones:

See [dns_etchosts](#dns_etchosts-coredns) above.

### Nodelocal DNS HA

Under some circumstances the single POD nodelocaldns implementation may not be able to be replaced soon enough and a cluster upgrade or a nodelocaldns upgrade can cause DNS requests to time out for short intervals. If for any reason your applications cannot tollerate this behavior you can enable a redundant nodelocal DNS pod on each node:

```yaml
enable_nodelocaldns_secondary: true
```

**Note:** when the nodelocaldns secondary is enabled, the primary is instructed to no longer tear down the iptables rules it sets up to direct traffic to itself. In case both daemonsets have failing pods on the same node, this can cause a DNS blackout with traffic no longer being forwarded to the coredns central service as a fallback. Please ensure you account for this also if you decide to disable the nodelocaldns cache.

There is a time delta (in seconds) allowed for the secondary nodelocaldns to survive in case both primary and secondary daemonsets are updated at the same time. It is advised to tune this variable after you have performed some tests in your own environment.

```yaml
nodelocaldns_secondary_skew_seconds: 5
```

## Limitations

* Kubespray has yet ways to configure Kubedns addon to forward requests SkyDns can
Expand Down
17 changes: 17 additions & 0 deletions docs/mitogen.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Mitogen

*Warning:* Mitogen support is now deprecated in kubespray due to upstream not releasing an updated version to support ansible 4.x (ansible-base 2.11.x) and above. The CI support has been stripped for mitogen and we are no longer validating any support or regressions for it. The supporting mitogen install playbook and integration documentation will be removed in a later version.

[Mitogen for Ansible](https://mitogen.networkgenomics.com/ansible_detailed.html) allow a 1.25x - 7x speedup and a CPU usage reduction of at least 2x, depending on network conditions, modules executed, and time already spent by targets on useful work. Mitogen cannot improve a module once it is executing, it can only ensure the module executes as quickly as possible.

## Install
Expand All @@ -8,6 +10,21 @@
ansible-playbook mitogen.yml
```

Ensure to enable mitogen use by environment varialbles:

```ShellSession
export ANSIBLE_STRATEGY=mitogen_linear
export ANSIBLE_STRATEGY_PLUGINS=plugins/mitogen/ansible_mitogen/plugins/strategy
```

... or `ansible.cfg` setup:

```ini
[defaults]
strategy_plugins = plugins/mitogen/ansible_mitogen/plugins/strategy
strategy=mitogen_linear
```

## Limitation

If you are experiencing problems, please see the [documentation](https://mitogen.networkgenomics.com/ansible_detailed.html#noteworthy-differences).
3 changes: 2 additions & 1 deletion docs/upgrades.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ You can also individually control versions of components by explicitly defining
versions. Here are all version vars for each component:

* docker_version
* containerd_version
* docker_containerd_version (relevant when `container_manager` == `docker`)
* containerd_version (relevant when `container_manager` == `containerd`)
* kube_version
* etcd_version
* calico_version
Expand Down
5 changes: 3 additions & 2 deletions docs/vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Some variables of note include:
* *docker_version* - Specify version of Docker to used (should be quoted
string). Must match one of the keys defined for *docker_versioned_pkg*
in `roles/container-engine/docker/vars/*.yml`.
* *containerd_version* - Specify version of Containerd to use
* *containerd_version* - Specify version of containerd to use when setting `container_manager` to `containerd`
* *docker_containerd_version* - Specify which version of containerd to use when setting `container_manager` to `docker`
* *etcd_version* - Specify version of ETCD to use
* *ipip* - Enables Calico ipip encapsulation by default
* *kube_network_plugin* - Sets k8s network plugin (default Calico)
Expand Down Expand Up @@ -119,7 +120,7 @@ Stack](https://github.com/kubernetes-sigs/kubespray/blob/master/docs/dns-stack.m
``--insecure-registry=myregistry.mydomain:5000``
* *docker_plugins* - This list can be used to define [Docker plugins](https://docs.docker.com/engine/extend/) to install.
* *containerd_default_runtime* - Sets the default Containerd runtime used by the Kubernetes CRI plugin.
* *containerd_runtimes* - Sets the Containerd runtime attributes used by the Kubernetes CRI plugin.
* *containerd_additional_runtimes* - Sets the additional Containerd runtimes used by the Kubernetes CRI plugin.
[Default config](https://github.com/kubernetes-sigs/kubespray/blob/master/roles/container-engine/containerd/defaults/main.yml) can be overriden in inventory vars.
* *http_proxy/https_proxy/no_proxy/no_proxy_exclude_workers/additional_no_proxy* - Proxy variables for deploying behind a
proxy. Note that no_proxy defaults to all internal cluster IPs and hostnames
Expand Down
17 changes: 17 additions & 0 deletions inventory/sample/group_vars/k8s_cluster/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ ingress_alb_enabled: false
# Cert manager deployment
cert_manager_enabled: false
# cert_manager_namespace: "cert-manager"
# cert_manager_trusted_internal_ca: |
# -----BEGIN CERTIFICATE-----
# [REPLACE with your CA certificate]
# -----END CERTIFICATE-----

# MetalLB deployment
metallb_enabled: false
Expand Down Expand Up @@ -176,6 +180,19 @@ metallb_speaker_enabled: true
# peer_asn: 64513
# my_asn: 4200000000


argocd_enabled: false
# argocd_version: v2.1.6
# argocd_namespace: argocd
# Default password:
# - https://argoproj.github.io/argo-cd/getting_started/#4-login-using-the-cli
# ---
# The initial password is autogenerated to be the pod name of the Argo CD API server. This can be retrieved with the command:
# kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
# ---
# Use the following var to set admin password
# argocd_admin_password: "password"

# The plugin manager for kubectl
krew_enabled: false
krew_root_dir: "/usr/local/krew"
3 changes: 3 additions & 0 deletions inventory/sample/group_vars/k8s_cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ dns_mode: coredns
# manual_dns_server: 10.x.x.x
# Enable nodelocal dns cache
enable_nodelocaldns: true
enable_nodelocaldns_secondary: false
nodelocaldns_ip: 169.254.25.10
nodelocaldns_health_port: 9254
nodelocaldns_second_health_port: 9256
nodelocaldns_bind_metrics_host_ip: false
nodelocaldns_secondary_skew_seconds: 5
# nodelocaldns_external_zones:
# - zones:
# - example.com
Expand Down
10 changes: 10 additions & 0 deletions requirements-2.10.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ansible==3.4.0
ansible-base==2.10.15
cryptography==2.8
jinja2==2.11.3
netaddr==0.7.19
pbr==5.4.4
jmespath==0.9.5
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.4
MarkupSafe==1.1.1
10 changes: 10 additions & 0 deletions requirements-2.11.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ansible==4.8.0
ansible-core==2.11.6
cryptography==2.8
jinja2==2.11.3
netaddr==0.7.19
pbr==5.4.4
jmespath==0.9.5
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.4
MarkupSafe==1.1.1
8 changes: 8 additions & 0 deletions requirements-2.9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ansible==2.9.27
jinja2==2.11.3
netaddr==0.7.19
pbr==5.4.4
jmespath==0.9.5
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.4
MarkupSafe==1.1.1
4 changes: 4 additions & 0 deletions requirements-2.9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
collections:
- name: community.general
version: '<3.0'
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
Loading

0 comments on commit c25f339

Please sign in to comment.