Skip to content

Commit 3b478a7

Browse files
mbuechsegarloff
andauthored
Stabilize scs-0214-v2 (#835)
* Stabilize scs-0214-v1 * Relax wording to reflect weaknesses in the test for scs-0214-v2 * skip unit test because it no longer applies Signed-off-by: Matthias Büchse <[email protected]> Co-authored-by: Kurt Garloff <[email protected]>
1 parent c3dd463 commit 3b478a7

File tree

4 files changed

+15
-44
lines changed

4 files changed

+15
-44
lines changed

Standards/scs-0214-v2-k8s-node-distribution.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: Kubernetes Node Distribution and Availability
33
type: Standard
4-
status: Draft
4+
status: Stable
5+
stabilized_at: 2024-11-21
56
replaces: scs-0214-v1-k8s-node-distribution.md
67
track: KaaS
78
---
@@ -100,23 +101,6 @@ These labels MUST be kept up to date with the current state of the deployment.
100101
The field gets autopopulated most of the time by either the kubelet or external mechanisms
101102
like the cloud controller.
102103

103-
- `topology.scs.community/host-id`
104-
105-
This is an SCS-specific label; it MUST contain the hostID of the physical machine running
106-
the hypervisor (NOT: the hostID of a virtual machine). Here, the hostID is an arbitrary identifier,
107-
which need not contain the actual hostname, but it should nonetheless be unique to the host.
108-
This helps identify the distribution over underlying physical machines,
109-
which would be masked if VM hostIDs were used.
110-
111-
## Conformance Tests
112-
113-
The script `k8s-node-distribution-check.py` checks the nodes available with a user-provided
114-
kubeconfig file. Based on the labels `topology.scs.community/host-id`,
115-
`topology.kubernetes.io/zone`, `topology.kubernetes.io/region` and `node-role.kubernetes.io/control-plane`,
116-
the script then determines whether the nodes are distributed according to this standard.
117-
If this isn't the case, the script produces an error.
118-
It also produces warnings and informational outputs, e.g., if labels don't seem to be set.
119-
120104
## Previous standard versions
121105

122106
This is version 2 of the standard; it extends [version 1](scs-0214-v1-k8s-node-distribution.md) with the

Standards/scs-0214-w1-k8s-node-distribution-implementation-testing.md

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,15 @@ Worker nodes can also be distributed over "failure zones", but this isn't a requ
1616
Distribution must be shown through labelling, so that users can access these information.
1717

1818
Node distribution metadata is provided through the usage of the labels
19-
`topology.kubernetes.io/region`, `topology.kubernetes.io/zone` and
20-
`topology.scs.community/host-id` respectively.
21-
22-
At the moment, not all labels are set automatically by most K8s cluster utilities, which incurs
23-
additional setup and maintenance costs.
19+
`topology.kubernetes.io/region` and `topology.kubernetes.io/zone`.
2420

2521
## Automated tests
2622

27-
### Notes
28-
29-
The test for the [SCS K8s Node Distribution and Availability](https://github.com/SovereignCloudStack/standards/blob/main/Standards/scs-0214-v2-k8s-node-distribution.md)
30-
checks if control-plane nodes are distributed over different failure zones (distributed into
31-
physical machines, zones and regions) by observing their labels defined by the standard.
32-
33-
### Implementation
23+
Currently, automated testing is not readily possible because we cannot access information about
24+
the underlying host of a node (as opposed to its region and zone). Therefore, the test will only output
25+
a tentative result.
3426

35-
The script [`k8s_node_distribution_check.py`](https://github.com/SovereignCloudStack/standards/blob/main/Tests/kaas/k8s-node-distribution/k8s_node_distribution_check.py)
36-
connects to an existing K8s cluster and checks if a distribution can be detected with the labels
37-
set for the nodes of this cluster.
27+
The current implementation can be found in the script [`k8s_node_distribution_check.py`](https://github.com/SovereignCloudStack/standards/blob/main/Tests/kaas/k8s-node-distribution/k8s_node_distribution_check.py).
3828

3929
## Manual tests
4030

Tests/kaas/k8s-node-distribution/check_nodes_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ def test_not_enough_nodes(caplog, load_testdata):
4242

4343

4444
@pytest.mark.parametrize("yaml_key", ["no-distribution-1", "no-distribution-2"])
45-
def test_no_distribution(yaml_key, caplog, load_testdata):
45+
def notest_no_distribution(yaml_key, caplog, load_testdata):
4646
data = load_testdata[yaml_key]
47-
with caplog.at_level("ERROR"):
47+
with caplog.at_level("WARNING"):
4848
assert check_nodes(data.values()) == 2
4949
assert len(caplog.records) == 1
5050
record = caplog.records[0]
5151
assert "distribution of nodes described in the standard couldn't be detected" in record.message
5252
assert record.levelname == "ERROR"
5353

5454

55-
def test_missing_label(caplog, load_testdata):
55+
def notest_missing_label(caplog, load_testdata):
5656
data = load_testdata["missing-labels"]
5757
assert check_nodes(data.values()) == 2
5858
hostid_missing_records = [

Tests/kaas/k8s-node-distribution/k8s_node_distribution_check.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
and does require these labels to be set, but should yield overall pretty
2323
good initial results.
2424
25-
topology.scs.openstack.org/host-id # previously kubernetes.io/hostname
2625
topology.kubernetes.io/zone
2726
topology.kubernetes.io/region
2827
node-role.kubernetes.io/control-plane
@@ -47,7 +46,6 @@
4746
LABELS = (
4847
"topology.kubernetes.io/region",
4948
"topology.kubernetes.io/zone",
50-
"topology.scs.community/host-id",
5149
)
5250

5351
logger = logging.getLogger(__name__)
@@ -164,12 +162,11 @@ def compare_labels(node_list, node_type="control"):
164162
)
165163
return
166164

167-
if node_type == "control":
168-
raise DistributionException("The distribution of nodes described in the standard couldn't be detected.")
169-
elif node_type == "worker":
170-
logger.warning("No node distribution could be detected for the worker nodes. "
171-
"This produces only a warning, since it is just a recommendation.")
172-
return
165+
#
166+
# if node_type == "control":
167+
# raise DistributionException("The distribution of nodes described in the standard couldn't be detected.")
168+
logger.warning("No node distribution could be detected for the worker nodes. "
169+
"This produces only a warning, since it is just a recommendation.")
173170

174171

175172
def check_nodes(nodes):

0 commit comments

Comments
 (0)