replicatedhq / kots

KOTS provides the framework, tools and integrations that enable the delivery and management of 3rd-party Kubernetes applications, a.k.a. Kubernetes Off-The-Shelf (KOTS) Software.
https://kots.io
Apache License 2.0
902 stars 90 forks source link

feat(ec_join): update handler to return tcp connections required #5004

Open JGAntunes opened 1 week ago

JGAntunes commented 1 week ago

What this PR does / why we need it:

On join, return all the TCP endpoints the joining node needs to preflight for to ensure a successful connection to the cluster

Which issue(s) this PR fixes:

https://app.shortcut.com/replicated/story/113015/preflight-remote-access-on-join

Does this PR require a test?

Yes, added tests to the handler and to the newly added method

Also run some manual tests on an EC local dev deployment:

root@node1:/replicatedhq/embedded-cluster# curl -k -v "https://172.17.0.2:30000/api/v1/embedded-cluster/join?token=FGjr0qVT2dRHrMialHJk7zd8" | jq .
(...)
{
  "clusterID": "19750e22-03ff-44ae-8fcb-c41e70ca4db5",
  "k0sJoinCommand": "/usr/local/bin/k0s install controller --enable-worker --no-taints --labels kots.io/embedded-cluster-role=total-1,kots.io/embedded-cluster-role-0=controller-test,controller-label=controller-label-value",
  "k0sToken": "...",
  "embeddedClusterVersion": "1.19.0+k8s-1.30-11-gbb2a7ab9-jgantunes",
  "airgapRegistryAddress": "",
  "tcpConnectionsRequired": [
    "172.17.0.2:6443",
    "172.17.0.2:9443",
    "172.17.0.2:2380",
    "172.17.0.2:10250"
  ],
  "installationSpec": {
    (...)
  }
}

Does this PR require a release note?

Enable embedded cluster node joins to preflight Node to Node communications

Does this PR require documentation?

NONE