Skip to content

Commit f2a3897

Browse files
authored
Merge pull request #4171 from camilamacedo86/fix-scaffold-controller-core-types
✨ Add support to scaffold controllers for External Types
2 parents 6afb09d + f070751 commit f2a3897

File tree

31 files changed

+769
-333
lines changed

31 files changed

+769
-333
lines changed

docs/book/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
- [Manager and CRDs Scope](./reference/scopes.md)
103103

104104
- [Sub-Module Layouts](./reference/submodule-layouts.md)
105-
- [Using an external Type / API](./reference/using_an_external_type.md)
105+
- [Using an external Resource / API](./reference/using_an_external_resource.md)
106106

107107
- [Configuring EnvTest](./reference/envtest.md)
108108

docs/book/src/reference/project-config.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -130,28 +130,29 @@ version: "3"
130130

131131
Now let's check its layout fields definition:
132132

133-
| Field | Description |
134-
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
135-
| `layout` | Defines the global plugins, e.g. a project `init` with `--plugins="go/v4,deploy-image/v1-alpha"` means that any sub-command used will always call its implementation for both plugins in a chain. |
136-
| `domain` | Store the domain of the project. This information can be provided by the user when the project is generate with the `init` sub-command and the `domain` flag. |
137-
| `plugins` | Defines the plugins used to do custom scaffolding, e.g. to use the optional `deploy-image/v1-alpha` plugin to do scaffolding for just a specific api via the command `kubebuider create api [options] --plugins=deploy-image/v1-alpha`. |
138-
| `projectName` | The name of the project. This will be used to scaffold the manager data. By default it is the name of the project directory, however, it can be provided by the user in the `init` sub-command via the `--project-name` flag. |
139-
| `repo` | The project repository which is the Golang module, e.g `github.com/example/myproject-operator`. |
140-
| `resources` | An array of all resources which were scaffolded in the project. |
141-
| `resources.api` | The API scaffolded in the project via the sub-command `create api`. |
142-
| `resources.api.crdVersion` | The Kubernetes API version (`apiVersion`) used to do the scaffolding for the CRD resource. |
143-
| `resources.api.namespaced` | The API RBAC permissions which can be namespaced or cluster scoped. |
144-
| `resources.controller` | Indicates whether a controller was scaffolded for the API. |
145-
| `resources.domain` | The domain of the resource which is provided by the `--domain` flag when the sub-command `create api` is used. |
146-
| `resources.group` | The GKV group of the resource which is provided by the `--group` flag when the sub-command `create api` is used. |
147-
| `resources.version` | The GKV version of the resource which is provided by the `--version` flag when the sub-command `create api` is used. |
148-
| `resources.kind` | Store GKV Kind of the resource which is provided by the `--kind` flag when the sub-command `create api` is used. |
149-
| `resources.path` | The import path for the API resource. It will be `<repo>/api/<kind>` unless the API added to the project is an external or core-type. For the core-types scenarios, the paths used are mapped [here][core-types]. |
150-
| `resources.webhooks`| Store the webhooks data when the sub-command `create webhook` is used. |
151-
| `resources.webhooks.webhookVersion` | The Kubernetes API version (`apiVersion`) used to scaffold the webhook resource. |
152-
| `resources.webhooks.conversion` | It is `true` when the webhook was scaffold with the `--conversion` flag which means that is a conversion webhook. |
153-
| `resources.webhooks.defaulting` | It is `true` when the webhook was scaffold with the `--defaulting` flag which means that is a defaulting webhook. |
154-
| `resources.webhooks.validation` | It is `true` when the webhook was scaffold with the `--programmatic-validation` flag which means that is a validation webhook. |
133+
| Field | Description |
134+
|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
135+
| `layout` | Defines the global plugins, e.g. a project `init` with `--plugins="go/v4,deploy-image/v1-alpha"` means that any sub-command used will always call its implementation for both plugins in a chain. |
136+
| `domain` | Store the domain of the project. This information can be provided by the user when the project is generate with the `init` sub-command and the `domain` flag. |
137+
| `plugins` | Defines the plugins used to do custom scaffolding, e.g. to use the optional `deploy-image/v1-alpha` plugin to do scaffolding for just a specific api via the command `kubebuider create api [options] --plugins=deploy-image/v1-alpha`. |
138+
| `projectName` | The name of the project. This will be used to scaffold the manager data. By default it is the name of the project directory, however, it can be provided by the user in the `init` sub-command via the `--project-name` flag. |
139+
| `repo` | The project repository which is the Golang module, e.g `github.com/example/myproject-operator`. |
140+
| `resources` | An array of all resources which were scaffolded in the project. |
141+
| `resources.api` | The API scaffolded in the project via the sub-command `create api`. |
142+
| `resources.api.crdVersion` | The Kubernetes API version (`apiVersion`) used to do the scaffolding for the CRD resource. |
143+
| `resources.api.namespaced` | The API RBAC permissions which can be namespaced or cluster scoped. |
144+
| `resources.controller` | Indicates whether a controller was scaffolded for the API. |
145+
| `resources.domain` | The domain of the resource which was provided by the `--domain` flag when the project was initialized or via the flag `--external-api-domain` when it was used to scaffold controllers for an [External Type][external-type]. |
146+
| `resources.group` | The GKV group of the resource which is provided by the `--group` flag when the sub-command `create api` is used. |
147+
| `resources.version` | The GKV version of the resource which is provided by the `--version` flag when the sub-command `create api` is used. |
148+
| `resources.kind` | Store GKV Kind of the resource which is provided by the `--kind` flag when the sub-command `create api` is used. |
149+
| `resources.path` | The import path for the API resource. It will be `<repo>/api/<kind>` unless the API added to the project is an external or core-type. For the core-types scenarios, the paths used are mapped [here][core-types]. Or either the path informed by the flag `--external-api-path` |
150+
| `resources.external` | It is `true` when the flag `--external-api-path` was used to generated the scaffold for an [External Type][external-type]. |
151+
| `resources.webhooks` | Store the webhooks data when the sub-command `create webhook` is used. |
152+
| `resources.webhooks.webhookVersion` | The Kubernetes API version (`apiVersion`) used to scaffold the webhook resource. |
153+
| `resources.webhooks.conversion` | It is `true` when the webhook was scaffold with the `--conversion` flag which means that is a conversion webhook. |
154+
| `resources.webhooks.defaulting` | It is `true` when the webhook was scaffold with the `--defaulting` flag which means that is a defaulting webhook. |
155+
| `resources.webhooks.validation` | It is `true` when the webhook was scaffold with the `--programmatic-validation` flag which means that is a validation webhook. |
155156

156157
[project]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/testdata/project-v3/PROJECT
157158
[versioning]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/VERSIONING.md#Versioning
@@ -160,4 +161,5 @@ Now let's check its layout fields definition:
160161
[olm]: https://olm.operatorframework.io/
161162
[plugins-doc]: ../plugins/creating-plugins.html#why-use-the-kubebuilder-style
162163
[doc-design-helper]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/helper_to_upgrade_projects_by_rescaffolding.md
163-
[operator-sdk]: https://sdk.operatorframework.io/
164+
[operator-sdk]: https://sdk.operatorframework.io/
165+
[external-type]: ./using_an_external_resource.md

docs/book/src/reference/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
- [Platform Support](platform.md)
3636

3737
- [Sub-Module Layouts](submodule-layouts.md)
38-
- [Using an external Type / API](using_an_external_type.md)
38+
- [Using an external Resource / API](using_an_external_resource.md)
3939

4040
- [Metrics](metrics.md)
4141
- [Reference](metrics-reference.md)

docs/book/src/reference/submodule-layouts.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ This part describes how to modify a scaffolded project for use with multiple `go
55
Sub-Module Layouts (in a way you could call them a special form of [Monorepo's][monorepo]) are a special use case and can help in scenarios that involve reuse of APIs without introducing indirect dependencies that should not be available in the project consuming the API externally.
66

77
<aside class="note">
8-
<h1>Using external Types</h1>
8+
<h1>Using External Resources/APIs</h1>
99

10-
If you are looking to do operations and reconcile via a controller a Type(CRD) which are owned by another project then, please see [Using an external Type](/reference/using_an_external_type.md) for more info.
10+
If you are looking to do operations and reconcile via a controller a Type(CRD) which are owned by another project
11+
or By Kubernetes API then, please see [Using an external Resources/API](/reference/using_an_external_type.md)
12+
for more info.
1113

1214
</aside>
1315

0 commit comments

Comments
 (0)