Skip to content

Commit

Permalink
Merge pull request #2025 from kubernetes-sigs/master
Browse files Browse the repository at this point in the history
🌱 Update release-3 for v3.0.0-beta.0
  • Loading branch information
k8s-ci-robot authored Feb 18, 2021
2 parents 1428bba + 2d9367e commit 6eff28d
Show file tree
Hide file tree
Showing 291 changed files with 9,389 additions and 4,546 deletions.
60 changes: 38 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,19 @@ endif

##@ General

# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
# 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.
# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading 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.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php

.PHONY: help
help: ## Display this help
help: ## Display this help
@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)

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

.PHONY: generate-testdata
generate-testdata: ## Update/generate the testdata in $GOPATH/src/sigs.k8s.io/kubebuilder
./generate_testdata.sh
./test/testdata/generate.sh

.PHONY: lint
lint: golangci-lint ## Run golangci-lint linter
Expand All @@ -80,26 +87,35 @@ golangci-lint:

##@ Tests

.PHONY: go-test
go-test: ## Run the unit test
go test -race -v ./cmd/... ./pkg/... ./plugins/...

.PHONY: test
test: ## Run the unit tests (used in the CI)
./test.sh
test: test-unit test-integration test-testdata ## Run the unit and integration tests (used in the CI)

.PHONY: test-unit
test-unit: ## Run the unit tests
go test -race -v ./pkg/...

.PHONY: test-coverage
test-coverage: ## Run coveralls
# remove all coverage files if exists
- rm -rf *.out
# run the go tests and gen the file coverage-all used to do the integration with coverrals.io
go test -race -failfast -tags=integration -coverprofile=coverage-all.out ./cmd/... ./pkg/... ./plugins/...
test-coverage: ## Run unit tests creating the output to report coverage
- rm -rf *.out # Remove all coverage files if exists
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/...

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

.PHONY: check-testdata
check-testdata: ## Run the script to ensure that the testdata is updated
./check_testdata.sh
./test/testdata/check.sh

.PHONY: test-testdata
test-testdata: ## Run the tests of the testdata directory
./test/testdata/test.sh

.PHONY: test-e2e-local
test-e2e-local: ## Run the end-to-end tests locally
## To keep the same kind cluster between test runs, use `SKIP_KIND_CLEANUP=1 make test-e2e-local`
./test/e2e/local.sh

.PHONY: test-e2e-ci
test-e2e-ci: ## Run the end-to-end tests (used in the CI)`
./test/e2e/ci.sh
2 changes: 1 addition & 1 deletion OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ aliases:
kubebuilder-approvers:
- camilamacedo86
- estroz
- adirio

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

# folks who may have context on ancient history,
# but are no longer directly involved
Expand Down
21 changes: 10 additions & 11 deletions VERSIONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ take care of building and publishing the artifacts.
| Name | Example | Description |
|--- |--- |--- |
| 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. |
| 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`. |
| 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. |
| 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`. |
| 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. |

### Incrementing versions

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

**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.
**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.

## Introducing changes to plugins

Changes made to plugins only require a plugin version increase if and only if a change is made to a plugin
that breaks projects scaffolded with the previous plugin version. Once a plugin version `vX` is stabilized (it doesn't
have an "alpha" or "beta" suffix), a new plugin package should be created containing a new plugin with version
`v(X+1)-alpha`. Typically this is done by (semantically) `cp -r pkg/plugin/vX pkg/plugin/v(X+1)` then updating
`v(X+1)-alpha`. Typically this is done by (semantically) `cp -r pkg/plugins/golang/vX pkg/plugins/golang/v(X+1)` then updating
version numbers and paths. All further breaking changes to the plugin should be made in this package; the `vX`
plugin would then be frozen to breaking changes.

You must also add a migration guide to the [migrations](https://book.kubebuilder.io/migrations.html)
section of the KubeBuilder book in your PR. It should detail the steps required
for users to upgrade their projects from `vX` to `v(X+1)-alpha`.

### Example

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

You create a feature that adds a new marker to the file `main.go` scaffolded by `init`
that `create api` will use to update that file. The changes introduced in your feature
would cause errors if used with projects built with plugins `go.kubebuilder.io/v2`
without users manually updating their projects. Thus, your changes introduce a breaking change
to plugin `go.kubebuilder.io`, and can only be merged into plugin version `v3-alpha`.
This plugin's package should exist already, so a PR must be made against the

You must also add a migration guide to the [migrations](https://book.kubebuilder.io/migrations.html)
section of the KubeBuilder book in your PR. It should detail the steps required
for users to upgrade their projects from `v2` to `v3-alpha`.
This plugin's package should exist already.

[kb-releases]:https://github.com/kubernetes-sigs/kubebuilder/releases
[cli-plugins-versioning]:docs/book/src/reference/cli-plugins.md
15 changes: 8 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,24 @@ package main
import (
"log"

"sigs.k8s.io/kubebuilder/v2/pkg/cli"
"sigs.k8s.io/kubebuilder/v2/pkg/model/config"
pluginv2 "sigs.k8s.io/kubebuilder/v2/pkg/plugins/golang/v2"
pluginv3 "sigs.k8s.io/kubebuilder/v2/pkg/plugins/golang/v3"
"sigs.k8s.io/kubebuilder/v3/pkg/cli"
cfgv2 "sigs.k8s.io/kubebuilder/v3/pkg/config/v2"
cfgv3 "sigs.k8s.io/kubebuilder/v3/pkg/config/v3"
pluginv2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v2"
pluginv3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3"
)

func main() {
c, err := cli.New(
cli.WithCommandName("kubebuilder"),
cli.WithVersion(versionString()),
cli.WithDefaultProjectVersion(config.Version3Alpha),
cli.WithDefaultProjectVersion(cfgv3.Version),
cli.WithPlugins(
&pluginv2.Plugin{},
&pluginv3.Plugin{},
),
cli.WithDefaultPlugins(config.Version2, &pluginv2.Plugin{}),
cli.WithDefaultPlugins(config.Version3Alpha, &pluginv3.Plugin{}),
cli.WithDefaultPlugins(cfgv2.Version, &pluginv2.Plugin{}),
cli.WithDefaultPlugins(cfgv3.Version, &pluginv3.Plugin{}),
cli.WithCompletion,
)
if err != nil {
Expand Down
204 changes: 0 additions & 204 deletions common.sh

This file was deleted.

Loading

0 comments on commit 6eff28d

Please sign in to comment.