Skip to content

Commit f4cfc8e

Browse files
only install -kiss
1 parent fe80619 commit f4cfc8e

File tree

39 files changed

+99
-219
lines changed

39 files changed

+99
-219
lines changed

.github/workflows/lint-sample.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ jobs:
4646
with:
4747
version: v2.2.2
4848
working-directory: ${{ matrix.folder }}
49-
install-mode: goinstall
5049
- name: Run linter via makefile target
5150
working-directory: ${{ matrix.folder }}
5251
run: make lint

docs/book/src/cronjob-tutorial/testdata/project/.github/workflows/lint.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ jobs:
2121
uses: golangci/golangci-lint-action@v8
2222
with:
2323
version: v2.2.2
24-
install-mode: goinstall

docs/book/src/cronjob-tutorial/testdata/project/.golangci.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ linters:
3131
kubeapilinter:
3232
path: "./bin/kube-api-linter.so"
3333
description: "Kube API Linter plugin"
34-
original-url: "sigs.k8s.io/kube-api-linter"
35-
settings:
36-
linters: { }
37-
lintersConfig: { }
3834
exclusions:
3935
generated: lax
4036
rules:

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -225,22 +225,20 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
225225
$(GOLANGCI_LINT): $(LOCALBIN)
226226
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
227227

228-
# To lint Kubernetes API definitions.
228+
# To lint Kubernetes API definitions (CRDs).
229229
# More info: https://github.com/kubernetes-sigs/kube-api-linter
230+
# Build kube-api-linter plugin (used by golangci-lint as a custom plugin)
230231
KUBE_API_LINTER_PLUGIN := $(LOCALBIN)/kube-api-linter.so
231-
KUBE_API_LINTER_BUILD_DIR := ./hack/kube-api-linter
232232

233233
.PHONY: kube-api-linter
234-
kube-api-linter: $(KUBE_API_LINTER_PLUGIN) ## Build the kube-api-linter plugin
235-
$(KUBE_API_LINTER_PLUGIN): $(KUBE_API_LINTER_BUILD_DIR)/go.mod
236-
cd $(KUBE_API_LINTER_BUILD_DIR) && \
237-
go build -buildmode=plugin -o "$(abspath $(KUBE_API_LINTER_PLUGIN))" sigs.k8s.io/kube-api-linter/pkg/plugin
238-
$(KUBE_API_LINTER_BUILD_DIR)/go.mod:
239-
@echo "Setting up local module for kube-api-linter plugin..."
240-
mkdir -p $(KUBE_API_LINTER_BUILD_DIR)
241-
cd $(KUBE_API_LINTER_BUILD_DIR) && \
242-
go mod init local-kube-api-linter && \
243-
go get sigs.k8s.io/kube-api-linter@latest
234+
kube-api-linter: ## Build kube-api-linter plugin as .so
235+
@echo "Building kube-api-linter plugin..."
236+
rm -rf ./hack/kube-api-linter
237+
mkdir -p ./hack/kube-api-linter
238+
cd ./hack/kube-api-linter && \
239+
go mod init tmp-kube-api-linter && \
240+
go get sigs.k8s.io/kube-api-linter@latest && \
241+
go build -buildmode=plugin -o "$(KUBE_API_LINTER_PLUGIN)" sigs.k8s.io/kube-api-linter/pkg/plugin
244242

245243
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
246244
# $1 - target path with name of binary

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import (
6565
// CronJobSpec defines the desired state of CronJob
6666
type CronJobSpec struct {
6767
// schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
68+
// +kubebuilder:validation:MinLength=0
6869
// +required
6970
Schedule string `json:"schedule"`
7071

@@ -80,7 +81,6 @@ type CronJobSpec struct {
8081
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet;
8182
// - "Replace": cancels currently running job and replaces it with a new one
8283
// +optional
83-
// +kubebuilder:default:=Allow
8484
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`
8585

8686
// suspend tells the controller to suspend subsequent executions, it does
@@ -89,7 +89,6 @@ type CronJobSpec struct {
8989
Suspend *bool `json:"suspend,omitempty"`
9090

9191
// jobTemplate defines the job that will be created when executing a CronJob.
92-
// +required
9392
JobTemplate batchv1.JobTemplateSpec `json:"jobTemplate"`
9493

9594
// successfulJobsHistoryLimit defines the number of successful finished jobs to retain.
@@ -147,9 +146,6 @@ type CronJobStatus struct {
147146

148147
// active defines a list of pointers to currently running jobs.
149148
// +optional
150-
// +listType=atomic
151-
// +kubebuilder:validation:MaxItems=10
152-
// +kubebuilder:validation:MinItems=0
153149
Active []corev1.ObjectReference `json:"active,omitempty"`
154150

155151
// lastScheduleTime defines when was the last time the job was successfully scheduled.

docs/book/src/cronjob-tutorial/testdata/project/config/crd/bases/batch.tutorial.kubebuilder.io_cronjobs.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ spec:
2727
spec:
2828
properties:
2929
concurrencyPolicy:
30-
default: Allow
3130
enum:
3231
- Allow
3332
- Forbid
@@ -3799,6 +3798,7 @@ spec:
37993798
type: object
38003799
type: object
38013800
schedule:
3801+
minLength: 0
38023802
type: string
38033803
startingDeadlineSeconds:
38043804
format: int64
@@ -3835,10 +3835,7 @@ spec:
38353835
type: string
38363836
type: object
38373837
x-kubernetes-map-type: atomic
3838-
maxItems: 10
3839-
minItems: 0
38403838
type: array
3841-
x-kubernetes-list-type: atomic
38423839
lastScheduleTime:
38433840
format: date-time
38443841
type: string

docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/crd/batch.tutorial.kubebuilder.io_cronjobs.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ spec:
3333
spec:
3434
properties:
3535
concurrencyPolicy:
36-
default: Allow
3736
enum:
3837
- Allow
3938
- Forbid
@@ -3805,6 +3804,7 @@ spec:
38053804
type: object
38063805
type: object
38073806
schedule:
3807+
minLength: 0
38083808
type: string
38093809
startingDeadlineSeconds:
38103810
format: int64
@@ -3841,10 +3841,7 @@ spec:
38413841
type: string
38423842
type: object
38433843
x-kubernetes-map-type: atomic
3844-
maxItems: 10
3845-
minItems: 0
38463844
type: array
3847-
x-kubernetes-list-type: atomic
38483845
lastScheduleTime:
38493846
format: date-time
38503847
type: string

docs/book/src/cronjob-tutorial/testdata/project/dist/install.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ spec:
3535
spec:
3636
properties:
3737
concurrencyPolicy:
38-
default: Allow
3938
enum:
4039
- Allow
4140
- Forbid
@@ -3807,6 +3806,7 @@ spec:
38073806
type: object
38083807
type: object
38093808
schedule:
3809+
minLength: 0
38103810
type: string
38113811
startingDeadlineSeconds:
38123812
format: int64
@@ -3843,10 +3843,7 @@ spec:
38433843
type: string
38443844
type: object
38453845
x-kubernetes-map-type: atomic
3846-
maxItems: 10
3847-
minItems: 0
38483846
type: array
3849-
x-kubernetes-list-type: atomic
38503847
lastScheduleTime:
38513848
format: date-time
38523849
type: string

docs/book/src/cronjob-tutorial/testdata/project/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ require (
99
k8s.io/api v0.33.0
1010
k8s.io/apimachinery v0.33.0
1111
k8s.io/client-go v0.33.0
12-
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
1312
sigs.k8s.io/controller-runtime v0.21.0
1413
)
1514

@@ -90,6 +89,7 @@ require (
9089
k8s.io/component-base v0.33.0 // indirect
9190
k8s.io/klog/v2 v2.130.1 // indirect
9291
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
92+
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
9393
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect
9494
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
9595
sigs.k8s.io/randfill v1.0.0 // indirect

docs/book/src/cronjob-tutorial/testdata/project/internal/webhook/v1/cronjob_webhook_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
batchv1 "tutorial.kubebuilder.io/project/api/v1"
2424
// TODO (user): Add any additional imports if needed
25-
"k8s.io/utils/ptr"
2625
)
2726

2827
var _ = Describe("CronJob Webhook", func() {
@@ -41,8 +40,8 @@ var _ = Describe("CronJob Webhook", func() {
4140
Spec: batchv1.CronJobSpec{
4241
Schedule: schedule,
4342
ConcurrencyPolicy: batchv1.AllowConcurrent,
44-
SuccessfulJobsHistoryLimit: ptr.To(int32(3)),
45-
FailedJobsHistoryLimit: ptr.To(int32(1)),
43+
SuccessfulJobsHistoryLimit: new(int32),
44+
FailedJobsHistoryLimit: new(int32),
4645
},
4746
}
4847
*obj.Spec.SuccessfulJobsHistoryLimit = 3
@@ -52,8 +51,8 @@ var _ = Describe("CronJob Webhook", func() {
5251
Spec: batchv1.CronJobSpec{
5352
Schedule: schedule,
5453
ConcurrencyPolicy: batchv1.AllowConcurrent,
55-
SuccessfulJobsHistoryLimit: ptr.To(int32(3)),
56-
FailedJobsHistoryLimit: ptr.To(int32(1)),
54+
SuccessfulJobsHistoryLimit: new(int32),
55+
FailedJobsHistoryLimit: new(int32),
5756
},
5857
}
5958
*oldObj.Spec.SuccessfulJobsHistoryLimit = 3

0 commit comments

Comments
 (0)