Skip to content

Commit 6eff28d

Browse files
authored
Merge pull request #2025 from kubernetes-sigs/master
🌱 Update release-3 for v3.0.0-beta.0
2 parents 1428bba + 2d9367e commit 6eff28d

File tree

291 files changed

+9389
-4546
lines changed

Some content is hidden

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

291 files changed

+9389
-4546
lines changed

Makefile

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,19 @@ endif
2828

2929
##@ General
3030

31-
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
32-
# The awk commands is responsable to read the entire set of makefiles included in this invocation, looking for lines of the file as xyz: ## something, and then pretty-format the target and help. Then, if there's a line with ##@ something, that gets pretty-printed as a category.
33-
# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
34-
# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php
31+
# The help target prints out all targets with their descriptions organized
32+
# beneath their categories. The categories are represented by '##@' and the
33+
# target descriptions by '##'. The awk commands is responsible for reading the
34+
# entire set of makefiles included in this invocation, looking for lines of the
35+
# file as xyz: ## something, and then pretty-format the target and help. Then,
36+
# if there's a line with ##@ something, that gets pretty-printed as a category.
37+
# More info on the usage of ANSI control characters for terminal formatting:
38+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
39+
# More info on the awk command:
40+
# http://linuxcommand.org/lc3_adv_awk.php
41+
3542
.PHONY: help
36-
help: ## Display this help
43+
help: ## Display this help
3744
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
3845

3946
##@ Build
@@ -61,7 +68,7 @@ generate: generate-testdata ## Update/generate all mock data. You should run thi
6168

6269
.PHONY: generate-testdata
6370
generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/kubebuilder
64-
./generate_testdata.sh
71+
./test/testdata/generate.sh
6572

6673
.PHONY: lint
6774
lint: golangci-lint ## Run golangci-lint linter
@@ -80,26 +87,35 @@ golangci-lint:
8087

8188
##@ Tests
8289

83-
.PHONY: go-test
84-
go-test: ## Run the unit test
85-
go test -race -v ./cmd/... ./pkg/... ./plugins/...
86-
8790
.PHONY: test
88-
test: ## Run the unit tests (used in the CI)
89-
./test.sh
91+
test: test-unit test-integration test-testdata ## Run the unit and integration tests (used in the CI)
92+
93+
.PHONY: test-unit
94+
test-unit: ## Run the unit tests
95+
go test -race -v ./pkg/...
9096

9197
.PHONY: test-coverage
92-
test-coverage: ## Run coveralls
93-
# remove all coverage files if exists
94-
- rm -rf *.out
95-
# run the go tests and gen the file coverage-all used to do the integration with coverrals.io
96-
go test -race -failfast -tags=integration -coverprofile=coverage-all.out ./cmd/... ./pkg/... ./plugins/...
98+
test-coverage: ## Run unit tests creating the output to report coverage
99+
- rm -rf *.out # Remove all coverage files if exists
100+
go test -race -failfast -tags=integration -coverprofile=coverage-all.out -coverpkg="./pkg/cli/...,./pkg/config/...,./pkg/internal/...,./pkg/model/...,./pkg/plugin/...,./pkg/plugins/golang,./pkg/plugins/internal/..." ./pkg/...
97101

98-
.PHONY: test-e2e-local
99-
test-e2e-local: ## It will run the script to install kind and run e2e tests
100-
## To keep the same kind cluster between test runs, use `SKIP_KIND_CLEANUP=1 make test-e2e-local`
101-
./test_e2e_local.sh
102+
.PHONY: test-integration
103+
test-integration: ## Run the integration tests
104+
./test/integration.sh
102105

103106
.PHONY: check-testdata
104107
check-testdata: ## Run the script to ensure that the testdata is updated
105-
./check_testdata.sh
108+
./test/testdata/check.sh
109+
110+
.PHONY: test-testdata
111+
test-testdata: ## Run the tests of the testdata directory
112+
./test/testdata/test.sh
113+
114+
.PHONY: test-e2e-local
115+
test-e2e-local: ## Run the end-to-end tests locally
116+
## To keep the same kind cluster between test runs, use `SKIP_KIND_CLEANUP=1 make test-e2e-local`
117+
./test/e2e/local.sh
118+
119+
.PHONY: test-e2e-ci
120+
test-e2e-ci: ## Run the end-to-end tests (used in the CI)`
121+
./test/e2e/ci.sh

OWNERS_ALIASES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ aliases:
1313
kubebuilder-approvers:
1414
- camilamacedo86
1515
- estroz
16+
- adirio
1617

1718
# folks who can review and LGTM any PRs in the repo (doesn't include
1819
# approvers & admins -- those count too via the OWNERS file)
1920
kubebuilder-reviewers:
2021
- joelanford
21-
- adirio
2222

2323
# folks who may have context on ancient history,
2424
# but are no longer directly involved

VERSIONING.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ take care of building and publishing the artifacts.
6464
| Name | Example | Description |
6565
|--- |--- |--- |
6666
| 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-alpha"` | 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-alpha` | 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. |
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. |
6969

7070
### Incrementing versions
7171

@@ -76,32 +76,31 @@ Project versions should only be increased if a breaking change is introduced in
7676
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]
7777
for more details on plugin versioning.
7878

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-alpha"` and beyond define a `layout` key that informs the plugin system of which plugin to use.
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.
8080

8181
## Introducing changes to plugins
8282

8383
Changes made to plugins only require a plugin version increase if and only if a change is made to a plugin
8484
that breaks projects scaffolded with the previous plugin version. Once a plugin version `vX` is stabilized (it doesn't
8585
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/plugin/vX pkg/plugin/v(X+1)` then updating
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
8787
version numbers and paths. All further breaking changes to the plugin should be made in this package; the `vX`
8888
plugin would then be frozen to breaking changes.
8989

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+
9094
### Example
9195

92-
KubeBuilder scaffolds projects with plugin `go.kubebuilder.io/v2` by default. A `v3-alpha` version
93-
was created after `v2` stabilized.
96+
KubeBuilder scaffolds projects with plugin `go.kubebuilder.io/v3` by default.
9497

9598
You create a feature that adds a new marker to the file `main.go` scaffolded by `init`
9699
that `create api` will use to update that file. The changes introduced in your feature
97100
would cause errors if used with projects built with plugins `go.kubebuilder.io/v2`
98101
without users manually updating their projects. Thus, your changes introduce a breaking change
99102
to plugin `go.kubebuilder.io`, and can only be merged into plugin version `v3-alpha`.
100-
This plugin's package should exist already, so a PR must be made against the
101-
102-
You must also add a migration guide to the [migrations](https://book.kubebuilder.io/migrations.html)
103-
section of the KubeBuilder book in your PR. It should detail the steps required
104-
for users to upgrade their projects from `v2` to `v3-alpha`.
103+
This plugin's package should exist already.
105104

106105
[kb-releases]:https://github.com/kubernetes-sigs/kubebuilder/releases
107106
[cli-plugins-versioning]:docs/book/src/reference/cli-plugins.md

cmd/main.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@ package main
1919
import (
2020
"log"
2121

22-
"sigs.k8s.io/kubebuilder/v2/pkg/cli"
23-
"sigs.k8s.io/kubebuilder/v2/pkg/model/config"
24-
pluginv2 "sigs.k8s.io/kubebuilder/v2/pkg/plugins/golang/v2"
25-
pluginv3 "sigs.k8s.io/kubebuilder/v2/pkg/plugins/golang/v3"
22+
"sigs.k8s.io/kubebuilder/v3/pkg/cli"
23+
cfgv2 "sigs.k8s.io/kubebuilder/v3/pkg/config/v2"
24+
cfgv3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3"
25+
pluginv2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v2"
26+
pluginv3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3"
2627
)
2728

2829
func main() {
2930
c, err := cli.New(
3031
cli.WithCommandName("kubebuilder"),
3132
cli.WithVersion(versionString()),
32-
cli.WithDefaultProjectVersion(config.Version3Alpha),
33+
cli.WithDefaultProjectVersion(cfgv3.Version),
3334
cli.WithPlugins(
3435
&pluginv2.Plugin{},
3536
&pluginv3.Plugin{},
3637
),
37-
cli.WithDefaultPlugins(config.Version2, &pluginv2.Plugin{}),
38-
cli.WithDefaultPlugins(config.Version3Alpha, &pluginv3.Plugin{}),
38+
cli.WithDefaultPlugins(cfgv2.Version, &pluginv2.Plugin{}),
39+
cli.WithDefaultPlugins(cfgv3.Version, &pluginv3.Plugin{}),
3940
cli.WithCompletion,
4041
)
4142
if err != nil {

common.sh

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)