Skip to content

Commit 4cf1ddc

Browse files
committed
add mboersma and richardcase as MachinePool reviewers
Signed-off-by: Jack Francis <jackfrancis@gmail.com>
1 parent a8e4187 commit 4cf1ddc

15 files changed

+114
-72
lines changed

OWNERS_ALIASES

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,11 @@ aliases:
125125
- mboersma
126126
- shecodesmagic
127127
- tsuzu
128+
129+
# -----------------------------------------------------------
130+
# OWNER_ALIASES for release-team
131+
# -----------------------------------------------------------
132+
133+
cluster-api-machinepool-maintainers:
134+
- mboersma
135+
- richardcase

exp/controllers/alias.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
"sigs.k8s.io/controller-runtime/pkg/controller"
2525

2626
"sigs.k8s.io/cluster-api/controllers/clustercache"
27-
machinepool "sigs.k8s.io/cluster-api/exp/internal/controllers"
27+
"sigs.k8s.io/cluster-api/exp/internal/controllers/machinepool"
2828
)
2929

3030
// MachinePoolReconciler reconciles a MachinePool object.
@@ -38,7 +38,7 @@ type MachinePoolReconciler struct {
3838
}
3939

4040
func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
41-
return (&machinepool.MachinePoolReconciler{
41+
return (&machinepool.Reconciler{
4242
Client: r.Client,
4343
APIReader: r.APIReader,
4444
ClusterCache: r.ClusterCache,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# See the OWNERS docs at https://go.k8s.io/owners
2+
3+
approvers:
4+
- cluster-api-maintainers
5+
6+
reviewers:
7+
- cluster-api-reviewers
8+
- cluster-api-machinepool-maintainers
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
Copyright 2021 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package machinepool implements machinepool controllers.
18+
package machinepool

exp/internal/controllers/machinepool_controller.go renamed to exp/internal/controllers/machinepool/machinepool_controller.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package controllers
17+
package machinepool
1818

1919
import (
2020
"context"
@@ -73,8 +73,8 @@ const (
7373
MachinePoolControllerName = "machinepool-controller"
7474
)
7575

76-
// MachinePoolReconciler reconciles a MachinePool object.
77-
type MachinePoolReconciler struct {
76+
// Reconciler reconciles a MachinePool object.
77+
type Reconciler struct {
7878
Client client.Client
7979
APIReader client.Reader
8080
ClusterCache clustercache.ClusterCache
@@ -105,7 +105,7 @@ type scope struct {
105105
nodeRefMap map[string]*corev1.Node
106106
}
107107

108-
func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
108+
func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
109109
if r.Client == nil || r.APIReader == nil || r.ClusterCache == nil {
110110
return errors.New("Client, APIReader and ClusterCache must not be nil")
111111
}
@@ -151,7 +151,7 @@ func (r *MachinePoolReconciler) SetupWithManager(ctx context.Context, mgr ctrl.M
151151
return nil
152152
}
153153

154-
func (r *MachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {
154+
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ctrl.Result, reterr error) {
155155
log := ctrl.LoggerFrom(ctx)
156156

157157
mp := &expv1.MachinePool{}
@@ -243,7 +243,7 @@ func (r *MachinePoolReconciler) Reconcile(ctx context.Context, req ctrl.Request)
243243
return r.reconcile(ctx, scope)
244244
}
245245

246-
func (r *MachinePoolReconciler) reconcile(ctx context.Context, s *scope) (ctrl.Result, error) {
246+
func (r *Reconciler) reconcile(ctx context.Context, s *scope) (ctrl.Result, error) {
247247
// Ensure the MachinePool is owned by the Cluster it belongs to.
248248
cluster := s.cluster
249249
mp := s.machinePool
@@ -278,7 +278,7 @@ func (r *MachinePoolReconciler) reconcile(ctx context.Context, s *scope) (ctrl.R
278278
}
279279

280280
// reconcileDelete delete machinePool related resources.
281-
func (r *MachinePoolReconciler) reconcileDelete(ctx context.Context, cluster *clusterv1.Cluster, machinePool *expv1.MachinePool) error {
281+
func (r *Reconciler) reconcileDelete(ctx context.Context, cluster *clusterv1.Cluster, machinePool *expv1.MachinePool) error {
282282
if ok, err := r.reconcileDeleteExternal(ctx, machinePool); !ok || err != nil {
283283
// Return early and don't remove the finalizer if we got an error or
284284
// the external reconciliation deletion isn't ready.
@@ -300,7 +300,7 @@ func (r *MachinePoolReconciler) reconcileDelete(ctx context.Context, cluster *cl
300300
}
301301

302302
// reconcileDeleteNodes delete the cluster nodes.
303-
func (r *MachinePoolReconciler) reconcileDeleteNodes(ctx context.Context, cluster *clusterv1.Cluster, machinePool *expv1.MachinePool) error {
303+
func (r *Reconciler) reconcileDeleteNodes(ctx context.Context, cluster *clusterv1.Cluster, machinePool *expv1.MachinePool) error {
304304
if len(machinePool.Status.NodeRefs) == 0 {
305305
return nil
306306
}
@@ -314,7 +314,7 @@ func (r *MachinePoolReconciler) reconcileDeleteNodes(ctx context.Context, cluste
314314
}
315315

316316
// isMachinePoolDeleteTimeoutPassed check the machinePool node delete time out.
317-
func (r *MachinePoolReconciler) isMachinePoolNodeDeleteTimeoutPassed(machinePool *expv1.MachinePool) bool {
317+
func (r *Reconciler) isMachinePoolNodeDeleteTimeoutPassed(machinePool *expv1.MachinePool) bool {
318318
if !machinePool.DeletionTimestamp.IsZero() && machinePool.Spec.Template.Spec.NodeDeletionTimeout != nil {
319319
if machinePool.Spec.Template.Spec.NodeDeletionTimeout.Nanoseconds() != 0 {
320320
deleteTimePlusDuration := machinePool.DeletionTimestamp.Add(machinePool.Spec.Template.Spec.NodeDeletionTimeout.Duration)
@@ -325,7 +325,7 @@ func (r *MachinePoolReconciler) isMachinePoolNodeDeleteTimeoutPassed(machinePool
325325
}
326326

327327
// reconcileDeleteExternal tries to delete external references, returning true if it cannot find any.
328-
func (r *MachinePoolReconciler) reconcileDeleteExternal(ctx context.Context, machinePool *expv1.MachinePool) (bool, error) {
328+
func (r *Reconciler) reconcileDeleteExternal(ctx context.Context, machinePool *expv1.MachinePool) (bool, error) {
329329
objects := []*unstructured.Unstructured{}
330330
references := []*corev1.ObjectReference{
331331
machinePool.Spec.Template.Spec.Bootstrap.ConfigRef,
@@ -361,7 +361,7 @@ func (r *MachinePoolReconciler) reconcileDeleteExternal(ctx context.Context, mac
361361
return len(objects) == 0, nil
362362
}
363363

364-
func (r *MachinePoolReconciler) watchClusterNodes(ctx context.Context, cluster *clusterv1.Cluster) error {
364+
func (r *Reconciler) watchClusterNodes(ctx context.Context, cluster *clusterv1.Cluster) error {
365365
log := ctrl.LoggerFrom(ctx)
366366

367367
if !conditions.IsTrue(cluster, clusterv1.ClusterControlPlaneInitializedCondition) {
@@ -378,7 +378,7 @@ func (r *MachinePoolReconciler) watchClusterNodes(ctx context.Context, cluster *
378378
}))
379379
}
380380

381-
func (r *MachinePoolReconciler) nodeToMachinePool(ctx context.Context, o client.Object) []reconcile.Request {
381+
func (r *Reconciler) nodeToMachinePool(ctx context.Context, o client.Object) []reconcile.Request {
382382
node, ok := o.(*corev1.Node)
383383
if !ok {
384384
panic(fmt.Sprintf("Expected a Node but got a %T", o))

exp/internal/controllers/machinepool_controller_noderef.go renamed to exp/internal/controllers/machinepool/machinepool_controller_noderef.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package controllers
17+
package machinepool
1818

1919
import (
2020
"context"
@@ -48,7 +48,7 @@ type getNodeReferencesResult struct {
4848
ready int
4949
}
5050

51-
func (r *MachinePoolReconciler) reconcileNodeRefs(ctx context.Context, s *scope) (ctrl.Result, error) {
51+
func (r *Reconciler) reconcileNodeRefs(ctx context.Context, s *scope) (ctrl.Result, error) {
5252
log := ctrl.LoggerFrom(ctx)
5353
cluster := s.cluster
5454
mp := s.machinePool
@@ -140,7 +140,7 @@ func (r *MachinePoolReconciler) reconcileNodeRefs(ctx context.Context, s *scope)
140140
// deleteRetiredNodes deletes nodes that don't have a corresponding ProviderID in Spec.ProviderIDList.
141141
// A MachinePool infrastructure provider indicates an instance in the set has been deleted by
142142
// removing its ProviderID from the slice.
143-
func (r *MachinePoolReconciler) deleteRetiredNodes(ctx context.Context, c client.Client, nodeRefs []corev1.ObjectReference, providerIDList []string) error {
143+
func (r *Reconciler) deleteRetiredNodes(ctx context.Context, c client.Client, nodeRefs []corev1.ObjectReference, providerIDList []string) error {
144144
log := ctrl.LoggerFrom(ctx, "providerIDList", len(providerIDList))
145145
nodeRefsMap := make(map[string]*corev1.Node, len(nodeRefs))
146146
for _, nodeRef := range nodeRefs {
@@ -172,7 +172,7 @@ func (r *MachinePoolReconciler) deleteRetiredNodes(ctx context.Context, c client
172172
return nil
173173
}
174174

175-
func (r *MachinePoolReconciler) getNodeReferences(ctx context.Context, providerIDList []string, minReadySeconds int32, nodeRefsMap map[string]*corev1.Node) (getNodeReferencesResult, error) {
175+
func (r *Reconciler) getNodeReferences(ctx context.Context, providerIDList []string, minReadySeconds int32, nodeRefsMap map[string]*corev1.Node) (getNodeReferencesResult, error) {
176176
log := ctrl.LoggerFrom(ctx, "providerIDList", len(providerIDList))
177177

178178
var ready, available int
@@ -206,7 +206,7 @@ func (r *MachinePoolReconciler) getNodeReferences(ctx context.Context, providerI
206206
}
207207

208208
// patchNodes patches the nodes with the cluster name and cluster namespace annotations.
209-
func (r *MachinePoolReconciler) patchNodes(ctx context.Context, c client.Client, references []corev1.ObjectReference, mp *expv1.MachinePool) error {
209+
func (r *Reconciler) patchNodes(ctx context.Context, c client.Client, references []corev1.ObjectReference, mp *expv1.MachinePool) error {
210210
log := ctrl.LoggerFrom(ctx)
211211
for _, nodeRef := range references {
212212
node := &corev1.Node{}

exp/internal/controllers/machinepool_controller_noderef_test.go renamed to exp/internal/controllers/machinepool/machinepool_controller_noderef_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package controllers
17+
package machinepool
1818

1919
import (
2020
"testing"
@@ -31,7 +31,7 @@ import (
3131
)
3232

3333
func TestMachinePoolGetNodeReference(t *testing.T) {
34-
r := &MachinePoolReconciler{
34+
r := &Reconciler{
3535
Client: fake.NewClientBuilder().Build(),
3636
recorder: record.NewFakeRecorder(32),
3737
}
@@ -306,7 +306,7 @@ func TestMachinePoolGetNodeReference(t *testing.T) {
306306
}
307307

308308
func TestMachinePoolPatchNodes(t *testing.T) {
309-
r := &MachinePoolReconciler{
309+
r := &Reconciler{
310310
Client: fake.NewClientBuilder().Build(),
311311
recorder: record.NewFakeRecorder(32),
312312
}

exp/internal/controllers/machinepool_controller_phases.go renamed to exp/internal/controllers/machinepool/machinepool_controller_phases.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package controllers
17+
package machinepool
1818

1919
import (
2020
"context"
@@ -53,7 +53,7 @@ import (
5353
"sigs.k8s.io/cluster-api/util/predicates"
5454
)
5555

56-
func (r *MachinePoolReconciler) reconcilePhase(mp *expv1.MachinePool) {
56+
func (r *Reconciler) reconcilePhase(mp *expv1.MachinePool) {
5757
// Set the phase to "pending" if nil.
5858
if mp.Status.Phase == "" {
5959
mp.Status.SetTypedPhase(expv1.MachinePoolPhasePending)
@@ -108,7 +108,7 @@ func (r *MachinePoolReconciler) reconcilePhase(mp *expv1.MachinePool) {
108108
}
109109

110110
// reconcileExternal handles generic unstructured objects referenced by a MachinePool.
111-
func (r *MachinePoolReconciler) reconcileExternal(ctx context.Context, m *expv1.MachinePool, ref *corev1.ObjectReference) (external.ReconcileOutput, error) {
111+
func (r *Reconciler) reconcileExternal(ctx context.Context, m *expv1.MachinePool, ref *corev1.ObjectReference) (external.ReconcileOutput, error) {
112112
log := ctrl.LoggerFrom(ctx)
113113

114114
if err := utilconversion.UpdateReferenceAPIContract(ctx, r.Client, ref); err != nil {
@@ -185,7 +185,7 @@ func (r *MachinePoolReconciler) reconcileExternal(ctx context.Context, m *expv1.
185185
}
186186

187187
// reconcileBootstrap reconciles the Spec.Bootstrap.ConfigRef object on a MachinePool.
188-
func (r *MachinePoolReconciler) reconcileBootstrap(ctx context.Context, s *scope) (ctrl.Result, error) {
188+
func (r *Reconciler) reconcileBootstrap(ctx context.Context, s *scope) (ctrl.Result, error) {
189189
log := ctrl.LoggerFrom(ctx)
190190
m := s.machinePool
191191
// Call generic external reconciler if we have an external reference.
@@ -264,7 +264,7 @@ func (r *MachinePoolReconciler) reconcileBootstrap(ctx context.Context, s *scope
264264
}
265265

266266
// reconcileInfrastructure reconciles the Spec.InfrastructureRef object on a MachinePool.
267-
func (r *MachinePoolReconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctrl.Result, error) {
267+
func (r *Reconciler) reconcileInfrastructure(ctx context.Context, s *scope) (ctrl.Result, error) {
268268
log := ctrl.LoggerFrom(ctx)
269269
cluster := s.cluster
270270
mp := s.machinePool
@@ -374,7 +374,7 @@ func (r *MachinePoolReconciler) reconcileInfrastructure(ctx context.Context, s *
374374
// infrastructure is created accordingly.
375375
// Note: When supported by the cloud provider implementation of the MachinePool, machines will provide a means to interact
376376
// with the corresponding infrastructure (e.g. delete a specific machine in case MachineHealthCheck detects it is unhealthy).
377-
func (r *MachinePoolReconciler) reconcileMachines(ctx context.Context, s *scope, infraMachinePool *unstructured.Unstructured) error {
377+
func (r *Reconciler) reconcileMachines(ctx context.Context, s *scope, infraMachinePool *unstructured.Unstructured) error {
378378
log := ctrl.LoggerFrom(ctx)
379379
mp := s.machinePool
380380

@@ -431,7 +431,7 @@ func (r *MachinePoolReconciler) reconcileMachines(ctx context.Context, s *scope,
431431
}
432432

433433
// createOrUpdateMachines creates a MachinePool Machine for each infraMachine if it doesn't already exist and sets the owner reference and infraRef.
434-
func (r *MachinePoolReconciler) createOrUpdateMachines(ctx context.Context, s *scope, machines []clusterv1.Machine, infraMachines []unstructured.Unstructured) error {
434+
func (r *Reconciler) createOrUpdateMachines(ctx context.Context, s *scope, machines []clusterv1.Machine, infraMachines []unstructured.Unstructured) error {
435435
log := ctrl.LoggerFrom(ctx)
436436

437437
// Construct a set of names of infraMachines that already have a Machine.
@@ -490,7 +490,7 @@ func (r *MachinePoolReconciler) createOrUpdateMachines(ctx context.Context, s *s
490490

491491
// computeDesiredMachine constructs the desired Machine for an infraMachine.
492492
// If the Machine exists, it ensures the Machine always owned by the MachinePool.
493-
func (r *MachinePoolReconciler) computeDesiredMachine(mp *expv1.MachinePool, infraMachine *unstructured.Unstructured, existingMachine *clusterv1.Machine, existingNode *corev1.Node) *clusterv1.Machine {
493+
func (r *Reconciler) computeDesiredMachine(mp *expv1.MachinePool, infraMachine *unstructured.Unstructured, existingMachine *clusterv1.Machine, existingNode *corev1.Node) *clusterv1.Machine {
494494
infraRef := corev1.ObjectReference{
495495
APIVersion: infraMachine.GetAPIVersion(),
496496
Kind: infraMachine.GetKind(),
@@ -546,7 +546,7 @@ func (r *MachinePoolReconciler) computeDesiredMachine(mp *expv1.MachinePool, inf
546546

547547
// infraMachineToMachinePoolMapper is a mapper function that maps an InfraMachine to the MachinePool that owns it.
548548
// This is used to trigger an update of the MachinePool when a InfraMachine is changed.
549-
func (r *MachinePoolReconciler) infraMachineToMachinePoolMapper(ctx context.Context, o client.Object) []ctrl.Request {
549+
func (r *Reconciler) infraMachineToMachinePoolMapper(ctx context.Context, o client.Object) []ctrl.Request {
550550
log := ctrl.LoggerFrom(ctx)
551551

552552
if labels.IsMachinePoolOwned(o) {
@@ -570,7 +570,7 @@ func (r *MachinePoolReconciler) infraMachineToMachinePoolMapper(ctx context.Cont
570570
return nil
571571
}
572572

573-
func (r *MachinePoolReconciler) waitForMachineCreation(ctx context.Context, machineList []clusterv1.Machine) error {
573+
func (r *Reconciler) waitForMachineCreation(ctx context.Context, machineList []clusterv1.Machine) error {
574574
_ = ctrl.LoggerFrom(ctx)
575575

576576
// waitForCacheUpdateTimeout is the amount of time allowed to wait for desired state.
@@ -602,7 +602,7 @@ func (r *MachinePoolReconciler) waitForMachineCreation(ctx context.Context, mach
602602
return nil
603603
}
604604

605-
func (r *MachinePoolReconciler) getNodeRefMap(ctx context.Context, c client.Client) (map[string]*corev1.Node, error) {
605+
func (r *Reconciler) getNodeRefMap(ctx context.Context, c client.Client) (map[string]*corev1.Node, error) {
606606
log := ctrl.LoggerFrom(ctx)
607607
nodeRefsMap := make(map[string]*corev1.Node)
608608
nodeList := corev1.NodeList{}

0 commit comments

Comments
 (0)