From c752b27a3512d7dc0da606db61f08f2021233dc4 Mon Sep 17 00:00:00 2001 From: Mateo Florido Date: Fri, 22 Mar 2024 17:57:58 -0500 Subject: [PATCH] Fix nodes count --- prev-lxd.yaml | 30 ++++++++ test-ck-etcd.yaml | 75 ++++++++++++++++++++ tests/integration/data/test-bundle-etcd.yaml | 2 +- tests/integration/test_etcd.py | 3 +- 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 prev-lxd.yaml create mode 100644 test-ck-etcd.yaml diff --git a/prev-lxd.yaml b/prev-lxd.yaml new file mode 100644 index 00000000..fcb130dd --- /dev/null +++ b/prev-lxd.yaml @@ -0,0 +1,30 @@ +# Copyright 2024 Canonical Ltd. +# See LICENSE file for licensing details. +description: "LXD profile for Canonical Kubernetes" +config: + boot.autostart: "true" + linux.kernel_modules: ip_vs,ip_vs_rr,ip_vs_wrr,ip_vs_sh,ip_tables,ip6_tables,netlink_diag,nf_nat,overlay,br_netfilter + raw.lxc: | + lxc.apparmor.profile=unconfined + lxc.mount.auto=proc:rw sys:rw cgroup:rw + lxc.cgroup.devices.allow=a + lxc.cap.drop= + security.nesting: "true" + security.privileged: "true" +devices: + aadisable: + path: /sys/module/nf_conntrack/parameters/hashsize + source: /sys/module/nf_conntrack/parameters/hashsize + type: disk + aadisable2: + path: /dev/kmsg + source: /dev/kmsg + type: unix-char + aadisable3: + path: /sys/fs/bpf + source: /sys/fs/bpf + type: disk + aadisable4: + path: /proc/sys/net/netfilter/nf_conntrack_max + source: /proc/sys/net/netfilter/nf_conntrack_max + type: disk diff --git a/test-ck-etcd.yaml b/test-ck-etcd.yaml new file mode 100644 index 00000000..9c7b5b75 --- /dev/null +++ b/test-ck-etcd.yaml @@ -0,0 +1,75 @@ +default-base: ubuntu@22.04/stable +applications: + easyrsa: + charm: easyrsa + channel: stable + revision: 55 + resources: + easyrsa: 2 + num_units: 1 + to: + - "0" + annotations: + bundleURL: /home/mateo/Workspace/Canonical/k8s-operator/.tox/integration/tmp/pytest/test-etcd-g8f10/bundles/test-bundle-etcd.yaml + constraints: arch=amd64 + etcd: + charm: etcd + channel: stable + revision: 760 + resources: + core: 0 + etcd: 3 + snapshot: 0 + num_units: 1 + to: + - "1" + annotations: + bundleURL: /home/mateo/Workspace/Canonical/k8s-operator/.tox/integration/tmp/pytest/test-etcd-g8f10/bundles/test-bundle-etcd.yaml + constraints: arch=amd64 + storage: + data: loop,1024M + k8s: + charm: local:k8s-0 + channel: stable + num_units: 3 + to: + - "2" + - "4" + - "6" + options: + datastore: etcd + annotations: + bundleURL: /home/mateo/Workspace/Canonical/k8s-operator/.tox/integration/tmp/pytest/test-etcd-g8f10/bundles/test-bundle-etcd.yaml + constraints: arch=amd64 + k8s-worker: + charm: local:k8s-worker-0 + channel: stable + num_units: 2 + to: + - "3" + - "5" + annotations: + bundleURL: /home/mateo/Workspace/Canonical/k8s-operator/.tox/integration/tmp/pytest/test-etcd-g8f10/bundles/test-bundle-etcd.yaml + constraints: arch=amd64 +machines: + "0": + constraints: arch=amd64 + "1": + constraints: arch=amd64 + "2": + constraints: arch=amd64 + "3": + constraints: arch=amd64 + "4": + constraints: arch=amd64 + "5": + constraints: arch=amd64 + "6": + constraints: arch=amd64 +relations: +- - k8s:k8s-cluster + - k8s-worker:cluster +- - etcd:certificates + - easyrsa:client +- - etcd:db + - k8s:etcd diff --git a/tests/integration/data/test-bundle-etcd.yaml b/tests/integration/data/test-bundle-etcd.yaml index 9a99e86f..20e7b18d 100644 --- a/tests/integration/data/test-bundle-etcd.yaml +++ b/tests/integration/data/test-bundle-etcd.yaml @@ -4,7 +4,7 @@ name: integration-test-etcd description: |- Used to deploy or refresh within an integration test model -series: jammy +series: focal applications: easyrsa: charm: easyrsa diff --git a/tests/integration/test_etcd.py b/tests/integration/test_etcd.py index 5782cd52..3f44b7cf 100644 --- a/tests/integration/test_etcd.py +++ b/tests/integration/test_etcd.py @@ -67,5 +67,6 @@ async def ready_nodes(k8s, expected_count): async def test_nodes_ready(kubernetes_cluster: model.Model): """Deploy the charm and wait for active/idle status.""" k8s = kubernetes_cluster.applications["k8s"] - expected_nodes = len(k8s.units) + worker = kubernetes_cluster.applications["k8s-worker"] + expected_nodes = len(k8s.units) + len(worker.units) await ready_nodes(k8s.units[0], expected_nodes)