Skip to content

Commit 29de6f9

Browse files
committed
Rename field to InfrastructureMachineSelector
1 parent ea05c64 commit 29de6f9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/proposals/20220209-machinepool-machines.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,25 @@ As another example, currently each MachinePool infrastructure provider must impl
8181
- Implement Cluster Autoscaler MachinePool integration (a separate task, although we have a working POC)
8282
- Move the MachinePools implementation into a `exp/machinepools` package. The current code location makes its separation from `exp/addons` unclear and this would be an improvement.
8383
- Improve bootstrap token handling for MachinePools. It would be preferable to have a single, short-lived token for each Machine instead of the current shared, long-lived token.
84-
- Remove the `ProviderIDList` field from MachinePools. While the initial proposal using an `InfrastructureRefList` made that field arguably unnecessary, it is still used by cluster-autoscaler and perhaps in other integrations.
8584
## Proposal
8685

87-
To create MachinePool Machines, a MachinePool in CAPI needs information about the instances or replicas associated with the provider's implementation of the MachinePool. This information is attached to the provider's MachinePool infrastructure resource as new, optional status fields `InfrastructureSelector`. This field may be populated by the infrastructure provider.
86+
To create MachinePool Machines, a MachinePool in CAPI needs information about the instances or replicas associated with the provider's implementation of the MachinePool. This information is attached to the provider's MachinePool infrastructure resource as new, optional status fields `InfrastructureMachineSelector`. This field may be populated by the infrastructure provider.
8887

8988
```golang
9089
// FooMachinePoolStatus defines the observed state of FooMachinePool.
9190
type FooMachinePoolStatus struct {
92-
// InfrastructureSelector is a label query over FooMachinePoolMachines.
91+
// InfrastructureMachineSelector is a label query over FooMachinePoolMachines.
9392
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
9493
// +optional
95-
InfrastructureSelector metav1.LabelSelector `json:"infrastructureSelector,omitempty"`
94+
InfrastructureMachineSelector metav1.LabelSelector `json:"infrastructureMachineSelector,omitempty"`
9695
}
9796
```
9897

9998
If this field is populated, CAPI's MachinePool controller will query for the provider-specific infrastructure resources. That query uses the Selector field, the API version of the \<Provider\>MachinePool, and the Kind of the \<Provider\>MachinePool with "Machine" appended to it. For example, if the \<Provider\>MachinePool is of Kind "FooMachinePool", the query will be of Kind "FooMachinePoolMachine".
10099

101100
Once found, CAPI will create and connect MachinePool Machines to each resource. A MachinePool Machine is implemented as a Cluster API Machine that is owned by a MachinePool. If the field is empty, no MachinePool Machines will be created, and the overall behavior is the same as before this proposal was implemented.
102101

103-
It is the responsibility of each provider to populate `InfrastructureSelector` and to create provider-specific MachinePool Machine resources behind each Machine. For example, the Docker provider will create a DockerMachinePoolMachine to represent the container instance behind the Machine in the infrastructure provider's MachinePool. It will also ensure that the DockerMachinePoolMachine is labeled such that the `InfrastructureSelector` can be used to find it.
102+
It is the responsibility of each provider to populate `InfrastructureMachineSelector` and to create provider-specific MachinePool Machine resources behind each Machine. For example, the Docker provider will create a DockerMachinePoolMachine to represent the container instance behind the Machine in the infrastructure provider's MachinePool. It will also ensure that the DockerMachinePoolMachine is labeled such that the `InfrastructureMachineSelector` can be used to find it.
104103

105104
![MachinePool Controller Infrastructure Reference Changed Sequence](images/machinepool-machines/infraref-changed-sequence.png)
106105

@@ -142,7 +141,7 @@ A cluster admin updates a MachinePool to a newer Kubernetes version and would li
142141

143142
### Implementation Details/Notes/Constraints
144143

145-
- As an alternative, the `InfrastructureSelector` field could be attached to the CAPI MachinePool resource. Then the CAPI MachinePool controller could check it directly and it would be more clearly documented in code.
144+
- As an alternative, the `InfrastructureMachineSelector` field could be attached to the CAPI MachinePool resource. Then the CAPI MachinePool controller could check it directly and it would be more clearly documented in code.
146145

147146
- Since this is an optional feature, some providers will implement MachinePool Machines and others will not. While having MachinePool Machines represented improves the consistency of the UX when compared to MachineDeployments, they also create a split in the UX between different MachinePool providers: some will show Machines and others won't (the current behavior).
148147

@@ -152,7 +151,7 @@ A cluster admin updates a MachinePool to a newer Kubernetes version and would li
152151

153152
### Risks and Mitigations
154153

155-
- A previous version of this proposal suggested using a pre-populated `infrastructureRefList` instead of the `InfrastructureSelector` and related fields. Effectively, this means the query "what provider resources exist for this MachinePool's instances?" would be pre-populated, rather than run as needed. This approach would not scale well to MachinePools with hundreds or thousands of instances, since that list becomes part of the representation of that MachinePool, possibly causing storage or network transfer issues.
154+
- A previous version of this proposal suggested using a pre-populated `infrastructureRefList` instead of the `InfrastructureMachineSelector` and related fields. Effectively, this means the query "what provider resources exist for this MachinePool's instances?" would be pre-populated, rather than run as needed. This approach would not scale well to MachinePools with hundreds or thousands of instances, since that list becomes part of the representation of that MachinePool, possibly causing storage or network transfer issues.
156155

157156
It was pointed out that the existing `providerIDList` suffers the same scalability issue as an `infrastructureRefList` would. It would be nice to refactor it away, but doing so is not considered a goal of this proposal effort.
158157

0 commit comments

Comments
 (0)