Skip to content

Commit 20b31e4

Browse files
authored
Merge pull request #5639 from vibhorrawat/vibhor/cleanup/addons-controllers
🌱 Move experimental addon controllers to internal
2 parents b69d2fb + 5f932b3 commit 20b31e4

File tree

11 files changed

+63
-2
lines changed

11 files changed

+63
-2
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ generate-manifests-core: $(CONTROLLER_GEN) $(KUSTOMIZE)
370370
paths=./$(EXP_DIR)/controllers/... \
371371
paths=./$(EXP_DIR)/addons/api/... \
372372
paths=./$(EXP_DIR)/addons/controllers/... \
373+
paths=./$(EXP_DIR)/addons/internal/... \
373374
crd:crdVersions=v1 \
374375
rbac:roleName=manager-role \
375376
output:crd:dir=./config/crd/bases \

docs/book/src/developer/providers/v1.0-to-v1.1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ are kept in sync with the versions used by `sigs.k8s.io/controller-runtime`.
2929

3030
* Some controllers have been moved to internal to reduce there API surface. We now only
3131
surface what is necessary, e.g. the reconciler and the `SetupWithManager` func:
32-
* [bootstrap/kubeadm](https://github.com/kubernetes-sigs/cluster-api/pull/5493)
32+
* [bootstrap/kubeadm](https://github.com/kubernetes-sigs/cluster-api/pull/5493)
3333
* [test/infrastructure/docker/controllers](https://github.com/kubernetes-sigs/cluster-api/pull/5595)
34+
* [exp/addons](https://github.com/kubernetes-sigs/cluster-api/pull/5639)
3435

3536
### Other
3637

exp/addons/controllers/alias.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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 controllers
18+
19+
import (
20+
"context"
21+
22+
"sigs.k8s.io/cluster-api/controllers/remote"
23+
clusterresourcesets "sigs.k8s.io/cluster-api/exp/addons/internal/controllers"
24+
ctrl "sigs.k8s.io/controller-runtime"
25+
"sigs.k8s.io/controller-runtime/pkg/client"
26+
"sigs.k8s.io/controller-runtime/pkg/controller"
27+
)
28+
29+
// ClusterResourceSetReconciler reconciles a ClusterResourceSet object.
30+
type ClusterResourceSetReconciler struct {
31+
Client client.Client
32+
Tracker *remote.ClusterCacheTracker
33+
34+
// WatchFilterValue is the label value used to filter events prior to reconciliation.
35+
WatchFilterValue string
36+
}
37+
38+
func (r *ClusterResourceSetReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
39+
return (&clusterresourcesets.ClusterResourceSetReconciler{
40+
Client: r.Client,
41+
Tracker: r.Tracker,
42+
WatchFilterValue: r.WatchFilterValue,
43+
}).SetupWithManager(ctx, mgr, options)
44+
}
45+
46+
// ClusterResourceSetBindingReconciler reconciles a ClusterResourceSetBinding object.
47+
type ClusterResourceSetBindingReconciler struct {
48+
Client client.Client
49+
50+
// WatchFilterValue is the label value used to filter events prior to reconciliation.
51+
WatchFilterValue string
52+
}
53+
54+
func (r *ClusterResourceSetBindingReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager, options controller.Options) error {
55+
return (&clusterresourcesets.ClusterResourceSetBindingReconciler{
56+
Client: r.Client,
57+
WatchFilterValue: r.WatchFilterValue,
58+
}).SetupWithManager(ctx, mgr, options)
59+
}

exp/addons/controllers/clusterresourceset_controller.go renamed to exp/addons/internal/controllers/clusterresourceset_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import (
3434
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
3535
"sigs.k8s.io/cluster-api/controllers/remote"
3636
addonsv1 "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
37-
resourcepredicates "sigs.k8s.io/cluster-api/exp/addons/controllers/predicates"
37+
resourcepredicates "sigs.k8s.io/cluster-api/exp/addons/internal/controllers/predicates"
3838
"sigs.k8s.io/cluster-api/util"
3939
"sigs.k8s.io/cluster-api/util/conditions"
4040
"sigs.k8s.io/cluster-api/util/patch"

0 commit comments

Comments
 (0)