diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 99a0002983e..12bdbe3a634 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,7 +5,6 @@ version: 2 updates: - # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" # Workflow files stored in the @@ -47,3 +46,11 @@ updates: directory: "testdata/project-v4" schedule: interval: "weekly" + + # Maintain dependencies for go in external plugin sample + - package-ecosystem: "gomod" + directory: "docs/book/src/simple-external-plugin-tutorial/testdata/sampleexternalplugin/v1" + schedule: + interval: "weekly" + labels: + - "ok-to-test" diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml index 46e63340134..bc7ab234085 100644 --- a/.github/workflows/apidiff.yml +++ b/.github/workflows/apidiff.yml @@ -19,18 +19,9 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: '~1.20' - name: Execute go-apidiff uses: joelanford/go-apidiff@v0.6.0 with: compare-imports: true print-compatible: true - - name: Report failure - uses: nashmaniac/create-issue-action@v1.1 - # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch - if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - title: 🐛 go-apidiff failed for ${{ github.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - labels: kind/bug - body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0a04981795e..b4276d63d91 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: 1.19 + go-version: '~1.20' - name: Clone the code uses: actions/checkout@v3 - name: Run linter @@ -23,15 +23,6 @@ jobs: with: version: v1.51 only-new-issues: true # Show only new issues if it's a pull request - - name: Report failure - uses: nashmaniac/create-issue-action@v1.1 - # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch - if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - title: 🐛 Lint failed for ${{ github.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - labels: kind/bug - body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} yamllint: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5b8a81b2b06..4f5f4328436 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: '~1.19' + go-version: '~1.20' - name: Run GoReleaser uses: goreleaser/goreleaser-action@v4 with: diff --git a/.github/workflows/testdata.yml b/.github/workflows/testdata.yml index 84757297802..a9873c867a2 100644 --- a/.github/workflows/testdata.yml +++ b/.github/workflows/testdata.yml @@ -18,7 +18,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: '1.19' + go-version: '~1.20' - 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 @@ -27,12 +27,3 @@ jobs: run: make check-testdata - name: Verify docs update run: make check-docs - - name: Report failure - uses: nashmaniac/create-issue-action@v1.1 - # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch - if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - title: 🐛 Testadata verification failed for ${{ github.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - labels: kind/bug - body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/unit-tests-legacy.yml b/.github/workflows/unit-tests-legacy.yml index 57b6aba799a..ca2a4751174 100644 --- a/.github/workflows/unit-tests-legacy.yml +++ b/.github/workflows/unit-tests-legacy.yml @@ -23,15 +23,6 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - # the go/v2 cannot be updated and is scaffold with golang 1.13 - # (version used by its dep version of the controller-runtime) - # however, we are unable to downgrade the version here - # because we will face errors - # So we are keeping the latest version where it works - # and highlighting that must be fixed - # Therefore, we probably will deprecate go/v2 soon since we cannot upgrade it - # to use the versions of controller-runtime > v0.9 - # and controller-tools > v0.6 as k8s > 1.21 then it might not be valid we spend effort on this fix go-version: "1.19" # This step is needed as the following one tries to remove # kustomize for each test but has no permission to do so @@ -39,12 +30,3 @@ jobs: run: sudo rm -f /usr/local/bin/kustomize - name: Perform the test run: make test-legacy - - name: Report failure - uses: nashmaniac/create-issue-action@v1.1 - # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch - if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - title: 🐛 Unit tests failed on ${{ matrix.os }} for ${{ github.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - labels: kind/bug - body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f9e4e7b9645..a6b88c4f1dc 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -22,7 +22,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: "1.19" + go-version: '~1.20' # 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 @@ -30,7 +30,7 @@ jobs: - name: Perform the test run: make test - name: Report failure - uses: nashmaniac/create-issue-action@v1.1 + uses: nashmaniac/create-issue-action@v1.2 # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' with: @@ -59,12 +59,3 @@ jobs: uses: shogo82148/actions-goveralls@v1 with: path-to-profile: coverage-all.out - - name: Report failure - uses: nashmaniac/create-issue-action@v1.1 - # Only report failures of pushes (PRs have are visible through the Checks section) to the default branch - if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/master' - with: - title: 🐛 Coverage report failed for ${{ github.sha }} - token: ${{ secrets.GITHUB_TOKEN }} - labels: kind/bug - body: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.golangci.yml b/.golangci.yml index 0b008e2bb97..8ca78c49c23 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -11,6 +11,10 @@ issues: exclude-rules: - linters: [gosec] path: "test/e2e/*" + - path: "hack/docs/*" + linters: + - lll + - gosec linters-settings: govet: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26990e19135..f1c031764b4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ Please see https://git.k8s.io/community/CLA.md for more info. ## Prerequisites -- [go](https://golang.org/dl/) version v1.16+. +- [go](https://golang.org/dl/) version v1.20+. - [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+ diff --git a/OWNERS_ALIASES b/OWNERS_ALIASES index 90f558c5e00..5e7e45ceda9 100644 --- a/OWNERS_ALIASES +++ b/OWNERS_ALIASES @@ -4,9 +4,7 @@ aliases: # active folks who can be contacted to perform admin-related # tasks on the repo, or otherwise approve any PRs. kubebuilder-admins: - - pwittrock - camilamacedo86 - - jmrodri - varshaprasad96 # non-admin folks who can approve any PRs in the repo @@ -15,7 +13,6 @@ aliases: # 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 - rashmigottipati - everettraven - Kavinjsir @@ -23,8 +20,11 @@ aliases: # folks who may have context on ancient history, # but are no longer directly involved kubebuilder-emeritus-approvers: + - adirio - directxman12 - droot - - mengqiy - estroz - - adirio + - jmrodri + - joelanford + - mengqiy + - pwittrock diff --git a/build/.goreleaser.yml b/build/.goreleaser.yml index 6cc3904d9d7..71f948e7e5e 100644 --- a/build/.goreleaser.yml +++ b/build/.goreleaser.yml @@ -44,7 +44,7 @@ builds: - darwin_amd64 - darwin_arm64 env: - - KUBERNETES_VERSION=1.26.1 + - KUBERNETES_VERSION=1.27.1 - CGO_ENABLED=0 # Only binaries of the form "kubebuilder_${goos}_${goarch}" will be released. diff --git a/cmd/main.go b/cmd/main.go index fa60babab37..7f59bb26161 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -46,17 +46,16 @@ func main() { "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.NewBundle(golang.DefaultNameQualifier, plugin.Version{Number: 3}, - deprecateMessageGoV3Bundle, - kustomizecommonv1.Plugin{}, - golangv3.Plugin{}, + 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 - gov4Bundle, _ := plugin.NewBundle(golang.DefaultNameQualifier, plugin.Version{Number: 4}, - "", - kustomizecommonv2alpha.Plugin{}, - golangv4.Plugin{}, + gov4Bundle, _ := plugin.NewBundleWithOptions(plugin.WithName(golang.DefaultNameQualifier), + plugin.WithVersion(plugin.Version{Number: 4}), + plugin.WithPlugins(kustomizecommonv2alpha.Plugin{}, golangv4.Plugin{}), ) fs := machinery.Filesystem{ diff --git a/docs/book/install-and-build.sh b/docs/book/install-and-build.sh index fc9c6a51199..1d6fc263592 100755 --- a/docs/book/install-and-build.sh +++ b/docs/book/install-and-build.sh @@ -67,7 +67,7 @@ ${cmd} /tmp/mdbook.${ext} chmod +x /tmp/mdbook echo "grabbing the latest released controller-gen" -go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.11.3 +go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.12.0 # make sure we add the go bin directory to our path gobin=$(go env GOBIN) diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md index 4c8a951bada..40773b5e525 100644 --- a/docs/book/src/SUMMARY.md +++ b/docs/book/src/SUMMARY.md @@ -80,6 +80,7 @@ - [Generating CRDs](./reference/generating-crd.md) - [Using Finalizers](./reference/using-finalizers.md) + - [Raising Events](./reference/raising-events.md) - [Watching Resources](./reference/watching-resources.md) - [Resources Managed by the Operator](./reference/watching-resources/operator-managed.md) - [Externally Managed Resources](./reference/watching-resources/externally-managed.md) @@ -124,7 +125,7 @@ - [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-alpha](./plugins/kustomize-v2-alpha.md) + - [kustomize/v2](./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) diff --git a/docs/book/src/component-config-tutorial/api-changes.md b/docs/book/src/component-config-tutorial/api-changes.md index e65d6100b3e..edd39223edd 100644 --- a/docs/book/src/component-config-tutorial/api-changes.md +++ b/docs/book/src/component-config-tutorial/api-changes.md @@ -1,5 +1,17 @@ # Changing things up + + This tutorial will show you how to create a custom configuration file for your project by modifying a project generated with the `--component-config` flag passed to the `init` command. The full tutorial's source can be found diff --git a/docs/book/src/component-config-tutorial/config-type.md b/docs/book/src/component-config-tutorial/config-type.md index d8d42925de3..518f360ed81 100644 --- a/docs/book/src/component-config-tutorial/config-type.md +++ b/docs/book/src/component-config-tutorial/config-type.md @@ -1,5 +1,17 @@ # Adding a new Config Type + + To scaffold out a new config Kind, we can use `kubebuilder create api`. ```bash diff --git a/docs/book/src/component-config-tutorial/custom-type.md b/docs/book/src/component-config-tutorial/custom-type.md index 76dfeda43d2..55910168e48 100644 --- a/docs/book/src/component-config-tutorial/custom-type.md +++ b/docs/book/src/component-config-tutorial/custom-type.md @@ -1,5 +1,17 @@ # Using a Custom Type + + -While Kubebuilder v2 will not scaffold out a project structure compatible -with multiple API groups in the same repository by default, it's possible -to modify the default project structure to support it. - Let's migrate the [CronJob example][cronjob-tutorial]. +To change the layout of your project to support Multi-Group run the command +`kubebuilder edit --multigroup=true`. Once you switch to a multi-group layout, the new Kinds +will be generated in the new layout but additional manual work is needed +to move the old API groups to the new layout. + Generally, we use the prefix for the API group as the directory name. We can check `api/v1/groupversion_info.go` to find that out: @@ -38,58 +38,75 @@ can check `api/v1/groupversion_info.go` to find that out: package v1 ``` -Then, we'll rename `api` to `apis` to be more clear, and we'll move our -existing APIs into a new subdirectory, "batch": +Then, we'll rename move our existing APIs into a new subdirectory, "batch": ```bash -mkdir apis/batch -mv api/* apis/batch -# After ensuring that all was moved successfully remove the old directory `api/` -rm -rf api/ +mkdir api/batch +mv api/* api/batch ``` - -After moving the APIs to a new directory, the same needs to be applied to the controllers: +After moving the APIs to a new directory, the same needs to be applied to the controllers. For go/v4: ```bash -mkdir controllers/batch -mv controllers/* controllers/batch/ +mkdir internal/controller/batch +mv internal/controller/* internal/controller/batch/ ``` +