Skip to content

Commit 2c8753e

Browse files
authored
Merge pull request #2661 from kubernetes-sigs/master
🌱 Prepare for patch release 3.4.1
2 parents c6fb3af + 10e93e9 commit 2c8753e

37 files changed

+607
-142
lines changed

build/cloudbuild.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ steps:
3838
git checkout $${BRANCH_NAME}
3939
git branch --set-upstream-to=origin/$${BRANCH_NAME}
4040
git tag -d ${TAG_NAME}
41-
- name: "goreleaser/goreleaser:v0.147"
41+
- name: "goreleaser/goreleaser:v1.8.3"
4242
entrypoint: "bash"
4343
args: ["build/build_kubebuilder.sh"]
4444
secretEnv: ["GITHUB_TOKEN"]
@@ -48,4 +48,4 @@ steps:
4848
secrets:
4949
- kmsKeyName: projects/kubebuilder/locations/global/keyRings/kubebuilder-gh-tokens/cryptoKeys/gh-release-token
5050
secretEnv:
51-
GITHUB_TOKEN: CiQAChsKTruEiSo6yBI+xg75jyr4f8yM93R2e9QbpeRX3jF3VAwSUQDQuYkCiUd+6e/1wKQAyHnf6BYv0GNGMghyNzYbXT0owBzQqmIQJeu/VDGZcEVabIWErNXjbPqPiysIu0uAiKAAUTUK0VYMr9E6GdTJ0+hVmg==
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build/cloudbuild_local.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Release tar will be in ./cloudbuild
2020

2121
steps:
22-
- name: "goreleaser/goreleaser:v0.147"
22+
- name: "goreleaser/goreleaser:v1.8.3"
2323
entrypoint: "bash"
2424
env: ["SNAPSHOT=1"]
2525
args: ["build/build_kubebuilder.sh"]

build/cloudbuild_snapshot.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Release tar will be in ./cloudbuild
2020

2121
steps:
22-
- name: "goreleaser/goreleaser:v0.147"
22+
- name: "goreleaser/goreleaser:v1.8.3"
2323
entrypoint: "bash"
2424
env: ["SNAPSHOT=1"]
2525
args: ["build/build_kubebuilder.sh"]

docs/book/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
- [go/v3 plugin](./plugins/go-v3-plugin.md)
113113
- [go/v2 plugin](./plugins/go-v2-plugin.md)
114114
- [Declarative V1](./plugins/declarative-v1.md)
115+
- [Kustomize V1](./plugins/kustomize-v1.md)
115116
- [Plugins Versioning](./plugins/plugins-versioning.md)
116117

117118
---

docs/book/src/component-config-tutorial/testdata/generate_componentconfig.sh

+2
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ function gen_component_config_tutorial {
5454
header_text "creating tutorial.kubebuilder.io base ..."
5555
kubebuilder init --domain tutorial.kubebuilder.io --repo tutorial.kubebuilder.io/project --component-config --license apache2 --owner "The Kubernetes authors"
5656
kubebuilder create api --group config --version v2 --kind ProjectConfig --resource --controller=false --make=false
57+
go mod tidy
58+
make
5759
}
5860

5961
gen_component_config_tutorial

docs/book/src/component-config-tutorial/testdata/project/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
104104

105105
## Location to install dependencies to
106106
LOCALBIN ?= $(shell pwd)/bin
107-
$(LOCALBIN): ## Ensure that the directory exists
107+
$(LOCALBIN):
108108
mkdir -p $(LOCALBIN)
109109

110110
## Tool Binaries
@@ -119,15 +119,15 @@ CONTROLLER_TOOLS_VERSION ?= v0.8.0
119119
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
120120
.PHONY: kustomize
121121
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
122-
$(KUSTOMIZE):
122+
$(KUSTOMIZE): $(LOCALBIN)
123123
curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN)
124124

125125
.PHONY: controller-gen
126126
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
127-
$(CONTROLLER_GEN):
127+
$(CONTROLLER_GEN): $(LOCALBIN)
128128
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
129129

130130
.PHONY: envtest
131131
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
132-
$(ENVTEST):
132+
$(ENVTEST): $(LOCALBIN)
133133
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# project
2+
// TODO(user): Add simple overview of use/purpose
3+
4+
## Description
5+
// TODO(user): An in-depth paragraph about your project and overview of use
6+
7+
## Getting Started
8+
You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
9+
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).
10+
11+
### Running on the cluster
12+
1. Install Instances of Custom Resources:
13+
14+
```sh
15+
kubectl apply -f config/samples/
16+
```
17+
18+
2. Build and push your image to the location specified by `IMG`:
19+
20+
```sh
21+
make docker-build docker-push IMG=<some-registry>/project:tag
22+
```
23+
24+
3. Deploy the controller to the cluster with the image specified by `IMG`:
25+
26+
```sh
27+
make deploy IMG=<some-registry>/project:tag
28+
```
29+
30+
### Uninstall CRDs
31+
To delete the CRDs from the cluster:
32+
33+
```sh
34+
make uninstall
35+
```
36+
37+
### Undeploy controller
38+
UnDeploy the controller to the cluster:
39+
40+
```sh
41+
make undeploy
42+
```
43+
44+
## Contributing
45+
// TODO(user): Add detailed information on how you would like others to contribute to this project
46+
47+
### How it works
48+
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)
49+
50+
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/)
51+
which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster
52+
53+
### Test It Out
54+
1. Install the CRDs into the cluster:
55+
56+
```sh
57+
make install
58+
```
59+
60+
2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
61+
62+
```sh
63+
make run
64+
```
65+
66+
**NOTE:** You can also run this in one step by running: `make install run`
67+
68+
### Modifying the API definitions
69+
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
70+
71+
```sh
72+
make manifests
73+
```
74+
75+
**NOTE:** Run `make --help` for more information on all potential `make` targets
76+
77+
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)
78+
79+
## License
80+
81+
Copyright 2022 The Kubernetes authors.
82+
83+
Licensed under the Apache License, Version 2.0 (the "License");
84+
you may not use this file except in compliance with the License.
85+
You may obtain a copy of the License at
86+
87+
http://www.apache.org/licenses/LICENSE-2.0
88+
89+
Unless required by applicable law or agreed to in writing, software
90+
distributed under the License is distributed on an "AS IS" BASIS,
91+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92+
See the License for the specific language governing permissions and
93+
limitations under the License.
94+

docs/book/src/component-config-tutorial/testdata/project/api/v2/projectconfig_types.go

+29-1
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,47 @@ import (
2424
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2525
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2626

27+
// ProjectConfigSpec defines the desired state of ProjectConfig
28+
type ProjectConfigSpec struct {
29+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
30+
// Important: Run "make" to regenerate code after modifying this file
31+
32+
// Foo is an example field of ProjectConfig. Edit projectconfig_types.go to remove/update
33+
Foo string `json:"foo,omitempty"`
34+
}
35+
36+
// ProjectConfigStatus defines the observed state of ProjectConfig
37+
type ProjectConfigStatus struct {
38+
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
39+
// Important: Run "make" to regenerate code after modifying this file
40+
}
41+
2742
//+kubebuilder:object:root=true
43+
//+kubebuilder:subresource:status
2844

2945
// ProjectConfig is the Schema for the projectconfigs API
3046
type ProjectConfig struct {
3147
metav1.TypeMeta `json:",inline"`
3248
metav1.ObjectMeta `json:"metadata,omitempty"`
3349

50+
Spec ProjectConfigSpec `json:"spec,omitempty"`
51+
Status ProjectConfigStatus `json:"status,omitempty"`
52+
3453
// ControllerManagerConfigurationSpec returns the contfigurations for controllers
3554
cfg.ControllerManagerConfigurationSpec `json:",inline"`
3655

3756
ClusterName string `json:"clusterName,omitempty"`
3857
}
3958

59+
//+kubebuilder:object:root=true
60+
61+
// ProjectConfigList contains a list of ProjectConfig
62+
type ProjectConfigList struct {
63+
metav1.TypeMeta `json:",inline"`
64+
metav1.ListMeta `json:"metadata,omitempty"`
65+
Items []ProjectConfig `json:"items"`
66+
}
67+
4068
func init() {
41-
SchemeBuilder.Register(&ProjectConfig{})
69+
SchemeBuilder.Register(&ProjectConfig{}, &ProjectConfigList{})
4270
}

docs/book/src/component-config-tutorial/testdata/project/api/v2/zz_generated.deepcopy.go

+64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/book/src/component-config-tutorial/testdata/project/config/crd/bases/config.tutorial.kubebuilder.io_projectconfigs.yaml

+13
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,17 @@ spec:
143143
disable the metrics serving.
144144
type: string
145145
type: object
146+
spec:
147+
description: ProjectConfigSpec defines the desired state of ProjectConfig
148+
properties:
149+
foo:
150+
description: Foo is an example field of ProjectConfig. Edit projectconfig_types.go
151+
to remove/update
152+
type: string
153+
type: object
154+
status:
155+
description: ProjectConfigStatus defines the observed state of ProjectConfig
156+
type: object
146157
syncPeriod:
147158
description: SyncPeriod determines the minimum frequency at which watched
148159
resources are reconciled. A lower period will correct entropy more quickly,
@@ -174,6 +185,8 @@ spec:
174185
type: object
175186
served: true
176187
storage: true
188+
subresources:
189+
status: {}
177190
status:
178191
acceptedNames:
179192
kind: ""

docs/book/src/component-config-tutorial/testdata/project/config/default/manager_auth_proxy_patch.yaml

+9-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ spec:
1010
spec:
1111
containers:
1212
- name: kube-rbac-proxy
13-
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0
13+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.11.0
1414
args:
1515
- "--secure-listen-address=0.0.0.0:8443"
1616
- "--upstream=http://127.0.0.1:8080/"
1717
- "--logtostderr=true"
18-
- "--v=10"
18+
- "--v=0"
1919
ports:
2020
- containerPort: 8443
2121
protocol: TCP
2222
name: https
23+
resources:
24+
limits:
25+
cpu: 500m
26+
memory: 128Mi
27+
requests:
28+
cpu: 5m
29+
memory: 64Mi

docs/book/src/component-config-tutorial/testdata/project/config/manager/controller_manager_config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
apiVersion: config.tutorial.kubebuilder.io/v2
2-
kind: ProjectConfig
1+
apiVersion: controller-runtime.sigs.k8s.io/v1alpha1
2+
kind: ControllerManagerConfig
33
health:
44
healthProbeBindAddress: :8081
55
metrics:

docs/book/src/component-config-tutorial/testdata/project/config/manager/manager.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ spec:
4545
port: 8081
4646
initialDelaySeconds: 5
4747
periodSeconds: 10
48+
# TODO(user): Configure the resources accordingly based on the project requirements.
49+
# More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
4850
resources:
4951
limits:
50-
cpu: 200m
51-
memory: 100Mi
52+
cpu: 500m
53+
memory: 128Mi
5254
requests:
53-
cpu: 100m
54-
memory: 20Mi
55+
cpu: 10m
56+
memory: 64Mi
5557
serviceAccountName: controller-manager
5658
terminationGracePeriodSeconds: 10

0 commit comments

Comments
 (0)