feat/drain_k8s_node #232

Merged
johnride merged 13 commits from feat/drain_k8s_node into master 2026-02-17 15:01:09 +00:00
Owner
No description provided.
johnride added 6 commits 2026-02-16 03:04:34 +00:00
Author
Owner

Grosse PR a review attentivement :

  • Reboot node proprement via API k8s : sauvegarde le boot id, drain, reboot, attend, verifie que boot id a change, attend que la node redevienne Ready
  • Ecrire un fichier sur la node : cree un pod privilegie (avec la gestion de SCC sur OKD), monte le contenu du fichier dans un configmap et ecrit le avec les permissions specifiees
  • Executer une commande sur une node : cree un pod privilegie de la meme maniere, execute la commande et retourne l'output en string
  • Reconfigurer l'interface principale d'une node en bond : utilise les utilitaires ci-haut pour faire tout ca via l'API k8s proprement. Pas besoin de SSH.

On veut s'assurer a la review qu'on ne laisse rien trainer et essayer de penser en dehors de la boite un peu aux cas d'utilisation differents.

Grosse PR a review attentivement : - Reboot node proprement via API k8s : sauvegarde le boot id, drain, reboot, attend, verifie que boot id a change, attend que la node redevienne Ready - Ecrire un fichier sur la node : cree un pod privilegie (avec la gestion de SCC sur OKD), monte le contenu du fichier dans un configmap et ecrit le avec les permissions specifiees - Executer une commande sur une node : cree un pod privilegie de la meme maniere, execute la commande et retourne l'output en string - Reconfigurer l'interface principale d'une node en bond : utilise les utilitaires ci-haut pour faire tout ca via l'API k8s proprement. Pas besoin de SSH. On veut s'assurer a la review qu'on ne laisse rien trainer et essayer de penser en dehors de la boite un peu aux cas d'utilisation differents.
johnride force-pushed feat/drain_k8s_node from 462544c725 to 3257cd9569 2026-02-16 03:17:51 +00:00 Compare
stremblay approved these changes 2026-02-16 14:29:38 +00:00
stremblay left a comment
Owner

lgtm

lgtm
@@ -0,0 +115,4 @@
/// Delete all resources in this bundle from the cluster.
/// Resources are deleted in reverse order to respect dependencies.
pub async fn delete(&self, client: &K8sClient) -> Result<(), Error> {
Owner

Deleting resources in sequential reverse order can deadlock the deletion process. A solution idea is to launch all deletion in parallel

Deleting resources in sequential reverse order can deadlock the deletion process. A solution idea is to launch all deletion in parallel
johnride marked this conversation as resolved
wjro requested changes 2026-02-16 15:43:48 +00:00
@@ -0,0 +40,4 @@
pub fn build_privileged_pod(
config: PrivilegedPodConfig,
k8s_distribution: &KubernetesDistribution,
Owner

This is never used for building the privileged pod, I feel like this should be at least a match over the various distributions that are implemented. Right now it is silently only working for open-shift distros

This is never used for building the privileged pod, I feel like this should be at least a match over the various distributions that are implemented. Right now it is silently only working for open-shift distros
johnride marked this conversation as resolved
@@ -0,0 +147,4 @@
let namespace = config.namespace.clone();
// 1. On OpenShift, create RBAC binding to privileged SCC
if let KubernetesDistribution::OpenshiftFamily = k8s_distribution {
Owner

Maybe the above comment doesn't matter right now since this will only work if the distribution is OpenshiftFamily. It feels to me like this should also be a match over the KubernetesDistributions

Maybe the above comment doesn't matter right now since this will only work if the distribution is OpenshiftFamily. It feels to me like this should also be a match over the KubernetesDistributions
Author
Owner

There is just nothing to do on other distros than openshift family to get a privileged pod. No need for additional permissions mapping/binding like in openshift because of SCC.

There is just nothing to do on other distros than openshift family to get a privileged pod. No need for additional permissions mapping/binding like in openshift because of SCC.
@@ -0,0 +48,4 @@
#[derive(Clone)]
pub struct K8sClient {
client: Client,
k8s_distribution: Arc<OnceCell<KubernetesDistribution>>,
Owner

It feels like a problem to me to have KubernetesDistribution defined in K8sAnywhere when it is used in the crate. It seems like everything related to KubernetesDistribution should be extracted here.

It feels like a problem to me to have KubernetesDistribution defined in K8sAnywhere when it is used in the crate. It seems like everything related to KubernetesDistribution should be extracted here.
johnride added 1 commit 2026-02-17 01:54:51 +00:00
wip
Some checks failed
Run Check Script / check (pull_request) Failing after 54s
111181c300
johnride added 1 commit 2026-02-17 04:04:23 +00:00
fix: reboot node now works with correct command
Some checks failed
Run Check Script / check (pull_request) Failing after 54s
752526f831
johnride added 3 commits 2026-02-17 14:30:08 +00:00
johnride added 1 commit 2026-02-17 15:00:16 +00:00
fix: dnsmasq now replaces mac address
All checks were successful
Run Check Script / check (pull_request) Successful in 1m2s
c1d46612ac
johnride merged commit c677487a5e into master 2026-02-17 15:01:09 +00:00
johnride deleted branch feat/drain_k8s_node 2026-02-17 15:01:10 +00:00
Sign in to join this conversation.
No Reviewers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NationTech/harmony#232
No description provided.