sonic-buildimage/src/sonic-ctrmgrd/tests
lixiaoyuner d72355d297 [ctgmgr]: do not remove label when do systemd service stop when service is in kube mode (#15642)
Why I did it
When sonic is managed by k8s, the sonic container is managed by k8s daemonset, daemonset identifies its members by labels. Currently when restarting a sonic service by systemctl, if the service's container is already managed by k8s, systemd script stops the container by removing the feature label to make it disjoin from k8s daemonset, and then starts it by adding the label to make it join k8s daemonset again.

This behavior would cause problem during k8s container upgrade. Containers in daemonset are upgraded in a rolling fashion, that means the daemonset version is updated first, then rollout the new version to containers with precheck/postcheck one by one. However, if a sonic device joins a daemonset, k8s will directly deploy a pod with the current version of daemonset, it is expected when a device joins k8s cluster at first time.

But for a device which has already joined k8s cluster, the re-joining daemonset will cause the container upgraded to new version without precheck, so if a systemd service is restarted during daemonset upgrade, the container may be upgraded without precheck and break rolling update policy. To fix it, we need to remove the logic about dropping k8s label in systemd service stop script for kube mode.

Work item tracking
Microsoft ADO (number only): 24304563

How I did it
Don't drop label in systemd service stop script when feature's set_owner is kube. Only drop label when feature's set_owner is local.

How to verify it
The label feature_enabled should be always true if the feature's set owner is kube.
2023-07-15 06:34:32 +08:00
..
__init__.py First cut image update for kubernetes support. (#5421) 2020-12-22 08:01:33 -08:00
common_test.py Clean up the old version container images (#14978) (#15232) 2023-05-26 14:27:55 -07:00
container_startup_test.py Move k8s script to docker-config-engine (#14788) (#15740) 2023-07-07 09:22:58 -07:00
container_test.py [ctgmgr]: do not remove label when do systemd service stop when service is in kube mode (#15642) 2023-07-15 06:34:32 +08:00
ctrmgr_iptables_test.py Revert "Revert "[Kubernetes]: The kube server could be used as http-proxy for docker (#7469)" (#8023)" (#8158) 2021-07-15 19:48:55 -07:00
ctrmgr_tools_test.py [sonic-py-common] Add 'general' module with load_module_from_source() function (#7167) 2021-04-08 08:29:28 -07:00
ctrmgrd_test.py [k8s]: Bypass the systemd service restart limit and do immediately restart when change to local mode (#15432) (#15839) 2023-07-14 08:43:23 -07:00
http_proxy.conf Revert "Revert "[Kubernetes]: The kube server could be used as http-proxy for docker (#7469)" (#8023)" (#8158) 2021-07-15 19:48:55 -07:00
kube_commands_test.py [ctrmgr]: Container image clean up bug fix (#15772) (#15840) 2023-07-14 08:46:11 -07:00
mock_docker.py First cut image update for kubernetes support. (#5421) 2020-12-22 08:01:33 -08:00
no_proxy.conf Revert "Revert "[Kubernetes]: The kube server could be used as http-proxy for docker (#7469)" (#8023)" (#8158) 2021-07-15 19:48:55 -07:00