diff --git a/.gitignore b/.gitignore index 3cd3d73e21f..9c5965921cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea/ .vscode/ WORKSPACE +.DS_Store # don't check in the build output of the book docs/book/book/ diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index 67590e84a28..f2b717265b1 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -102,7 +102,7 @@ - [Manager and CRDs Scope](./reference/scopes.md) - [Sub-Module Layouts](./reference/submodule-layouts.md) - - [Using an external Type / API](./reference/using_an_external_type.md) + - [Using an external Resource / API](./reference/using_an_external_resource.md) - [Configuring EnvTest](./reference/envtest.md) diff --git a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go index ab7399bf0c4..d3e90520d65 100644 --- a/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go +++ b/docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go @@ -190,6 +190,8 @@ func main() { } // +kubebuilder:scaffold:builder + // +kubebuilder:scaffold:check-external-api + if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { setupLog.Error(err, "unable to set up health check") os.Exit(1) @@ -206,3 +208,5 @@ func main() { } // +kubebuilder:docs-gen:collapse=old stuff } + +// +kubebuilder:scaffold:add-method-check-external-api diff --git a/docs/book/src/getting-started/testdata/project/cmd/main.go b/docs/book/src/getting-started/testdata/project/cmd/main.go index b40205924db..1e6951c90e2 100644 --- a/docs/book/src/getting-started/testdata/project/cmd/main.go +++ b/docs/book/src/getting-started/testdata/project/cmd/main.go @@ -153,6 +153,8 @@ func main() { } // +kubebuilder:scaffold:builder + // +kubebuilder:scaffold:check-external-api + if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { setupLog.Error(err, "unable to set up health check") os.Exit(1) @@ -168,3 +170,5 @@ func main() { os.Exit(1) } } + +// +kubebuilder:scaffold:add-method-check-external-api diff --git a/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go b/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go index 65f0a6405bc..77567fa46b1 100644 --- a/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go +++ b/docs/book/src/multiversion-tutorial/testdata/project/cmd/main.go @@ -192,6 +192,8 @@ func main() { /* */ + // +kubebuilder:scaffold:check-external-api + if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil { setupLog.Error(err, "unable to set up health check") os.Exit(1) @@ -208,3 +210,5 @@ func main() { } // +kubebuilder:docs-gen:collapse=existing setup } + +// +kubebuilder:scaffold:add-method-check-external-api diff --git a/docs/book/src/reference/markers/scaffold.md b/docs/book/src/reference/markers/scaffold.md index 48d18fa88bf..ec193b5db6c 100644 --- a/docs/book/src/reference/markers/scaffold.md +++ b/docs/book/src/reference/markers/scaffold.md @@ -95,17 +95,19 @@ properly registered with the manager, so that the controller can reconcile the r ## List of `+kubebuilder:scaffold` Markers -| Marker | Usual Location | Function | -|--------------------------------------------|------------------------------|---------------------------------------------------------------------------------| -| `+kubebuilder:scaffold:imports` | `main.go` | Marks where imports for new controllers, webhooks, or APIs should be injected. | -| `+kubebuilder:scaffold:scheme` | `init()` in `main.go` | Used to add API versions to the scheme for runtime. | -| `+kubebuilder:scaffold:builder` | `main.go` | Marks where new controllers should be registered with the manager. | -| `+kubebuilder:scaffold:webhook` | `webhooks suite tests` files | Marks where webhook setup functions are added. | -| `+kubebuilder:scaffold:crdkustomizeresource`| `config/crd` | Marks where CRD custom resource patches are added. | -| `+kubebuilder:scaffold:crdkustomizewebhookpatch` | `config/crd` | Marks where CRD webhook patches are added. | -| `+kubebuilder:scaffold:crdkustomizecainjectionpatch` | `config/crd` | Marks where CA injection patches are added for the webhook. | -| `+kubebuilder:scaffold:manifestskustomizesamples` | `config/samples` | Marks where Kustomize sample manifests are injected. | -| `+kubebuilder:scaffold:e2e-webhooks-checks` | `test/e2e` | Adds e2e checks for webhooks depending on the types of webhooks scaffolded. | +| Marker | Usual Location | Function | +|--------------------------------------------|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `+kubebuilder:scaffold:imports` | `main.go` | Marks where imports for new controllers, webhooks, or APIs should be injected. | +| `+kubebuilder:scaffold:scheme` | `init()` in `main.go` | Used to add API versions to the scheme for runtime. | +| `+kubebuilder:scaffold:builder` | `main.go` | Marks where new controllers should be registered with the manager. | +| `+kubebuilder:scaffold:webhook` | `webhooks suite tests` files | Marks where webhook setup functions are added. | +| `+kubebuilder:scaffold:crdkustomizeresource`| `config/crd` | Marks where CRD custom resource patches are added. | +| `+kubebuilder:scaffold:crdkustomizewebhookpatch` | `config/crd` | Marks where CRD webhook patches are added. | +| `+kubebuilder:scaffold:crdkustomizecainjectionpatch` | `config/crd` | Marks where CA injection patches are added for the webhook. | +| `+kubebuilder:scaffold:manifestskustomizesamples` | `config/samples` | Marks where Kustomize sample manifests are injected. | +| `+kubebuilder:scaffold:e2e-webhooks-checks` | `test/e2e` | Adds e2e checks for webhooks depending on the types of webhooks scaffolded. | +| `+kubebuilder:scaffold:check-external-api` | `main.go` | If a controller is scaffolded for an External Type then, adds a new check for the API to ensure that the API/CRD exist on cluster since it become a prerequisite. | +| `+kubebuilder:scaffold:add-method-check-external-api` | `main.go` | If a controller is scaffolded for an External Type then, adds the method to do verify if the API/version exist on the cluster since it become a prerequisite. |