Skip to content

Commit 863f9c8

Browse files
committed
docs: update cronjob-tutorial manually
1 parent 5a34384 commit 863f9c8

File tree

16 files changed

+388
-350
lines changed

16 files changed

+388
-350
lines changed

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Image URL to use all building/pushing image targets
33
IMG ?= controller:latest
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5-
ENVTEST_K8S_VERSION = 1.25.0
5+
ENVTEST_K8S_VERSION = 1.26.1
66

77
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
88
ifeq (,$(shell go env GOBIN))
@@ -61,7 +61,7 @@ test: manifests generate fmt vet envtest ## Run tests.
6161
##@ Build
6262

6363
.PHONY: build
64-
build: generate fmt vet ## Build manager binary.
64+
build: manifests generate fmt vet ## Build manager binary.
6565
go build -o bin/manager main.go
6666

6767
.PHONY: run
@@ -92,7 +92,7 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla
9292
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
9393
- docker buildx create --name project-v3-builder
9494
docker buildx use project-v3-builder
95-
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross
95+
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
9696
- docker buildx rm project-v3-builder
9797
rm Dockerfile.cross
9898

@@ -132,19 +132,24 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
132132
ENVTEST ?= $(LOCALBIN)/setup-envtest
133133

134134
## Tool Versions
135-
KUSTOMIZE_VERSION ?= v4.5.7
136-
CONTROLLER_TOOLS_VERSION ?= v0.10.0
135+
KUSTOMIZE_VERSION ?= v3.8.7
136+
CONTROLLER_TOOLS_VERSION ?= v0.11.1
137137

138138
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
139139
.PHONY: kustomize
140-
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
140+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
141141
$(KUSTOMIZE): $(LOCALBIN)
142-
test -s $(LOCALBIN)/kustomize || { curl -Ss $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }
142+
@if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
143+
echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
144+
rm -rf $(LOCALBIN)/kustomize; \
145+
fi
146+
test -s $(LOCALBIN)/kustomize || { curl -Ss $(KUSTOMIZE_INSTALL_SCRIPT) --output install_kustomize.sh && bash install_kustomize.sh $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); rm install_kustomize.sh; }
143147

144148
.PHONY: controller-gen
145-
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
149+
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
146150
$(CONTROLLER_GEN): $(LOCALBIN)
147-
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
151+
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
152+
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
148153

149154
.PHONY: envtest
150155
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Code generated by tool. DO NOT EDIT.
2+
# This file is used to track the info used to scaffold your project
3+
# and allow the plugins properly work.
4+
# More info: https://book.kubebuilder.io/reference/project-config.html
15
domain: tutorial.kubebuilder.io
26
layout:
37
- go.kubebuilder.io/v3

docs/book/src/cronjob-tutorial/testdata/project/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ kubectl apply -f config/samples/
1616
```
1717

1818
2. Build and push your image to the location specified by `IMG`:
19-
19+
2020
```sh
2121
make docker-build docker-push IMG=<some-registry>/project:tag
2222
```
23-
23+
2424
3. Deploy the controller to the cluster with the image specified by `IMG`:
2525

2626
```sh
@@ -35,7 +35,7 @@ make uninstall
3535
```
3636

3737
### Undeploy controller
38-
UnDeploy the controller to the cluster:
38+
UnDeploy the controller from the cluster:
3939

4040
```sh
4141
make undeploy
@@ -45,10 +45,10 @@ make undeploy
4545
// TODO(user): Add detailed information on how you would like others to contribute to this project
4646

4747
### How it works
48-
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/)
48+
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
4949

50-
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/)
51-
which provides a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster
50+
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/),
51+
which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
5252

5353
### Test It Out
5454
1. Install the CRDs into the cluster:
@@ -78,7 +78,7 @@ More information can be found via the [Kubebuilder Documentation](https://book.k
7878

7979
## License
8080

81-
Copyright 2022 The Kubernetes authors.
81+
Copyright 2023 The Kubernetes authors.
8282

8383
Licensed under the Apache License, Version 2.0 (the "License");
8484
you may not use this file except in compliance with the License.

docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Kubernetes authors.
2+
Copyright 2023 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Kubernetes authors.
2+
Copyright 2023 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -54,7 +54,7 @@ This marker is responsible for generating a mutating webhook manifest.
5454
The meaning of each marker can be found [here](/reference/markers/webhook.md).
5555
*/
5656

57-
//+kubebuilder:webhook:path=/mutate-batch-tutorial-kubebuilder-io-v1-cronjob,mutating=true,failurePolicy=fail,groups=batch.tutorial.kubebuilder.io,resources=cronjobs,verbs=create;update,versions=v1,name=mcronjob.kb.io,sideEffects=None,admissionReviewVersions=v1
57+
//+kubebuilder:webhook:path=/mutate-batch-tutorial-kubebuilder-io-v1-cronjob,mutating=true,failurePolicy=fail,sideEffects=None,groups=batch.tutorial.kubebuilder.io,resources=cronjobs,verbs=create;update,versions=v1,name=mcronjob.kb.io,admissionReviewVersions=v1
5858

5959
/*
6060
We use the `webhook.Defaulter` interface to set defaults to our CRD.

docs/book/src/cronjob-tutorial/testdata/project/api/v1/groupversion_info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Kubernetes authors.
2+
Copyright 2023 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

docs/book/src/cronjob-tutorial/testdata/project/api/v1/webhook_suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2022 The Kubernetes authors.
2+
Copyright 2023 The Kubernetes authors.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ var cancel context.CancelFunc
5151
func TestAPIs(t *testing.T) {
5252
RegisterFailHandler(Fail)
5353

54-
RunSpecs(t, "Controller Suite")
54+
RunSpecs(t, "Webhook Suite")
5555
}
5656

5757
var _ = BeforeSuite(func() {

docs/book/src/cronjob-tutorial/testdata/project/api/v1/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/book/src/cronjob-tutorial/testdata/project/config/certmanager/kustomizeconfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This configuration is for teaching kustomize how to update name ref and var substitution
1+
# This configuration is for teaching kustomize how to update name ref and var substitution
22
nameReference:
33
- kind: Issuer
44
group: cert-manager.io

0 commit comments

Comments
 (0)