Skip to content

Commit

Permalink
Merge pull request #3956 from kubernetes-sigs/master
Browse files Browse the repository at this point in the history
📖 Update docs due 4.0.0 release
  • Loading branch information
k8s-ci-robot authored May 24, 2024
2 parents af73c7c + 6c08ed1 commit c9513d7
Show file tree
Hide file tree
Showing 783 changed files with 3,254 additions and 23,685 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "~1.21"
go-version: "~1.22"
- name: Execute go-apidiff
uses: joelanford/go-apidiff@v0.8.2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Remove pre-installed kustomize
run: sudo rm -f /usr/local/bin/kustomize
- name: Run make test for project-v4-with-deploy-image
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Clone the code
uses: actions/checkout@v4
- name: Run linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Clone the code
uses: actions/checkout@v4
- name: Run linter
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test-sample-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'

- name: Create kind cluster
run: kind create cluster
Expand All @@ -24,9 +24,9 @@ jobs:
run: |
KUSTOMIZATION_FILE_PATH="testdata/project-v4/config/default/kustomization.yaml"
sed -i '25s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '27s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '42s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '46,142s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '32s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '47s/^#//' $KUSTOMIZATION_FILE_PATH
sed -i '51,147s/^#//' $KUSTOMIZATION_FILE_PATH
- name: Test
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
- name: Remove pre-installed kustomize
# This step is needed as the following one tries to remove
# kustomize for each test but has no permission to do so
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '~1.21'
go-version: '~1.22'
# This step is needed as the following one tries to remove
# kustomize for each test but has no permission to do so
- name: Remove pre-installed kustomize
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
go-version: "1.22"
- name: Generate the coverage output
run: make test-coverage
- name: Send the coverage output
Expand Down
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ linters:
- dupl
- errcheck
- exportloopref
- ginkgolinter
- goconst
- gocyclo
- gofmt
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Please see https://git.k8s.io/community/CLA.md for more info.

## Prerequisites

- [go](https://golang.org/dl/) version v1.21+.
- [go](https://golang.org/dl/) version v1.22+.
- [docker](https://docs.docker.com/install/) version 17.03+.
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) version v1.11.3+.
- [kustomize](https://github.com/kubernetes-sigs/kustomize/blob/master/site/content/en/docs/Getting%20started/installation.md) v3.1.0+
Expand Down Expand Up @@ -89,7 +89,7 @@ To fully test the proposed plugin:
3. Create `generate_test.go` ([ref](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/v4/generate_test.go)). That should:
- Introduce/Receive a `TextContext` instance
- Trigger the plugin's bound subcommands. See [Init](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L213), [CreateAPI](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/test/e2e/utils/test_context.go#L222)
- Use [PluginUtil](https://pkg.go.dev/sigs.k8s.io/kubebuilder/v3/pkg/plugin/util) to verify the scaffolded outputs. See [InsertCode](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/pkg/plugin/util/util.go#L67), [ReplaceInFile](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/pkg/plugin/util/util.go#L196), [UncommendCode](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/pkg/plugin/util/util.go#L86)
- Use [PluginUtil](https://pkg.go.dev/sigs.k8s.io/kubebuilder/v4/pkg/plugin/util) to verify the scaffolded outputs. See [InsertCode](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/pkg/plugin/util/util.go#L67), [ReplaceInFile](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/pkg/plugin/util/util.go#L196), [UncommendCode](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.6.0/pkg/plugin/util/util.go#L86)
4. Create `plugin_cluster_test.go` ([ref](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/v4/plugin_cluster_test.go)). That should:

- 4.1. Setup testing environment, e.g:
Expand All @@ -103,7 +103,7 @@ To fully test the proposed plugin:

- Execute commands in your `Makefile`. See [Make](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L240)
- Temporary load image of the testing controller. See [LoadImageToKindCluster](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L283)
- Call Kubectl to validate running resources. See [utils.Kubectl](https://pkg.go.dev/sigs.k8s.io/kubebuilder/v3/test/e2e/utils#Kubectl)
- Call Kubectl to validate running resources. See [utils.Kubectl](https://pkg.go.dev/sigs.k8s.io/kubebuilder/v4/test/e2e/utils#Kubectl)

- 4.4. Delete temporary resources after testing exited, e.g:
- Uninstall prerequisites CRDs: See [UninstallPrometheusOperManager](https://github.com/kubernetes-sigs/kubebuilder/blob/v3.7.0/test/e2e/utils/test_context.go#L183)
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ test-e2e-ci: ## Run the end-to-end tests (used in the CI)`

.PHONY: test-book
test-book: ## Run the cronjob tutorial's unit tests to make sure we don't break it
cd ./docs/book/src/cronjob-tutorial/testdata/project && make test
cd ./docs/book/src/component-config-tutorial/testdata/project && make test
cd ./docs/book/src/multiversion-tutorial/testdata/project && make test
# TODO: Uncomment when we bump controller-runtime
# See: https://github.com/kubernetes-sigs/kubebuilder/issues/3917
# cd ./docs/book/src/cronjob-tutorial/testdata/project && make test
# cd ./docs/book/src/multiversion-tutorial/testdata/project && make test
cd ./docs/book/src/getting-started/testdata/project && make test

.PHONY: test-license
test-license: ## Run the license check
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Provide clean library abstractions with clear and well exampled godocs.
- Start minimal and provide progressive discovery of functionality
- Provide sane defaults and allow users to override when they exist
- Provide code generators to maintain common boilerplate that can't be addressed by interfaces
- Driven off of `//+` comments
- Driven off of `// +` comments
- Provide bootstrapping commands to initialize new packages

## Versioning and Releasing
Expand Down
13 changes: 10 additions & 3 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ The releases occur in an account in the Google Cloud (See [here](https://console
A trigger GitHub action [release](.github/workflows/release.yml) is trigged when a new tag is pushed.
This action will caall the job [./build/.goreleaser.yml](./build/.goreleaser.yml).

### To build the Kubebuilder-tools: (Artifacts required to use ENV TEST)
### (Deprecated) - To build the Kubebuilder-tools: (Artifacts required to use ENV TEST)

> We are working on to move all out from GCP Kubebuilder project. As it fits as part of Controller-Runtime domain of responsability it is under a ongoing work to change the build of those binaries to controller-tools and how it is implemented in controller-runtime. For further information see the PR: https://github.com/kubernetes-sigs/controller-runtime/pull/2811
Kubebuilder projects requires artifacts which are used to do test with ENV TEST (when we call `make test` target)
These artifacts can be checked in the service page: https://storage.googleapis.com/kubebuilder-tools
Expand All @@ -82,7 +84,10 @@ as argument the architecture and the SO that should be used, e.g:

For further information see the [README](https://github.com/kubernetes-sigs/kubebuilder/blob/tools-releases/README.md).

### To build the `kube-rbac-proxy` images:
### (Deprecated) - To build the `kube-rbac-proxy` images:

> We no longer build and promote those images. For more info
see: https://github.com/kubernetes-sigs/kubebuilder/discussions/3907

These images are built from the project [brancz/kube-rbac-proxy](https://github.com/brancz/kube-rbac-proxy).
The projects built with Kubebuilder creates a side container with `kube-rbac-proxy` to protect the Manager.
Expand All @@ -100,7 +105,9 @@ To check an example, see the pull request [#2578](https://github.com/kubernetes-
**Note**: we cannot use the images produced by the project `kube-rbac-proxy` because we need to ensure
to Kubebuilder users that these images will be available.

### To build the `gcr.io/kubebuilder/pr-verifier` images:
### (Deprecated) - To build the `gcr.io/kubebuilder/pr-verifier` images:

> We are working on to move all out from GCP Kubebuilder project. For further information see: https://github.com/kubernetes/k8s.io/issues/2647#issuecomment-2111182864
These images are used to verify the PR title and description. They are built from [kubernetes-sigs/kubebuilder-release-tools](https://github.com/kubernetes-sigs/kubebuilder-release-tools/).
In Kubebuilder, we have been using this project via the GitHub action [.github/workflows/verify.yml](.github/workflows/verify.yml)
Expand Down
49 changes: 12 additions & 37 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,17 @@ package main
import (
"github.com/sirupsen/logrus"
"github.com/spf13/afero"
"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"
"sigs.k8s.io/kubebuilder/v3/pkg/machinery"
"sigs.k8s.io/kubebuilder/v3/pkg/plugin"
kustomizecommonv1 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/common/kustomize/v1"
kustomizecommonv2alpha "sigs.k8s.io/kubebuilder/v3/pkg/plugins/common/kustomize/v2"
"sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang"
"sigs.k8s.io/kubebuilder/v4/pkg/cli"
cfgv3 "sigs.k8s.io/kubebuilder/v4/pkg/config/v3"
"sigs.k8s.io/kubebuilder/v4/pkg/machinery"
"sigs.k8s.io/kubebuilder/v4/pkg/plugin"
kustomizecommonv2 "sigs.k8s.io/kubebuilder/v4/pkg/plugins/common/kustomize/v2"
"sigs.k8s.io/kubebuilder/v4/pkg/plugins/golang"

//nolint:staticcheck
declarativev1 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/declarative/v1"
deployimagev1alpha1 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/deploy-image/v1alpha1"
golangv2 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v2"
golangv3 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v3"
golangv4 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v4"
grafanav1alpha1 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/optional/grafana/v1alpha"
deployimagev1alpha1 "sigs.k8s.io/kubebuilder/v4/pkg/plugins/golang/deploy-image/v1alpha1"
golangv4 "sigs.k8s.io/kubebuilder/v4/pkg/plugins/golang/v4"
grafanav1alpha1 "sigs.k8s.io/kubebuilder/v4/pkg/plugins/optional/grafana/v1alpha"
)

func init() {
Expand All @@ -43,24 +38,10 @@ func init() {
}

func main() {

const deprecateMessageGoV3Bundle = "This version is deprecated." +
"The `go/v3` cannot scaffold projects using kustomize versions v4x+" +
" and cannot fully support Kubernetes 1.25+." +
"It is recommended to upgrade your project to the latest versions available (go/v4)." +
"Please, check the migration guide to learn how to upgrade your project"

// Bundle plugin which built the golang projects scaffold by Kubebuilder go/v3
gov3Bundle, _ := plugin.NewBundleWithOptions(plugin.WithName(golang.DefaultNameQualifier),
plugin.WithVersion(plugin.Version{Number: 3}),
plugin.WithDeprecationMessage(deprecateMessageGoV3Bundle),
plugin.WithPlugins(kustomizecommonv1.Plugin{}, golangv3.Plugin{}),
)

// Bundle plugin which built the golang projects scaffold by Kubebuilder go/v4 with kustomize alpha-v2
// Bundle plugin which built the golang projects scaffold by Kubebuilder go/v4 with kustomize v2
gov4Bundle, _ := plugin.NewBundleWithOptions(plugin.WithName(golang.DefaultNameQualifier),
plugin.WithVersion(plugin.Version{Number: 4}),
plugin.WithPlugins(kustomizecommonv2alpha.Plugin{}, golangv4.Plugin{}),
plugin.WithPlugins(kustomizecommonv2.Plugin{}, golangv4.Plugin{}),
)

fs := machinery.Filesystem{
Expand All @@ -75,19 +56,13 @@ func main() {
cli.WithCommandName("kubebuilder"),
cli.WithVersion(versionString()),
cli.WithPlugins(
golangv2.Plugin{},
golangv3.Plugin{},
golangv4.Plugin{},
gov3Bundle,
gov4Bundle,
&kustomizecommonv1.Plugin{},
&kustomizecommonv2alpha.Plugin{},
&declarativev1.Plugin{},
&kustomizecommonv2.Plugin{},
&deployimagev1alpha1.Plugin{},
&grafanav1alpha1.Plugin{},
),
cli.WithPlugins(externalPlugins...),
cli.WithDefaultPlugins(cfgv2.Version, golangv2.Plugin{}),
cli.WithDefaultPlugins(cfgv3.Version, gov4Bundle),
cli.WithDefaultProjectVersion(cfgv3.Version),
cli.WithCompletion(),
Expand Down
2 changes: 0 additions & 2 deletions designs/helper_to_upgrade_projects_by_rescaffolding.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ make less painful this process. Examples:
- Deal with customizations or deviations from the proposed layout
- Be able to perform the project upgrade to the latest changes without human interactions
- Deal and support external plugins
- Provides support to [declarative](https://book.kubebuilder.io/plugins/declarative-v1.html) plugin
since it is desired and planned to decouple this solution and donate this plugin to its own authors [More info](https://github.com/kubernetes-sigs/kubebuilder/issues/3186)
- Provide support to older version before having the Project config (Kubebuilder < 3x) and the go/v2 layout which exists to ensure a backwards compatibility with legacy layout provided by Kubebuilder 2x

## Proposal
Expand Down
4 changes: 2 additions & 2 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ command = "./litgo.sh"
command = "./markerdocs.sh"

[context.environment]
environment = { GO_VERSION = "1.21" }
environment = { GO_VERSION = "1.22" }

[context.deploy-preview.environment]
environment = { GO_VERSION = "1.21" }
environment = { GO_VERSION = "1.22" }

17 changes: 1 addition & 16 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@

- [Deployment and Testing](./multiversion-tutorial/deployment.md)

- [Tutorial: Component Config](./component-config-tutorial/tutorial.md)

- [Changing things up](./component-config-tutorial/api-changes.md)
- [Defining your Config](./component-config-tutorial/define-config.md)

- [Using a custom type](./component-config-tutorial/custom-type.md)

- [Adding a new Config Type](./component-config-tutorial/config-type.md)
- [Updating main](./component-config-tutorial/updating-main.md)
- [Defining your Custom Config](./component-config-tutorial/define-custom-config.md)

---

- [Migrations](./migrations.md)
Expand Down Expand Up @@ -125,16 +114,12 @@

- [Available Plugins](./plugins/available-plugins.md)
- [To scaffold a project](./plugins/to-scaffold-project.md)
- [go/v2 (Deprecated)](./plugins/go-v2-plugin.md)
- [go/v3 (Deprecated)](./plugins/go-v3-plugin.md)
- [go/v4 (Default init scaffold)](./plugins/go-v4-plugin.md)
- [To add optional features](./plugins/to-add-optional-features.md)
- [declarative/v1 (Deprecated)](./plugins/declarative-v1.md)
- [grafana/v1-alpha](./plugins/grafana-v1-alpha.md)
- [deploy-image/v1-alpha](./plugins/deploy-image-plugin-v1-alpha.md)
- [To be extended for others tools](./plugins/to-be-extended.md)
- [kustomize/v1 (Deprecated)](./plugins/kustomize-v1.md)
- [kustomize/v2](./plugins/kustomize-v2.md)
- [kustomize/v2 (Default init scaffold with go/v4)](./plugins/kustomize-v2.md)
- [Extending the CLI](./plugins/extending-cli.md)
- [Creating your own plugins](./plugins/creating-plugins.md)
- [Testing your own plugins](./plugins/testing-plugins.md)
Expand Down
Loading

0 comments on commit c9513d7

Please sign in to comment.