Skip to content

Commit cf959d0

Browse files
Merge branch 'master' into kustomize
2 parents 9e21752 + 7b901ca commit cf959d0

File tree

84 files changed

+2591
-1395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2591
-1395
lines changed

VERSIONING.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -58,49 +58,5 @@ take care of building and publishing the artifacts.
5858

5959
[envtest-ref]: https://book.kubebuilder.io/reference/artifacts.html
6060
[tools-branch]: https://github.com/kubernetes-sigs/kubebuilder/tree/tools-releases
61-
62-
## Versioning
63-
64-
| Name | Example | Description |
65-
|--- |--- |--- |
66-
| Kubebuilder version | `v2.2.0`, `v2.3.0`, `v2.3.1` | Tagged versions of the Kubebuilder project, representing changes to the source code in this repository. See the [releases][kb-releases] page for binary releases. |
67-
| Project version | `"1"`, `"2"`, `"3"` | Project version defines the scheme of a `PROJECT` configuration file. This version is defined in a `PROJECT` file's `version`. |
68-
| Plugin version | `v2`, `v3` | Represents the version of an individual plugin, as well as the corresponding scaffolding that it generates. This version is defined in a plugin key, ex. `go.kubebuilder.io/v2`. See the [design doc][cli-plugins-versioning] for more details. |
69-
70-
### Incrementing versions
71-
72-
For more information on how Kubebuilder release versions work, see the [semver](https://semver.org/) documentation.
73-
74-
Project versions should only be increased if a breaking change is introduced in the PROJECT file scheme itself. Changes to the Go scaffolding or the Kubebuilder CLI *do not* affect project version.
75-
76-
Similarly, the introduction of a new plugin version might only lead to a new minor version release of Kubebuilder, since no breaking change is being made to the CLI itself. It'd only be a breaking change to Kubebuilder if we remove support for an older plugin version. See the plugins design doc [versioning section][cli-plugins-versioning]
77-
for more details on plugin versioning.
78-
79-
**NOTE:** the scheme for project version `"2"` was defined before the concept of plugins was introduced, so plugin `go.kubebuilder.io/v2` is implicitly used for those project types. Schema for project versions `"3"` and beyond define a `layout` key that informs the plugin system of which plugin to use.
80-
81-
## Introducing changes to plugins
82-
83-
Changes made to plugins only require a plugin version increase if and only if a change is made to a plugin
84-
that breaks projects scaffolded with the previous plugin version. Once a plugin version `vX` is stabilized (it doesn't
85-
have an "alpha" or "beta" suffix), a new plugin package should be created containing a new plugin with version
86-
`v(X+1)-alpha`. Typically this is done by (semantically) `cp -r pkg/plugins/golang/vX pkg/plugins/golang/v(X+1)` then updating
87-
version numbers and paths. All further breaking changes to the plugin should be made in this package; the `vX`
88-
plugin would then be frozen to breaking changes.
89-
90-
You must also add a migration guide to the [migrations](https://book.kubebuilder.io/migrations.html)
91-
section of the Kubebuilder book in your PR. It should detail the steps required
92-
for users to upgrade their projects from `vX` to `v(X+1)-alpha`.
93-
94-
### Example
95-
96-
Kubebuilder scaffolds projects with plugin `go.kubebuilder.io/v3` by default.
97-
98-
You create a feature that adds a new marker to the file `main.go` scaffolded by `init`
99-
that `create api` will use to update that file. The changes introduced in your feature
100-
would cause errors if used with projects built with plugins `go.kubebuilder.io/v2`
101-
without users manually updating their projects. Thus, your changes introduce a breaking change
102-
to plugin `go.kubebuilder.io`, and can only be merged into plugin version `v3-alpha`.
103-
This plugin's package should exist already.
104-
10561
[kb-releases]:https://github.com/kubernetes-sigs/kubebuilder/releases
10662
[cli-plugins-versioning]:docs/book/src/plugins/extending-cli.md#plugin-versioning

docs/book/src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@
109109
- [Extending the CLI](./plugins/extending-cli.md)
110110
- [Creating your own plugins](./plugins/creating-plugins.md)
111111
- [Available Plugins](./plugins/available-plugins.md)
112+
- [go/v3 plugin](./plugins/go-v3-plugin.md)
113+
- [go/v2 plugin](./plugins/go-v2-plugin.md)
112114
- [Declarative V1](./plugins/declarative-v1.md)
115+
- [Plugins Versioning](./plugins/plugins-versioning.md)
113116

114117
---
115118
[Appendix: The TODO Landing Page](./TODO.md)

docs/book/src/cronjob-tutorial/testdata/project/api/v1/webhook_suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
7171
},
7272
}
7373

74-
cfg, err := testEnv.Start()
74+
var err error
75+
// cfg is defined in this file globally.
76+
cfg, err = testEnv.Start()
7577
Expect(err).NotTo(HaveOccurred())
7678
Expect(cfg).NotTo(BeNil())
7779

docs/book/src/cronjob-tutorial/testdata/project/controllers/suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ var _ = BeforeSuite(func() {
8787
/*
8888
Then, we start the envtest cluster.
8989
*/
90-
cfg, err := testEnv.Start()
90+
var err error
91+
// cfg is defined in this file globally.
92+
cfg, err = testEnv.Start()
9193
Expect(err).NotTo(HaveOccurred())
9294
Expect(cfg).NotTo(BeNil())
9395

docs/book/src/multiversion-tutorial/testdata/project/api/v1/webhook_suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
7171
},
7272
}
7373

74-
cfg, err := testEnv.Start()
74+
var err error
75+
// cfg is defined in this file globally.
76+
cfg, err = testEnv.Start()
7577
Expect(err).NotTo(HaveOccurred())
7678
Expect(cfg).NotTo(BeNil())
7779

docs/book/src/multiversion-tutorial/testdata/project/api/v2/webhook_suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ var _ = BeforeSuite(func() {
7171
},
7272
}
7373

74-
cfg, err := testEnv.Start()
74+
var err error
75+
// cfg is defined in this file globally.
76+
cfg, err = testEnv.Start()
7577
Expect(err).NotTo(HaveOccurred())
7678
Expect(cfg).NotTo(BeNil())
7779

docs/book/src/multiversion-tutorial/testdata/project/controllers/suite_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ var _ = BeforeSuite(func() {
5858
ErrorIfCRDPathMissing: true,
5959
}
6060

61-
cfg, err := testEnv.Start()
61+
var err error
62+
// cfg is defined in this file globally.
63+
cfg, err = testEnv.Start()
6264
Expect(err).NotTo(HaveOccurred())
6365
Expect(cfg).NotTo(BeNil())
6466

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
# Available Plugins
1+
# Available plugins
22

3-
This section details how to use the currently available plugins in Kubebuilder.
3+
This section describes the plugins supported and shipped in with the Kubebuilder project.
44

55
- [Declarative V1](declarative-v1.md)
6-
- [Kustomize V1](kustomize-v1.md)
6+
- [Kustomize V1](kustomize-v1.md)
7+
8+
<aside class="note">
9+
10+
<h1>But you can create your own plugins, see:</h1>
11+
12+
- [Creating your own plugins][create-plugins].
13+
- [Plugins Phase 2][plugins-phase-2] - will allow users to use these external options as helpers to perform the scaffolds with the tool.
14+
15+
</aside>
16+
17+
[create-plugins]: creating-plugins.md
18+
[plugins-phase-2]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/extensible-cli-and-scaffolding-plugins-phase-2.md

docs/book/src/plugins/declarative-v1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ The following scaffolds will be created or updated by this plugin:
4848
* `channels/stable`
4949
* `Dockerfile`
5050

51-
## Further ressources
51+
## Further resources
5252

5353
* Read more about the [declarative pattern][kubebuilder-declarative-pattern]
5454
* Watch the KubeCon 2018 Video [Managing Addons with Operators][kubecon-video]

docs/book/src/plugins/go-v2-plugin.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# go/v2 plugin
2+
3+
The `go/v2` plugin has the purpose to scaffold Golang projects to help users to build projects with [controllers][controller-runtime] and keep the backwards compatibility with the default scaffold made using Kubebuilder CLI `2.x.z` releases.
4+
5+
<node>
6+
7+
You can check samples using this plugin by looking at the `project-v2-<options>` directories under the [testdata][testdata] projects on the root directory of the Kubebuilder project.
8+
9+
</node>
10+
11+
## When should I use this plugin
12+
13+
Only if you are looking to scaffold a project with the legacy layout. Otherwise, it is recommended you to use the default Golang version plugin.
14+
15+
<aside class="note warning">
16+
17+
<h1> Note </h1>
18+
19+
Be aware that this plugin version does not provide a scaffold compatible with the latest versions of the dependencies used in order to keep its backwards compatibility.
20+
21+
</aside>
22+
23+
## How to use it ?
24+
25+
To initialize a Golang project using the legacy layout and with this plugin run, e.g.:
26+
27+
```sh
28+
kubebuilder init --domain tutorial.kubebuilder.io --repo tutorial.kubebuilder.io/project --plugins=go/v2
29+
```
30+
<aside class="note">
31+
32+
<h1> Note </h1>
33+
34+
By creating a project with this plugin, the PROJECT file scaffold will be using the previous schema (_project version 2_). So that Kubebuilder CLI knows what plugin version was used and will call its subcommands such as `create api` and `create webhooks`. Note that further Golang plugins versions use the new Project file schema, which tracks the information about what plugins and versions have been used so far.
35+
36+
</aside>
37+
38+
## Subcommands supported by the plugin
39+
40+
- Init - `kubebuilder init [OPTIONS]`
41+
- Edit - `kubebuilder edit [OPTIONS]`
42+
- Create API - `kubebuilder create api [OPTIONS]`
43+
- Create Webhook - `kubebuilder create webhook [OPTIONS]`
44+
45+
## Further resources
46+
47+
- Check the code implementation of the [go/v2 plugin][v2-plugin].
48+
49+
[controller-runtime]: https://github.com/kubernetes-sigs/controller-runtime
50+
[testdata]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/testdata
51+
[v2-plugin]: https://github.com/kubernetes-sigs/kubebuilder/tree/master/pkg/plugins/golang/v2

0 commit comments

Comments
 (0)