Skip to content

Commit 3dd3db1

Browse files
authored
Merge branch 'kubernetes-sigs:master' into master
2 parents 426232e + b4ca153 commit 3dd3db1

File tree

31 files changed

+234
-121
lines changed

31 files changed

+234
-121
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test Alpha Generate
2+
3+
on:
4+
push:
5+
paths:
6+
- 'pkg/cli/alpha/**'
7+
- '.github/workflows/test-alpha-generate.yml'
8+
pull_request:
9+
paths:
10+
- 'pkg/cli/alpha/**'
11+
- '.github/workflows/test-alpha-generate.yml'
12+
13+
jobs:
14+
unsupported:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: true
18+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version-file: go.mod
27+
28+
- name: Install dependencies and generate binary
29+
run: make install
30+
31+
- name: Navigate to testdata/project-v4
32+
run: cd testdata/project-v4
33+
34+
- name: Update PROJECT file
35+
run: |
36+
sed -i 's#go.kubebuilder.io/v4#go.kubebuilder.io/v3#g' testdata/project-v4/PROJECT
37+
38+
- name: Run kubebuilder alpha generate
39+
run: |
40+
cd testdata/project-v4 && kubebuilder alpha generate

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const unknown = "unknown"
2727
// information in the release process
2828
var (
2929
kubeBuilderVersion = unknown
30-
kubernetesVendorVersion = unknown
30+
kubernetesVendorVersion = "1.32.1"
3131
goos = unknown
3232
goarch = unknown
3333
gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD)

designs/code-generate-image-plugin.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Summary
88

9-
This proposal defines a new plugin which allow users get the scaffold with the
9+
This proposal defines a new plugin that allows users to get the scaffold with the
1010
required code to have a project that will deploy and manage an image on the cluster following the guidelines and what have been considered as good practices.
1111

1212
## Motivation
@@ -18,24 +18,24 @@ The biggest part of the Kubebuilder users looking for to create a project that w
1818
### Goals
1919

2020
- Add a new plugin to generate the code required to deploy and manage an image on the cluster
21-
- Promote the best practices as give example of common implementations
22-
- Make the process to develop operators projects easier and more agil.
21+
- Promote the best practices by giving examples of common implementations
22+
- Make the process of developing operator's projects easier and more agile.
2323
- Give flexibility to the users and allow them to change the code according to their needs
24-
- Provide examples of code implementations and of the most common features usage and reduce the learning curve
24+
- Provide examples of code implementations and of the usage of the most common features and reduce the learning curve
2525

2626
### Non-Goals
2727

28-
The idea of this proposal is provide a facility for the users. This plugin can be improved
28+
The idea of this proposal is to provide a facility for the users. This plugin can be improved
2929
in the future, however, this proposal just covers the basic requirements. In this way, is a non-goal
30-
allow extra configurations such as; scaffold the project using webhooks and the controller covered by tests.
30+
allow extra configurations such as; scaffolding the project using webhooks and the controller covered by tests.
3131

3232
## Proposal
3333

34-
Add the new plugin code generate which will scaffold code implementation to deploy the image informed which would like such as; `kubebuilder create api --group=crew --version=v1 --image=myexample:0.0.1 --kind=App --plugins=deploy-image.go.kubebuilder.io/v1beta1` which will:
34+
Add the new plugin code generated which will scaffold code implementation to deploy the image informed which would like such as; `kubebuilder create api --group=crew --version=v1 --image=myexample:0.0.1 --kind=App --plugins=deploy-image.go.kubebuilder.io/v1beta1` which will:
3535

36-
- Add a code implementation which will do the Custom Resource reconciliation and create a Deployment resource for the `--image`;
36+
- Add a code implementation that will do the Custom Resource reconciliation and create a Deployment resource for the `--image`;
3737

38-
- Add an EnvVar on the manager manifest (`config/manager/manager.yaml`) which will store the image informed and shows its possibility to users:
38+
- Add an EnvVar on the manager manifest (`config/manager/manager.yaml`) which will store the image informed and show its possibility to users:
3939

4040
```yaml
4141
..
@@ -49,7 +49,7 @@ Add the new plugin code generate which will scaffold code implementation to depl
4949
...
5050
```
5151

52-
- Add a check into reconcile to ensure that the replicas of the deployment on cluster are equals the size defined in the CR:
52+
- Add a check into reconcile to ensure that the replicas of the deployment on the cluster are equal the size defined in the CR:
5353

5454
```go
5555
// Ensure the deployment size is the same as the spec
@@ -83,7 +83,7 @@ func (r *{{ resource }}Reconciler) SetupWithManager(mgr ctrl.Manager) error {
8383
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
8484
```
8585

86-
- A status [conditions][conditions] to allow users check that if the deployment occurred successfully or its errors
86+
- A status [conditions][conditions] to allow users to check if the deployment occurred successfully or if its errors
8787

8888
- Add a [marker][markers] in the spec definition to demonstrate how to use OpenAPI schemas validation such as `+kubebuilder:validation:Minimum=1`
8989

@@ -93,9 +93,9 @@ func (r *{{ resource }}Reconciler) SetupWithManager(mgr ctrl.Manager) error {
9393

9494
### User Stories
9595

96-
- I am as user, would like to use a command to scaffold my common need which is deploy an image of my application, so that I do not need to know exactly how to implement it
96+
- I am a user, who would like to use a command to scaffold my common need which is to deploy an image of my application, so that I do not need to know exactly how to implement it
9797

98-
- I am as user, would like to have a good example code base which uses the common features, so that I can easily learn its concepts and have a good start point to address my needs.
98+
- I am a user, would like to have a good example code base that uses the common features so that I can easily learn its concepts and have a good starting point to address my needs.
9999

100100
- I am as maintainer, would like to have a good example to address the common questions, so that I can easily describe how to implement the projects and/or use the common features.
101101

@@ -251,12 +251,12 @@ type {{ resource }}Spec struct {
251251

252252
### Test Plan
253253

254-
To ensure this implementation a new project example should be generated in the [testdata](../testdata/) directory of the project. See the [test/testdata/generate.sh](../test/testadata/generate.sh). Also, we should use this scaffold in the [integration tests](../test/e2e/) to ensure that the data scaffolded with works on the cluster as expected.
254+
To ensure this implementation a new project example should be generated in the [testdata](../testdata/) directory of the project. See the [test/testdata/generate.sh](../test/testadata/generate.sh). Also, we should use this scaffold in the [integration tests](../test/e2e/) to ensure that the data scaffold works on the cluster as expected.
255255

256256
### Graduation Criteria
257257

258-
- The new plugin will only be support `project-version=3`
259-
- The attribute image with the value informed should be added to the resources model in the PROJECT file to let the tool know that the Resource get done with the common basic code implementation:
258+
- The new plugin will only support `project-version=3`
259+
- The attribute image with the value informed should be added to the resources model in the PROJECT file to let the tool know that the Resource gets done with the common basic code implementation:
260260

261261
```yaml
262262
plugins:
@@ -279,22 +279,22 @@ No, at least in the first moment to keep the simplicity.
279279
2. Should we support StatefulSet and Deployments?
280280
The idea is we start it by using a Deployment. However, we can improve the feature in follow-ups to support more default types of scaffolds which could be like `kubebuilder create api --group=crew --version=v1 --image=myexample:0.0.1 --kind=App --plugins=deploy-image.go.kubebuilder.io/v1beta1 --type=[deployment|statefulset|webhook]`
281281
282-
3. Could this feature be useful to other languages or is it just valid to Go based operators?
282+
3. Could this feature be useful to other languages or is it just valid to Go-based operators?
283283
284284
This plugin would is reponsable to scaffold content and files for Go-based operators. In a future, if other language-based operators starts to be supported (either officially or by the community) this plugin could be used as reference to create an equivalent one for their languages. Therefore, it should probably not to be a `subdomain` of `go.kubebuilder.io.`
285285
286-
For its integration with SDK, it might be valid for the Ansible-based operators where a new `playbook/role` could be generated as well. However, for example, for the Helm plugin it might to be useless. E.g `deploy-image.ansible.sdk.operatorframework.io/v1beta1`
286+
For its integration with SDK, it might be valid for the Ansible-based operators where a new `playbook/role` could be generated as well. However, for example,for the Helm plugin, it might be useless. E.g `deploy-image.ansible.sdk.operatorframework.io/v1beta1`
287287
288-
4. Should we consider create a separate repo for plugins?
288+
4. Should we consider creating a separate repo for plugins?
289289
290-
In the long term yes. However, see that currently, Kubebuilder has not too many plugins yet. And then, and the preliminary support for plugins did not indeed release. For more info see the [Extensible CLI and Scaffolding Plugins][plugins-phase1-design-doc].
290+
In the long term yes. However, see that currently, Kubebuilder does not have too many plugins yet. And then, the preliminary support for plugins was not indeed released. For more info see the [Extensible CLI and Scaffolding Plugins][plugins-phase1-design-doc].
291291
292292
In this way, at this moment, it shows to be a little Premature Optimization. Note that the issue [#2016](https://github.com/kubernetes-sigs/kubebuilder/issues/1378) will check the possibility of the plugins be as separate binaries that can be discovered by the Kubebuilder CLI binary via user-specified plugin file paths. Then, the discussion over the best approach to dealing with many plugins and if they should or not leave in the Kubebuilder repository would be better addressed after that.
293293
294294
5. Is Kubebuilder prepared to receive this implementation already?
295295
296-
The [Extensible CLI and Scaffolding Plugins - Phase 1.5](extensible-cli-and-scaffolding-plugins-phase-1-5.md) and the issue #1941 requires to be implemented before this proposal. Also, to have a better idea over the proposed solutions made so for the Plugin Ecosystem see the meta issue [#2016](https://github.com/kubernetes-sigs/kubebuilder/issues/2016)
296+
The [Extensible CLI and Scaffolding Plugins - Phase 1.5](extensible-cli-and-scaffolding-plugins-phase-1-5.md) and issue #1941 are required to be implemented before this proposal. Also, to have a better idea of the proposed solutions made so for the Plugin Ecosystem see the meta issue [#2016](https://github.com/kubernetes-sigs/kubebuilder/issues/2016)
297297
298298
[markers]: ../docs/book/src/reference/markers.md
299299
[conditions]: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties
300-
[plugins-phase1-design-doc]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/extensible-cli-and-scaffolding-plugins-phase-1.md
300+
[plugins-phase1-design-doc]: https://github.com/kubernetes-sigs/kubebuilder/blob/master/designs/extensible-cli-and-scaffolding-plugins-phase-1.md

docs/CONTRIBUTING-ROLES.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ project, or the project as a whole. We follow a similar set of
1414
definitions to the [main Kubernetes project itself][kube-ladder], with
1515
slightly looser requirements.
1616

17-
As much as possible, we want people to help take on responsibility in the
17+
As much as possible, we want people to help take on responsibility for the
1818
project -- these guidelines are attempts to make it *easier* for this to
1919
happen, *not harder*. If you've got any questions, just reach out on
2020
Slack to one of the [subproject leads][kb-leads] (called
@@ -24,7 +24,7 @@ kubebuilder-admins in the `OWNERS_ALIASES` file).
2424

2525
Anyone who wants to become a reviewer or approver must first be a [member
2626
of the Kubernetes project][kube-member]. The aforementioned doc has more
27-
details, but the gist is that you must have made a couple contributions to
27+
details, but the gist is that you must have made a couple of contributions to
2828
some part of the Kubernetes project -- *this includes Kubebuilder and
2929
related repos*. Then, you need two existing members to sponsor you.
3030

@@ -34,22 +34,22 @@ sponsor you, just ping us on Slack :-)**
3434
## Reviewers
3535

3636
Reviewers are recognized as able to provide code reviews for parts of the
37-
codebase, and are entered into the `reviewers` section of one or more
37+
codebase and are entered into the `reviewers` section of one or more
3838
`OWNERS` files. You'll get auto-assigned reviews for your area of the
39-
codebase, and are generally expected to review for both correctness,
39+
codebase and are generally expected to review for correctness,
4040
testing, general code organization, etc. Reviewers may review for design
4141
as well, but approvers have the final say on that.
4242

4343
Things to look for:
4444

45-
- does this code work, and is it written performantly and idomatically?
45+
- does this code work, and is it written performantly and idiomatically?
4646
- is it tested?
4747
- is it organized nicely? Is it maintainable?
4848
- is it documented?
4949
- does it need to be threadsafe? Is it?
5050
- Take a glance at the stuff for approvers, if you can.
5151

52-
Reviewers' `/lgtm` marks are generally trusted by approvers to mean that
52+
Reviewers' `/lgtm` marks are generally trusted by approvers to means that
5353
the code is ready for one last look-over before merging.
5454

5555
### Becoming a Reviewer
@@ -65,7 +65,7 @@ worked on a cross-cutting feature, it's ok to count PRs across
6565
repositories.
6666

6767
Once you meet those criteria, submit yourself as a reviewer in the
68-
`OWNERS` file or files that you feel represent your areas of knowlege via
68+
`OWNERS` file or files that you feel represent your areas of knowledge via
6969
a PR to the relevant repository.
7070

7171
## Approvers
@@ -75,14 +75,14 @@ Once approvals (`/approve`) are given for each piece of the affected code
7575
(and a reviewer or approver has added `/lgtm`), the code will merge.
7676

7777
Approvers are responsible for giving the code a final once-over before
78-
merge, and doing an overall design/API review.
78+
merge, and do an overall design/API review.
7979

8080
Things to look for:
8181

8282
- Does the API exposed to the user make sense, and is it easy to use?
83-
- Is it backwards compatible?
83+
- Is it backward compatible?
8484
- Will it accommodate new changes in the future?
85-
- Is it extesnible/layerable (see [DESIGN.md](../DESIGN.md))?
85+
- Is it extensible/layer-able (see [DESIGN.md](../DESIGN.md))?
8686
- Does it expose a new type from `k8s.io/XYZ`, and, if so, is it worth it?
8787
Is that piece well-designed?
8888

@@ -93,24 +93,24 @@ them.
9393

9494
### Becoming an Approver
9595

96-
All approvers need to start out as reviewers. The criteria for becoming
97-
an approver are:
96+
All approvers need to start as reviewers. The criteria for becoming
97+
an approver is:
9898

99-
- Be a reviewer in the area for a couple months
99+
- Be a reviewer in the area for a couple of months
100100
- Be the "main" reviewer or contributor for 5-10 substantial (bugfixes,
101101
features, etc) PRs where approvers did not need to leave substantial
102102
additional comments (i.e. where you were acting as a defacto approver).
103103

104104
Once you've met those criteria, you can submit yourself as an approver
105-
using a PR that edits the revelant `OWNERS` files appropriately. The
105+
using a PR that edits the relevant `OWNERS` files appropriately. The
106106
existing approvers will then approve the change with lazy consensus. If
107107
you feel more comfortable asking before submitting the PR, feel free to
108108
ping one of the [subproject leads][kb-leads] (called kubebuilder-admins in
109109
the `OWNERS_ALIASES` file) on Slack.
110110

111111
## Indirectly Code-Related/Non-Code Roles
112112

113-
We're always looking help with other areas of the project as well, such
113+
We're always looking for help with other areas of the project as well, such
114114
as:
115115

116116
### Docs
@@ -120,15 +120,15 @@ reviewers/approvers for the book by following the same process above.
120120

121121
### Triage
122122

123-
Help triaging our issues is also welcome. Folks doing triage are
123+
Help to triage our issues is also welcome. Folks doing triage are
124124
responsible for using the following commands to mark PRs and issues with
125125
one or more labels, and should also feel free to help answer questions:
126126

127127
- `/kind {bug|feature|documentation}`: things that are broken/new
128-
things/things with lots of words, repsectively
128+
things/things with lots of words, respectively
129129

130130
- `/triage support`: questions, and things that might be bugs but might
131-
just be confusion of how to use something
131+
just be confused about how to use something
132132

133133
- `/priority {backlog|important-longterm|important-soon|critical-urgent}`:
134134
how soon we need to deal with the thing (if someone wants

docs/book/src/cronjob-tutorial/gvks.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Groups and Versions and Kinds, oh my!
22

3-
Actually, before we get started with our API, we should talk terminology
3+
Before we get started with our API, we should talk about terminology
44
a bit.
55

66
When we talk about APIs in Kubernetes, we often use 4 terms: *groups*,
@@ -38,7 +38,7 @@ lowercase form of the Kind.
3838

3939
## So, how does that correspond to Go?
4040

41-
When we refer to a kind in a particular group-version, we'll call it
41+
When we refer to a kind in a particular group version, we'll call it
4242
a *GroupVersionKind*, or GVK for short. Same with resources and GVR. As
4343
we'll see shortly, each GVK corresponds to a given root Go type in
4444
a package.
@@ -51,7 +51,7 @@ API!
5151
In the next section, [Adding a new API](../cronjob-tutorial/new-api.html), we will check how the tool helps us to
5252
create our own APIs with the command `kubebuilder create api`.
5353

54-
The goal of this command is to create Custom Resource (CR) and Custom Resource Definition (CRD) for our Kind(s). To check it further see; [Extend the Kubernetes API with CustomResourceDefinitions][kubernetes-extend-api].
54+
The goal of this command is to create a Custom Resource (CR) and Custom Resource Definition (CRD) for our Kind(s). To check it further see; [Extend the Kubernetes API with CustomResourceDefinitions][kubernetes-extend-api].
5555

5656
## But, why create APIs at all?
5757

@@ -87,7 +87,7 @@ API server that says
8787
}
8888
```
8989

90-
or properly look up the group-version when we go to submit a `&CronJob{}`
90+
or properly look up the group version when we go to submit a `&CronJob{}`
9191
in an update.
9292

9393
[kubernetes-extend-api]: https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/

docs/book/src/cronjob-tutorial/testdata/project/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ test: manifests generate fmt vet setup-envtest ## Run tests.
7171
# - CERT_MANAGER_INSTALL_SKIP=true
7272
.PHONY: test-e2e
7373
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
74-
@command -v kind >/dev/null 2>&1 || { \
74+
@command -v $(KIND) >/dev/null 2>&1 || { \
7575
echo "Kind is not installed. Please install Kind manually."; \
7676
exit 1; \
7777
}
78-
@kind get clusters | grep -q 'kind' || { \
78+
@$(KIND) get clusters | grep -q 'kind' || { \
7979
echo "No Kind cluster is running. Please start a Kind cluster before running the e2e tests."; \
8080
exit 1; \
8181
}
@@ -169,13 +169,14 @@ $(LOCALBIN):
169169

170170
## Tool Binaries
171171
KUBECTL ?= kubectl
172+
KIND ?= kind
172173
KUSTOMIZE ?= $(LOCALBIN)/kustomize
173174
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
174175
ENVTEST ?= $(LOCALBIN)/setup-envtest
175176
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
176177

177178
## Tool Versions
178-
KUSTOMIZE_VERSION ?= v5.5.0
179+
KUSTOMIZE_VERSION ?= v5.6.0
179180
CONTROLLER_TOOLS_VERSION ?= v0.17.2
180181
#ENVTEST_VERSION is the version of controller-runtime release branch to fetch the envtest setup script (i.e. release-0.20)
181182
ENVTEST_VERSION ?= $(shell go list -m -f "{{ .Version }}" sigs.k8s.io/controller-runtime | awk -F'[v.]' '{printf "release-%d.%d", $$2, $$3}')

0 commit comments

Comments
 (0)