Skip to content

Commit

Permalink
fix: typo controller import alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Camila Macedo committed May 8, 2020
1 parent 45ade82 commit ad313a5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 31 deletions.
2 changes: 1 addition & 1 deletion docs/book/src/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ kubebuilder create api --group webapp --version v1 --kind Guestbook
<h1>Press Options</h1>

If you press `y` for Create Resource [y/n] and for Create Controller [y/n] then this will create the files `api/v1/guestbook_types.go` where the API is defined
and the `controller/guestbook_controller.go` where the reconciliation business logic is implemented for this Kind(CRD).
and the `controllers/guestbook_controller.go` where the reconciliation business logic is implemented for this Kind(CRD).

</aside>

Expand Down
4 changes: 2 additions & 2 deletions docs/testing/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This article explores steps to write and run integration tests for controllers created using Kubebuilder. Kubebuilder provides a template for writing integration tests. You can simply run all integration (and unit) tests within the project by running: `make test`

For example, there is a controller watches *Parent* objects. The *Parent* objects create *Child* objects. Note that the *Child* objects must have their `.ownerReferences` field setting to the `Parent` objects. You can find the template under `pkg/controller/parent/parent_controller_test.go`:
For example, there is a controller watches *Parent* objects. The *Parent* objects create *Child* objects. Note that the *Child* objects must have their `.ownerReferences` field setting to the `Parent` objects. You can find the template under `controllers/parent/parent_controller_test.go`:
```
package parent
Expand Down Expand Up @@ -79,4 +79,4 @@ func TestReconcile(t *testing.T) {

The manager is started as part of the test itself (`StartTestManager` function).

Both functions are located in `pkg/controller/parent/parent_controller_suite_test.go` file. The file also contains a `TestMain` function that allows you to specify CRD directory paths for the testing environment.
Both functions are located in `controllers/parent/parent_controller_suite_test.go` file. The file also contains a `TestMain` function that allows you to specify CRD directory paths for the testing environment.
2 changes: 1 addition & 1 deletion docs/using_an_external_type.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dep ensure --add

Edit the `CRDDirectoryPaths` in your test suite by appending the path to their CRDs:

file pkg/controller/my_kind_controller_suite_test.go
file pkg/controllers/my_kind_controller_suite_test.go
```
var cfg *rest.Config
Expand Down
7 changes: 2 additions & 5 deletions pkg/scaffold/internal/templates/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ const (
`
controllerImportCodeFragment = `"%s/controllers"
`
// TODO(v3): `&%scontrollers` should be used instead of `&%scontroller` as there may be multiple
// controller for different Kinds in the same group. However, this is a backwards incompatible
// change, and thus should be done for next project version.
multiGroupControllerImportCodeFragment = `%scontroller "%s/controllers/%s"
multiGroupControllerImportCodeFragment = `%scontrollers "%s/controllers/%s"
`
addschemeCodeFragment = `utilruntime.Must(%s.AddToScheme(scheme))
`
Expand All @@ -127,7 +124,7 @@ const (
// TODO(v3): loggers for the same Kind controllers from different groups use the same logger.
// `.WithName("controllers").WithName(GROUP).WithName(KIND)` should be used instead. However,
// this is a backwards incompatible change, and thus should be done for next project version.
multiGroupReconcilerSetupCodeFragment = `if err = (&%scontroller.%sReconciler{
multiGroupReconcilerSetupCodeFragment = `if err = (&%scontrollers.%sReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("%s"),
Scheme: mgr.GetScheme(),
Expand Down
22 changes: 11 additions & 11 deletions testdata/project-v2-multigroup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import (
shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/apis/ship/v1"
shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/apis/ship/v1beta1"
shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/apis/ship/v2alpha1"
crewcontroller "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/crew"
foopolicycontroller "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/foo.policy"
seacreaturescontroller "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/sea-creatures"
shipcontroller "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/ship"
crewcontrollers "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/crew"
foopolicycontrollers "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/foo.policy"
seacreaturescontrollers "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/sea-creatures"
shipcontrollers "sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup/controllers/ship"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -82,7 +82,7 @@ func main() {
os.Exit(1)
}

if err = (&crewcontroller.CaptainReconciler{
if err = (&crewcontrollers.CaptainReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Captain"),
Scheme: mgr.GetScheme(),
Expand All @@ -94,7 +94,7 @@ func main() {
setupLog.Error(err, "unable to create webhook", "webhook", "Captain")
os.Exit(1)
}
if err = (&shipcontroller.FrigateReconciler{
if err = (&shipcontrollers.FrigateReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Frigate"),
Scheme: mgr.GetScheme(),
Expand All @@ -106,39 +106,39 @@ func main() {
setupLog.Error(err, "unable to create webhook", "webhook", "Frigate")
os.Exit(1)
}
if err = (&shipcontroller.DestroyerReconciler{
if err = (&shipcontrollers.DestroyerReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Destroyer"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Destroyer")
os.Exit(1)
}
if err = (&shipcontroller.CruiserReconciler{
if err = (&shipcontrollers.CruiserReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Cruiser"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Cruiser")
os.Exit(1)
}
if err = (&seacreaturescontroller.KrakenReconciler{
if err = (&seacreaturescontrollers.KrakenReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Kraken"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Kraken")
os.Exit(1)
}
if err = (&seacreaturescontroller.LeviathanReconciler{
if err = (&seacreaturescontrollers.LeviathanReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Leviathan"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Leviathan")
os.Exit(1)
}
if err = (&foopolicycontroller.HealthCheckPolicyReconciler{
if err = (&foopolicycontrollers.HealthCheckPolicyReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("HealthCheckPolicy"),
Scheme: mgr.GetScheme(),
Expand Down
22 changes: 11 additions & 11 deletions testdata/project-v3-multigroup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import (
shipv1 "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/apis/ship/v1"
shipv1beta1 "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/apis/ship/v1beta1"
shipv2alpha1 "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/apis/ship/v2alpha1"
crewcontroller "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/crew"
foopolicycontroller "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/foo.policy"
seacreaturescontroller "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/sea-creatures"
shipcontroller "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/ship"
crewcontrollers "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/crew"
foopolicycontrollers "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/foo.policy"
seacreaturescontrollers "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/sea-creatures"
shipcontrollers "sigs.k8s.io/kubebuilder/testdata/project-v3-multigroup/controllers/ship"
// +kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -82,7 +82,7 @@ func main() {
os.Exit(1)
}

if err = (&crewcontroller.CaptainReconciler{
if err = (&crewcontrollers.CaptainReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Captain"),
Scheme: mgr.GetScheme(),
Expand All @@ -94,7 +94,7 @@ func main() {
setupLog.Error(err, "unable to create webhook", "webhook", "Captain")
os.Exit(1)
}
if err = (&shipcontroller.FrigateReconciler{
if err = (&shipcontrollers.FrigateReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Frigate"),
Scheme: mgr.GetScheme(),
Expand All @@ -106,39 +106,39 @@ func main() {
setupLog.Error(err, "unable to create webhook", "webhook", "Frigate")
os.Exit(1)
}
if err = (&shipcontroller.DestroyerReconciler{
if err = (&shipcontrollers.DestroyerReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Destroyer"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Destroyer")
os.Exit(1)
}
if err = (&shipcontroller.CruiserReconciler{
if err = (&shipcontrollers.CruiserReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Cruiser"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Cruiser")
os.Exit(1)
}
if err = (&seacreaturescontroller.KrakenReconciler{
if err = (&seacreaturescontrollers.KrakenReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Kraken"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Kraken")
os.Exit(1)
}
if err = (&seacreaturescontroller.LeviathanReconciler{
if err = (&seacreaturescontrollers.LeviathanReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("Leviathan"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Leviathan")
os.Exit(1)
}
if err = (&foopolicycontroller.HealthCheckPolicyReconciler{
if err = (&foopolicycontrollers.HealthCheckPolicyReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("HealthCheckPolicy"),
Scheme: mgr.GetScheme(),
Expand Down

0 comments on commit ad313a5

Please sign in to comment.