Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] add ability to add ports to an existing loadbalancer #615

Merged
merged 5 commits into from
Jun 16, 2021

Conversation

iwilltry42
Copy link
Member

@iwilltry42 iwilltry42 commented May 27, 2021

asciicast

What

This PR adds the functionality to edit existing nodes.
Primary use case for the ALPHA is adding new port-mappings to existing nodes, primarily the loadbalancer (as it is stateless, making it easier to handle the recreation).

How

We compile a changeset (basically a new node, with only the newly added fields filled), which we add to a copy of the selected target node (with stripped out status fields).
Then we rename the existing/old node, create the new one, stop the old one, start the new one, delete the old one.
If anything goes wrong in the middle of the process, then we'll try to rollback to having the old node ready as before (same name, same ports, etc.).

Why

This allows us to add new port-mappings (and hopefully more at some point) to an existing cluster, e.g. if one forgot to map the http/https ports for ingress when creating the cluster or if there's a new nodePort present, etc.

Change Overview

CLI

  • new command k3d node edit NODENAME
    • new flag: --port-add [HOSTPORT:]CONTAINERPORT[/PROTOCOL]
      • e.g. k3d node edit k3d-mycluster-serverlb --port-add 8080:80 to add http port mapping for ingress after creating the cluster

pkg

  • new client function NodeEdit

To-Do

  • rollback if creation/start of new container failed

Related Issues

#6 (though far from what was discussed there)

@iwilltry42 iwilltry42 added the enhancement New feature or request label May 27, 2021
@iwilltry42 iwilltry42 added this to the v5.0.0 milestone May 27, 2021
@iwilltry42 iwilltry42 self-assigned this May 27, 2021
@iwilltry42 iwilltry42 force-pushed the feature/reload-ports branch from 1790485 to c97db65 Compare May 27, 2021 10:05
@iwilltry42 iwilltry42 marked this pull request as ready for review May 27, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[FEATURE] Expose ports AFTER k3d creation
1 participant