Skip to content

Commit

Permalink
Merge branch 'master' into sajiyah--#3203
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajiyah-Salat committed May 7, 2023
2 parents 8657ebd + 4a04609 commit 74ea1f1
Show file tree
Hide file tree
Showing 688 changed files with 4,462 additions and 20,929 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/apidiff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,22 @@ on:
pull_request:

jobs:
check_docs_only:
name: check_docs_only
runs-on: ubuntu-18.04
outputs:
skip: ${{ steps.check_docs_only.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: check_docs_only
# Since PR's are squashed prior to merging to the branch checked out (default branch),
# HEAD^ will resolve to the previous point in history.
run: |
REF="HEAD^"
[[ -z "${{ github.base_ref }}" ]] || REF=$(git show-ref ${{ github.base_ref }} | head -1 | cut -d' ' -f2)
echo "::set-output name=skip::$(test/check-docs-only.sh $REF)"
go-apidiff:
name: Verify API differences
runs-on: ubuntu-latest
needs: check_docs_only
# Pull requests from different repository only trigger this checks
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.19"
go-version: '~1.20'
- name: Execute go-apidiff
uses: joelanford/go-apidiff@v0.5.0
uses: joelanford/go-apidiff@v0.6.0
with:
compare-imports: true
print-compatible: true
Expand Down
26 changes: 4 additions & 22 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,16 @@ on:
pull_request:

jobs:
check_docs_only:
name: check_docs_only
runs-on: ubuntu-18.04
outputs:
skip: ${{ steps.check_docs_only.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: check_docs_only
# Since PR's are squashed prior to merging to the branch checked out (default branch),
# HEAD^ will resolve to the previous point in history.
run: |
REF="HEAD^"
[[ -z "${{ github.base_ref }}" ]] || REF=$(git show-ref ${{ github.base_ref }} | head -1 | cut -d' ' -f2)
echo "::set-output name=skip::$(test/check-docs-only.sh $REF)"
lint:
name: golangci-lint
runs-on: ubuntu-latest
needs: check_docs_only
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Setup Go
uses: actions/setup-go@v3
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
Expand All @@ -56,4 +38,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Run yamllint make target
run: make yamllint
run: make yamllint
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '~1.19'
go-version: '~1.20'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/testdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
- name: Clone the code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
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
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/unit-tests-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,8 @@ jobs:
- name: Clone the code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
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
Expand Down
29 changes: 5 additions & 24 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,6 @@ on:
pull_request:

jobs:
check_docs_only:
name: check_docs_only
runs-on: ubuntu-18.04
outputs:
skip: ${{ steps.check_docs_only.outputs.skip }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: check_docs_only
# Since PR's are squashed prior to merging to the branch checked out (default branch),
# HEAD^ will resolve to the previous point in history.
run: |
REF="HEAD^"
[[ -z "${{ github.base_ref }}" ]] || REF=$(git show-ref ${{ github.base_ref }} | head -1 | cut -d' ' -f2)
echo "::set-output name=skip::$(test/check-docs-only.sh $REF)"
test:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -31,16 +14,15 @@ jobs:
os:
- ubuntu-latest
- macos-latest
needs: check_docs_only
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
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
Expand All @@ -61,15 +43,14 @@ jobs:
name: Code coverage
needs:
- test
- check_docs_only
runs-on: ubuntu-latest
# Pull requests from the same repository won't trigger this checks as they were already triggered by the push
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && needs.check_docs_only.outputs.skip != 'true'
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
steps:
- name: Clone the code
uses: actions/checkout@v3
- name: Setup Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: "1.19"
- name: Generate the coverage output
Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ issues:
exclude-rules:
- linters: [gosec]
path: "test/e2e/*"
- path: "hack/docs/*"
linters:
- lll
- gosec

linters-settings:
govet:
Expand Down
2 changes: 1 addition & 1 deletion 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.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+
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,7 @@ supporting Windows are welcome.

### Apple Silicon

Apple Silicon (`darwin/arm64`) is supported using the `go/v4-alpha` plugin which provides support for this platform.

```bash
kubebuilder init --domain my.domain --repo my.domain/guestbook --plugins=go/v4-alpha
```

**Note**: The `go/v4-alpha` plugin is an unstable version and can have breaking changes in future releases. The previous kustomize
version (`v3.Y.Z`) used in the `go/v3` has no available binaries for this
platform [kubernetes-sigs/kustomize/issues/4612](https://github.com/kubernetes-sigs/kustomize/issues/4612)
Because of this, we cannot support this `darwin/arm64` on the stable scaffold done by default with the Kubebuilder with the `go/v3` plugin.
Apple Silicon (`darwin/arm64`) support begins with the `go/v4` plugin.

## Community Meetings

Expand Down
2 changes: 1 addition & 1 deletion build/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
25 changes: 16 additions & 9 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ import (
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/model/stage"
"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-alpha"
kustomizecommonv2alpha "sigs.k8s.io/kubebuilder/v3/pkg/plugins/common/kustomize/v2"
"sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang"
declarativev1 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/declarative/v1"
deployimagev1alpha1 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/deploy-image/v1alpha1"
Expand All @@ -40,15 +39,23 @@ import (

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.NewBundle(golang.DefaultNameQualifier, plugin.Version{Number: 3},
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, Stage: stage.Alpha},
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{
Expand Down Expand Up @@ -76,7 +83,7 @@ func main() {
),
cli.WithPlugins(externalPlugins...),
cli.WithDefaultPlugins(cfgv2.Version, golangv2.Plugin{}),
cli.WithDefaultPlugins(cfgv3.Version, gov3Bundle),
cli.WithDefaultPlugins(cfgv3.Version, gov4Bundle),
cli.WithDefaultProjectVersion(cfgv3.Version),
cli.WithCompletion(),
)
Expand Down
8 changes: 4 additions & 4 deletions designs/extensible-cli-and-scaffolding-plugins-phase-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ plugins:
- domain: testproject.org
group: crew
kind: Captain
version: v2-alpha
version: v2
declarative.go.kubebuilder.io/v1:
resources:
- domain: testproject.org
Expand Down Expand Up @@ -177,7 +177,7 @@ The following scenarios shows what `kubebuilder` will send/receive to the extern
* External plugin to `kubebuilder`:
* The plugin reads the `PluginRequest` through its `stdin` and processes the request based on the `Command` that was sent. If the `Command` doesn't match what the plugin supports, it writes back an error immediately without any further processing. If the `Command` matches what the plugin supports, it constructs a `PluginResponse` containing the `Command` that was executed by the plugin, and modified `Universe` based on the new files that were scaffolded by the external plugin, `Error` and `ErrorMsg` that add any error information, and writes the `PluginResponse` back to `kubebuilder` through `stdout`.

* Note: If `--help` flag is being passed from `kubebuilder` to the external plugin through `PluginRequest`, the plugin attaches its help text information in the `Help` field of the `PluginResponse`. Both `PluginRequest` and `PluginResponse` also contain `APIVersion` field to have compatible versioned schemas.
* Note: If `--help` flag is being passed from `kubebuilder` to the external plugin through `PluginRequest`, the plugin attaches its help text information in the `Metadata` field of the `PluginResponse`. Both `PluginRequest` and `PluginResponse` also contain `APIVersion` field to have compatible versioned schemas.

* Handling plugin failures across the chain:

Expand Down Expand Up @@ -212,9 +212,9 @@ type PluginResponse struct {
// Command holds the command that gets executed by the plugin such as init, create api, etc.
Command string `json:"command"`

// Help contains the plugin specific help text that the plugin returns to kubebuilder when it receives
// Metadata contains the plugin specific help text that the plugin returns to Kubebuilder when it receives
// `--help` flag from Kubebuilder.
Help string `json:"help,omitempty"`
Metadata plugin.SubcommandMetadata `json:"metadata"`

// APIVersion defines the versioned schema of the PluginResponse that will be written back to kubebuilder.
// Initially, this will be marked as alpha (v1alpha1).
Expand Down
4 changes: 2 additions & 2 deletions designs/helper_to_upgrade_projects_by_rescaffolding.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,6 @@ to be addressed and maintained.

We could use it to do cool future features such as creating a GitHub action which would push-pull requests against the project repositories to help users be updated with, for example, minor changes. By using this command, we might able to git clone the project and to do a new scaffold and then use some [git strategy merge](https://www.geeksforgeeks.org/merge-strategies-in-git/) to result in a PR to purpose the required changes.

We probably need to store the CLI tool tag release used to do the scaffold to persuade this idea. So that we can know if the project requires or not updates.
We probably need to store the CLI tool tag release used to do the scaffold to persuade this idea. So that we can know if the project requires updates or not.

[project-config]: https://book.kubebuilder.io/reference/project-config.html
[project-config]: https://book.kubebuilder.io/reference/project-config.html
2 changes: 1 addition & 1 deletion docs/book/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title = "The Kubebuilder Book"
[output.html]
google-analytics = "UA-119864590-1"
curly-quotes = true
additional-css = ["theme/css/markers.css", "theme/css/custom.css"]
additional-css = ["theme/css/markers.css", "theme/css/custom.css", "theme/css/version-dropdown.css"]
git-repository-url = "https://github.com/kubernetes-sigs/kubebuilder"
edit-url-template = "https://github.com/kubernetes-sigs/kubebuilder/edit/master/docs/book/{path}"

Expand Down
2 changes: 1 addition & 1 deletion docs/book/install-and-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.1
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)
Expand Down
6 changes: 3 additions & 3 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
- [Migration Guide](migration/legacy/migration_guide_v2tov3.md)
- [Migration by updating the files](migration/legacy/manually_migration_guide_v2_v3.md)
- [From v3.0.0 with plugins](./migration/v3-plugins.md)
- [go/v3 vs go/v4-alpha](migration/v3vsv4.md)
- [go/v3 vs go/v4](migration/v3vsv4.md)

- [Migration Guide](migration/migration_guide_gov3_to_gov4.md)
- [Migration by updating the files](migration/manually_migration_guide_gov3_to_gov4.md)
Expand Down Expand Up @@ -117,14 +117,14 @@
- [To scaffold a project](./plugins/to-scaffold-project.md)
- [go/v2 (Deprecated)](./plugins/go-v2-plugin.md)
- [go/v3 (Default init scaffold)](./plugins/go-v3-plugin.md)
- [go/v4-alpha](./plugins/go-v4-plugin.md)
- [go/v4](./plugins/go-v4-plugin.md)
- [To add optional features](./plugins/to-add-optional-features.md)
- [declarative/v1](./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-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)
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/component-config-tutorial/api-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps](/quick-start.md#installation) before continuing.
kubebuilder init --domain tutorial.kubebuilder.io --component-config
```

## Setting up an exising project
## Setting up an existing project

If you've previously generated a project we can add support for parsing the
config file by making the following changes to `main.go`.
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/component-config-tutorial/config-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Then, run `make build` to implement the interface for your API type, which would
<h1>Use --controller=false</h1>

You may notice this command from the `CronJob` tutorial although here we
explicity setting `--controller=false` because `ProjectConfig` is not
explicitly setting `--controller=false` because `ProjectConfig` is not
intended to be an API extension and cannot be reconciled.

</aside>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
testbin/
Loading

0 comments on commit 74ea1f1

Please sign in to comment.