-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from richardcase/136_registration_method
feat: support different registration methods
- Loading branch information
Showing
12 changed files
with
663 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright 2023 SUSE. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
// RegistrationMethod defines the methods to use for registering a new node in a cluster. | ||
type RegistrationMethod string | ||
|
||
var ( | ||
// RegistrationMethodFavourInternalIPs is a registration method where the IP address of the control plane | ||
// machines are used for registration. For each machine it will check if there is an internal IP address | ||
// and will use that. If there is no internal IP address it will use the external IP address if there is one. | ||
RegistrationMethodFavourInternalIPs = RegistrationMethod("internal-first") | ||
// RegistrationMethodInternalIPs is a registration method where the internal IP address of the control plane | ||
// machines are used for registration. | ||
RegistrationMethodInternalIPs = RegistrationMethod("internal-only-ips") | ||
// RegistrationMethodExternalIPs is a registration method where the external IP address of the control plane | ||
// machines are used for registration. | ||
RegistrationMethodExternalIPs = RegistrationMethod("external-only-ips") | ||
// RegistrationMethodAddress is a registration method where an explicit address supplied at cluster creation | ||
// time is used for registration. This is for use in LB or VIP scenarios. | ||
RegistrationMethodAddress = RegistrationMethod("address") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Node Registration Methods | ||
|
||
The provider supports multiple methods for registering a new node into the cluster. | ||
|
||
## Usage | ||
|
||
The method to use is specified on the **RKEControlPlane** within the **spec**. If no method is supplied then the default method of **internal-first** will be used. | ||
|
||
> You cannot change the registration method after creation. | ||
An example of using a different method: | ||
|
||
```yaml | ||
apiVersion: controlplane.cluster.x-k8s.io/v1alpha1 | ||
kind: RKE2ControlPlane | ||
metadata: | ||
name: test1-control-plane | ||
namespace: default | ||
spec: | ||
agentConfig: | ||
version: v1.26.4+rke2r1 | ||
infrastructureRef: | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 | ||
kind: DockerMachineTemplate | ||
name: controlplane | ||
nodeDrainTimeout: 2m | ||
replicas: 3 | ||
serverConfig: | ||
cni: calico | ||
registrationMethod: "address" | ||
registrationAddress: "172.19.0.3" | ||
``` | ||
|
||
## Registration Methods | ||
|
||
### internal-first | ||
|
||
For each CAPI `Machine` that is used for the control plane, we take the **internal** ip address from `Machine.status.addresses` if it exists. If there is no **internal** ip for a machine then we will use an **external** address instead. For the ip address found for a machine then we add it to `RKEControlPlane.status.availableServerIPs`. | ||
|
||
The first IP address listed in `RKEControlPlane.status.availableServerIPs` is then used for the join. | ||
|
||
### internal-only-ips | ||
|
||
For each CAPI `Machine` that is used for the control plane, we take the **internal** ip address from `Machine.status.addresses` if it exists and then we add it to `RKEControlPlane.status.availableServerIPs`. | ||
|
||
The first IP address listed in `RKEControlPlane.status.availableServerIPs` is then used for the join. | ||
|
||
### external-only-ips | ||
|
||
For each CAPI `Machine` that is used for the control plane, we take the **external** ip address from `Machine.status.addresses` if it exists and then we add it to `RKEControlPlane.status.availableServerIPs`. | ||
|
||
The first IP address listed in `RKEControlPlane.status.availableServerIPs` is then used for the join. | ||
|
||
### address | ||
|
||
For this method you must supply an address in the control plane spec (i.e. `RKE2ControlPlane.spec.registrationAddress`). This address is then used for the join. | ||
|
||
With this method its expected that you have a load balancer / VIP solution sitting in front of all the control plane machines and all the join requests will be routed via this. |
Oops, something went wrong.