Skip to content

Commit b73b99e

Browse files
committed
docs: Fix typos and regenerate samples
Corrects various typographical errors in documentation source files and code comments. Runs 'make generate-docs' to ensure generated documentation, tutorials, and sample project files reflect the corrections and are up-to-date. Addresses generation script conflicts caused by specific typo fixes.
1 parent 23b74ea commit b73b99e

File tree

30 files changed

+120
-122
lines changed

30 files changed

+120
-122
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ help: ## Display this help.
4343

4444
.PHONY: manifests
4545
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
46-
# Note that the option maxDescLen=0 was added in the default scaffold in order to sort out the issue
47-
# Too long: must have at most 262144 bytes. By using kubectl apply to create / update resources an annotation
46+
# Note that the option maxDescLen=0 was added in the default scaffold to sort out the issue
47+
# Too long: must have at most 262144 bytes. By using kubectl to create/update resources an annotation
4848
# is created by K8s API to store the latest version of the resource ( kubectl.kubernetes.io/last-applied-configuration).
4949
# However, it has a size limit and if the CRD is too big with so many long descriptions as this one it will cause the failure.
5050
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ import (
4848
4949
- A deadline for starting jobs (if we miss this deadline, we'll just wait till
5050
the next scheduled time)
51-
- What to do if multiple jobs would run at once (do we wait? stop the old one? run both?)
51+
- What to do if multiple jobs would run at once (do we wait? stop the old one? or run both?)
5252
- A way to pause the running of a CronJob, in case something's wrong with it
5353
- Limits on old job history
5454
55-
Remember, since we never read our own status, we need to have some other way to
56-
keep track of whether a job has run. We can use at least one old job to do
55+
Remember, since we never read our status, we need to have another way to track whether a job has run. We can use at least one old job to do
5756
this.
5857
5958
We'll use several markers (`// +comment`) to specify additional metadata. These
@@ -79,8 +78,8 @@ type CronJobSpec struct {
7978
// Specifies how to treat concurrent executions of a Job.
8079
// Valid values are:
8180
// - "Allow" (default): allows CronJobs to run concurrently;
82-
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet;
83-
// - "Replace": cancels currently running job and replaces it with a new one
81+
// - "Forbid": forbids concurrent runs, skipping the next run if the previous run hasn't finished yet;
82+
// - "Replace": cancels the currently running job and replaces it with a new one
8483
// +optional
8584
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`
8685

@@ -94,15 +93,15 @@ type CronJobSpec struct {
9493

9594
// +kubebuilder:validation:Minimum=0
9695

97-
// The number of successful finished jobs to retain.
96+
// The number of successfull finished jobs to retain.
9897
// This is a pointer to distinguish between explicit zero and not specified.
9998
// +optional
10099
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"`
101100

102101
// +kubebuilder:validation:Minimum=0
103102

104103
// The number of failed finished jobs to retain.
105-
// This is a pointer to distinguish between explicit zero and not specified.
104+
// This pointer distinguishes between explicit zero and not specified.
106105
// +optional
107106
FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"`
108107
}
@@ -125,16 +124,16 @@ const (
125124
// AllowConcurrent allows CronJobs to run concurrently.
126125
AllowConcurrent ConcurrencyPolicy = "Allow"
127126

128-
// ForbidConcurrent forbids concurrent runs, skipping next run if previous
127+
// ForbidConcurrent forbids concurrent runs, skipping the next run if the previous
129128
// hasn't finished yet.
130129
ForbidConcurrent ConcurrencyPolicy = "Forbid"
131130

132-
// ReplaceConcurrent cancels currently running job and replaces it with a new one.
131+
// ReplaceConcurrent cancels the currently running job and replaces it with a new one.
133132
ReplaceConcurrent ConcurrencyPolicy = "Replace"
134133
)
135134

136135
/*
137-
Next, let's design our status, which holds observed state. It contains any information
136+
Next, let's design our status, which holds the observed state. It contains any information
138137
we want users or other controllers to be able to easily obtain.
139138
140139
We'll keep a list of actively running jobs, as well as the last time that we successfully

docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ group's package (`batchv1`) to our scheme. This means that we can use those
5252
objects in our controller.
5353
5454
If we would be using any other CRD we would have to add their scheme the same way.
55-
Builtin types such as Job have their scheme added by `clientgoscheme`.
55+
Built-in types such as Job have their scheme added by `clientgoscheme`.
5656
*/
5757

5858
var (

docs/book/src/cronjob-tutorial/testdata/project/config/samples/batch_v1_cronjob.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
spec:
99
schedule: "*/1 * * * *"
1010
startingDeadlineSeconds: 60
11-
concurrencyPolicy: Allow # explicitly specify, but Allow is also default.
11+
concurrencyPolicy: Allow # explicitly specify, but Allow is also the default.
1212
jobTemplate:
1313
spec:
1414
template:

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
// +kubebuilder:docs-gen:collapse=Apache License
1717

1818
/*
19-
We'll start out with some imports. You'll see below that we'll need a few more imports
19+
We'll start with some imports. You'll see below that we'll need a few more imports
2020
than those scaffolded for us. We'll talk about each one when we use it.
2121
*/
2222

@@ -115,7 +115,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
115115
var cronJob batchv1.CronJob
116116
if err := r.Get(ctx, req.NamespacedName, &cronJob); err != nil {
117117
log.Error(err, "unable to fetch CronJob")
118-
// we'll ignore not-found errors, since they can't be fixed by an immediate
118+
// We'll ignore not-found errors, since they can't be fixed by an immediate
119119
// requeue (we'll need to wait for a new notification), and we can get them
120120
// on deleted requests.
121121
return ctrl.Result{}, client.IgnoreNotFound(err)
@@ -126,7 +126,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
126126
127127
To fully update our status, we'll need to list all child jobs in this namespace that belong to this CronJob.
128128
Similarly to Get, we can use the List method to list the child jobs. Notice that we use variadic options to
129-
set the namespace and field match (which is actually an index lookup that we set up below).
129+
set the namespace and field match (which is an index lookup that we set up below).
130130
*/
131131
var childJobs kbatch.JobList
132132
if err := r.List(ctx, &childJobs, client.InNamespace(req.Namespace), client.MatchingFields{jobOwnerKey: req.Name}); err != nil {
@@ -144,7 +144,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
144144
looking these up can become quite slow as we have to filter through all of them. For a more efficient lookup,
145145
these jobs will be indexed locally on the controller's name. A jobOwnerKey field is added to the
146146
cached job objects. This key references the owning controller and functions as the index. Later in this
147-
document we will configure the manager to actually index this field.</p>
147+
document we will configure the manager to index this field.</p>
148148
149149
</aside>
150150
@@ -159,7 +159,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
159159
conditions. We'll put that logic in a helper to make our code cleaner.
160160
*/
161161

162-
// find the active list of jobs
162+
// Find the active list of jobs
163163
var activeJobs []*kbatch.Job
164164
var successfulJobs []*kbatch.Job
165165
var failedJobs []*kbatch.Job
@@ -253,7 +253,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
253253
subresource, we'll use the `Status` part of the client, with the `Update`
254254
method.
255255
256-
The status subresource ignores changes to spec, so it's less likely to conflict
256+
The status subresource ignores changes to the spec, so it's less likely to conflict
257257
with any other updates, and can have separate permissions.
258258
*/
259259
if err := r.Status().Update(ctx, &cronJob); err != nil {
@@ -379,7 +379,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
379379
// all start running with no further intervention (if the scheduledJob
380380
// allows concurrency and late starts).
381381
//
382-
// However, if there is a bug somewhere, or incorrect clock
382+
// However, if there is a bug somewhere, or an incorrect clock
383383
// on controller's server or apiservers (for setting creationTimestamp)
384384
// then there could be so many missed start times (it could be off
385385
// by decades or more), that it would eat up all the CPU and memory
@@ -395,19 +395,19 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
395395
}
396396
// +kubebuilder:docs-gen:collapse=getNextSchedule
397397

398-
// figure out the next times that we need to create
398+
// Figure out the next times that we need to create
399399
// jobs at (or anything we missed).
400400
missedRun, nextRun, err := getNextSchedule(&cronJob, r.Now())
401401
if err != nil {
402402
log.Error(err, "unable to figure out CronJob schedule")
403-
// we don't really care about requeuing until we get an update that
403+
// we don't care about requeuing until we get an update that
404404
// fixes the schedule, so don't return an error
405405
return ctrl.Result{}, nil
406406
}
407407

408408
/*
409409
We'll prep our eventual request to requeue until the next job, and then figure
410-
out if we actually need to run.
410+
out if we need to run.
411411
*/
412412
scheduledResult := ctrl.Result{RequeueAfter: nextRun.Sub(r.Now())} // save this so we can re-use it elsewhere
413413
log = log.WithValues("now", r.Now(), "next run", nextRun)
@@ -435,7 +435,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
435435
}
436436

437437
/*
438-
If we actually have to run a job, we'll need to either wait till existing ones finish,
438+
If we have to run a job, we'll need to either wait till existing ones finish,
439439
replace the existing ones, or just add new ones. If our information is out of date due
440440
to cache delay, we'll get a requeue when we get up-to-date information.
441441
*/
@@ -458,7 +458,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
458458
}
459459

460460
/*
461-
Once we've figured out what to do with existing jobs, we'll actually create our desired job
461+
Once we've figured out what to do with existing jobs, we'll create our desired job
462462
*/
463463

464464
/*
@@ -500,7 +500,7 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
500500
}
501501
// +kubebuilder:docs-gen:collapse=constructJobForCronJob
502502

503-
// actually make the job...
503+
// make the job...
504504
job, err := constructJobForCronJob(&cronJob, missedRun)
505505
if err != nil {
506506
log.Error(err, "unable to construct job from template")
@@ -531,11 +531,11 @@ func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
531531
/*
532532
### Setup
533533
534-
Finally, we'll update our setup. In order to allow our reconciler to quickly
535-
look up Jobs by their owner, we'll need an index. We declare an index key that
534+
Finally, we'll update our setup. To allow our reconciler to quickly
535+
lookup Jobs by their owner, we'll need an index. We declare an index key that
536536
we can later use with the client as a pseudo-field name, and then describe how to
537537
extract the indexed value from the Job object. The indexer will automatically take
538-
care of namespaces for us, so we just have to extract the owner name if the Job has
538+
care of namespaces for us, so we just have to extract the owner's name if the Job has
539539
a CronJob owner.
540540
541541
Additionally, we'll inform the manager that this controller owns some Jobs, so that it

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/cronjob_controller_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import (
4242
// +kubebuilder:docs-gen:collapse=Imports
4343

4444
/*
45-
The first step to writing a simple integration test is to actually create an instance of CronJob you can run tests against.
45+
The first step to writing a simple integration test is to create an instance of CronJob you can run tests against.
4646
Note that to create a CronJob, you’ll need to create a stub CronJob struct that contains your CronJob’s specifications.
4747
4848
Note that when we create a stub CronJob, the CronJob also needs stubs of its required downstream objects.
@@ -104,7 +104,7 @@ var _ = Describe("CronJob controller", func() {
104104
105105
`Eventually()` will repeatedly run the function provided as an argument every interval seconds until
106106
(a) the assertions done by the passed-in `Gomega` succeed, or
107-
(b) the number of attempts * interval period exceed the provided timeout value.
107+
(b) the number of attempts * interval period exceeds the provided timeout value.
108108
109109
In the examples below, timeout and interval are Go Duration values of our choosing.
110110
*/
@@ -121,7 +121,7 @@ var _ = Describe("CronJob controller", func() {
121121
/*
122122
Now that we've created a CronJob in our test cluster, the next step is to write a test that actually tests our CronJob controller’s behavior.
123123
Let’s test the CronJob controller’s logic responsible for updating CronJob.Status.Active with actively running jobs.
124-
We’ll verify that when a CronJob has a single active downstream Job, its CronJob.Status.Active field contains a reference to this Job.
124+
We’ll verify that when a CronJob has a single active downstream Job, it's CronJob.Status.The active field contains a reference to this Job.
125125
126126
First, we should get the test CronJob we created earlier, and verify that it currently does not have any active jobs.
127127
We use Gomega's `Consistently()` check here to ensure that the active job count remains 0 over a duration of time.
@@ -132,7 +132,7 @@ var _ = Describe("CronJob controller", func() {
132132
g.Expect(createdCronjob.Status.Active).To(BeEmpty())
133133
}, duration, interval).Should(Succeed())
134134
/*
135-
Next, we actually create a stubbed Job that will belong to our CronJob, as well as its downstream template specs.
135+
Next, we create a stubbed Job that will belong to our CronJob, as well as its downstream template specs.
136136
We set the Job's status's "Active" count to 2 to simulate the Job running two pods, which means the Job is actively running.
137137
138138
We then take the stubbed Job and set its owner reference to point to our test CronJob.

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/suite_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ var _ = BeforeSuite(func() {
119119
Expect(k8sClient).NotTo(BeNil())
120120

121121
/*
122-
One thing that this autogenerated file is missing, however, is a way to actually start your controller.
122+
One thing that this autogenerated file is missing, however, is a way to start your controller.
123123
The code above will set up a client for interacting with your custom Kind,
124124
but will not be able to test your controller behavior.
125125
If you want to test your custom controller logic, you’ll need to add some familiar-looking manager logic
@@ -137,7 +137,7 @@ var _ = BeforeSuite(func() {
137137
and it'd be easy to make mistakes.
138138
139139
Note that we keep the reconciler running against the manager's cache client, though -- we want our controller to
140-
behave as it would in production, and we use features of the cache (like indices) in our controller which aren't
140+
behave as it would in production, and we use features of the cache (like indices) in our controller that aren't
141141
available when talking directly to the API server.
142142
*/
143143
k8sManager, err := ctrl.NewManager(cfg, ctrl.Options{
@@ -159,7 +159,7 @@ var _ = BeforeSuite(func() {
159159
})
160160

161161
/*
162-
Kubebuilder also generates boilerplate functions for cleaning up envtest and actually running your test files in your controllers/ directory.
162+
Kubebuilder also generates boilerplate functions for cleaning up envtest and running your test files in your controllers/ directory.
163163
You won't need to touch these.
164164
*/
165165

docs/book/src/cronjob-tutorial/testdata/project/test/e2e/e2e_suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ var (
3636
skipCertManagerInstall = os.Getenv("CERT_MANAGER_INSTALL_SKIP") == "true"
3737
// isCertManagerAlreadyInstalled will be set true when CertManager CRDs be found on the cluster
3838
isCertManagerAlreadyInstalled = false
39-
// isPrometheusOperatorAlreadyInstalled will be set true when prometheus CRDs be found on the cluster
39+
// isPrometheusOperatorAlreadyInstalled will be set to be true when prometheus CRDs are found on the cluster
4040
isPrometheusOperatorAlreadyInstalled = false
4141

4242
// projectImage is the name of the image which will be build and loaded
@@ -71,7 +71,7 @@ var _ = BeforeSuite(func() {
7171

7272
// The tests-e2e are intended to run on a temporary cluster that is created and destroyed for testing.
7373
// To prevent errors when tests run in environments with Prometheus already installed,
74-
// we check for its presence before execution.
74+
// We check for its presence before execution.
7575
// Setup Prometheus before the suite if not already installed
7676
By("checking if prometheus is installed already")
7777
isPrometheusOperatorAlreadyInstalled = utils.IsPrometheusCRDsInstalled()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ help: ## Display this help.
4343

4444
.PHONY: manifests
4545
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
46-
# Note that the option maxDescLen=0 was added in the default scaffold in order to sort out the issue
47-
# Too long: must have at most 262144 bytes. By using kubectl apply to create / update resources an annotation
46+
# Note that the option maxDescLen=0 was added in the default scaffold to sort out the issue
47+
# Too long: must have at most 262144 bytes. By using kubectl to create/update resources an annotation
4848
# is created by K8s API to store the latest version of the resource ( kubectl.kubernetes.io/last-applied-configuration).
4949
# However, it has a size limit and if the CRD is too big with so many long descriptions as this one it will cause the failure.
5050
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ type CronJobSpec struct {
5151
// Specifies how to treat concurrent executions of a Job.
5252
// Valid values are:
5353
// - "Allow" (default): allows CronJobs to run concurrently;
54-
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet;
55-
// - "Replace": cancels currently running job and replaces it with a new one
54+
// - "Forbid": forbids concurrent runs, skipping the next run if the previous run hasn't finished yet;
55+
// - "Replace": cancels the currently running job and replaces it with a new one
5656
// +optional
5757
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`
5858

@@ -66,15 +66,15 @@ type CronJobSpec struct {
6666

6767
// +kubebuilder:validation:Minimum=0
6868

69-
// The number of successful finished jobs to retain.
70-
// This is a pointer to distinguish between explicit zero and not specified.
69+
// The number of successfully finished jobs to retain.
70+
// This pointer distinguishes between explicit zero and not specified.
7171
// +optional
7272
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty"`
7373

7474
// +kubebuilder:validation:Minimum=0
7575

7676
// The number of failed finished jobs to retain.
77-
// This is a pointer to distinguish between explicit zero and not specified.
77+
// This pointer distinguishes between explicit zero and not specified.
7878
// +optional
7979
FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty"`
8080
}
@@ -90,11 +90,11 @@ const (
9090
// AllowConcurrent allows CronJobs to run concurrently.
9191
AllowConcurrent ConcurrencyPolicy = "Allow"
9292

93-
// ForbidConcurrent forbids concurrent runs, skipping next run if previous
93+
// ForbidConcurrent forbids concurrent runs, skipping the next run if the previous
9494
// hasn't finished yet.
9595
ForbidConcurrent ConcurrencyPolicy = "Forbid"
9696

97-
// ReplaceConcurrent cancels currently running job and replaces it with a new one.
97+
// ReplaceConcurrent cancels the currently running job and replaces it with a new one.
9898
ReplaceConcurrent ConcurrencyPolicy = "Replace"
9999
)
100100

@@ -107,7 +107,7 @@ type CronJobStatus struct {
107107
// +optional
108108
Active []corev1.ObjectReference `json:"active,omitempty"`
109109

110-
// Information when was the last time the job was successfully scheduled.
110+
// Information when was the last time the job was successfully scheduled ?
111111
// +optional
112112
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty"`
113113
}

docs/book/src/multiversion-tutorial/testdata/project/config/samples/batch_v1_cronjob.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ metadata:
88
spec:
99
schedule: "*/1 * * * *"
1010
startingDeadlineSeconds: 60
11-
concurrencyPolicy: Allow # explicitly specify, but Allow is also default.
11+
concurrencyPolicy: Allow # explicitly specify, but Allow is also the default.
1212
jobTemplate:
1313
spec:
1414
template:

0 commit comments

Comments
 (0)