feat: add worker node to the cluster #93
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
two node-related commands are added:
olares-cli node masterinfo
for getting information about a target master node, and checks whether current node can be added to the cluster.olares-cli node add
for adding current node to the Kubernetes cluster as a worker node.both commands share a same set of options that specify how to access the master node by SSH:
some changes at the framework level is made, to make it possible to operate on two nodes simultaneously, in order to add worker node:
previously, in 7725447 and a550861:
a
RemoteTask
is made effectively the same as aLocalTask
in that it does not use a SSH connection:Installer/pkg/core/task/remote_task.go
Lines 164 to 182 in 0ef8cea
and all remote commands (via SSH connection by
runtime.GetRunner().Cmd()
) are changed to run locally (byruntime.GetRunner().Host.Cmd()
)these changes are partially reverted and partially merged into the original code, specifically,
RemoteTask
andLocalTask
are made more interchangeable by:RemoteTask
, if the target host is not the local machine, a SSH connection is established, otherwise anil
connection is passed to theRunner
, indicating it's running on a local machineLocalTask
, a realhost
is fetched from the runtime's host map first, instead of the current dummy localhost, to retain the host's rolesruntime.GetRunner().Cmd()
, the Runner's connection field is checked, if one exists, the SSH connection is used to execute the command, otherwise, the command is passed to Runner's host to execute locally.runtime.GetRunner().Host.Cmd()
is changed back toruntime.GetRunner().Cmd()
runtime.GetRunner().SudoCmd()
, the host's user is checked, asudo
prefix is added to the command only if the user is not rootsome other module level changes are made to adjust the new cases for a worker node, when it needs to install JuiceFS based on a remote Redis server, and when the storage and K8s services need reconfiguration when its IP changes.
a new option
--new-master-host
is added to thechange-ip
command, to handle the case where a master node's IP address has changed, but the worker node has no way to automatically know it.