Skip to content

Commit

Permalink
fix issue where we kept writing the kubelet arg even if it already ex…
Browse files Browse the repository at this point in the history
…isted
  • Loading branch information
jessebot committed Jan 12, 2024
1 parent 7a5d73c commit 92a1c5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions smol_k8s_lab/tui/distro_widgets/kubelet_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ def update_base_yaml(self, event: Input.Changed | Input.Submitted) -> None:
# k3s uses a list
if self.distro == "k3s":
args = distro_cfg["k3s_yaml"]['kubelet-arg']
if isinstance(args, list):
args.append(f"{event.input.name}={event.input.value}")
else:

kubelet_arg = f"{event.input.name}={event.input.value}"
if isinstance(args, list) and kubelet_arg not in args:
args.append(kubelet_arg)
elif not isinstance(args, list) and kubelet_arg not in args:
args = [f"{event.input.name}={event.input.value}"]

self.app.write_yaml()
Expand Down

0 comments on commit 92a1c5b

Please sign in to comment.