Skip to content

Commit 272c9b2

Browse files
authored
Merge branch 'master' into feature/add-if-not-exists-action
2 parents 849a78f + 98bc8f4 commit 272c9b2

File tree

95 files changed

+1307
-298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1307
-298
lines changed

.github/workflows/lint-sample.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Run linter
4444
uses: golangci/golangci-lint-action@v8
4545
with:
46-
version: v2.2.2
46+
version: v2.3.0
4747
working-directory: ${{ matrix.folder }}
4848
- name: Run linter via makefile target
4949
working-directory: ${{ matrix.folder }}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ yamllint:
127127
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
128128
golangci-lint:
129129
@[ -f $(GOLANGCI_LINT) ] || { \
130-
GOBIN=$(shell pwd)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.2.2 ;\
130+
GOBIN=$(shell pwd)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.3.0 ;\
131131
}
132132

133133
.PHONY: apidiff

cmd/cmd.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20-
"github.com/sirupsen/logrus"
20+
"log"
21+
"log/slog"
22+
"os"
23+
2124
"github.com/spf13/afero"
2225

2326
"sigs.k8s.io/kubebuilder/v4/pkg/cli"
2427
cfgv3 "sigs.k8s.io/kubebuilder/v4/pkg/config/v3"
28+
"sigs.k8s.io/kubebuilder/v4/pkg/logging"
2529
"sigs.k8s.io/kubebuilder/v4/pkg/machinery"
2630
"sigs.k8s.io/kubebuilder/v4/pkg/plugin"
2731
kustomizecommonv2 "sigs.k8s.io/kubebuilder/v4/pkg/plugins/common/kustomize/v2"
@@ -33,8 +37,14 @@ import (
3337
)
3438

3539
func init() {
36-
// Disable timestamps on the default TextFormatter
37-
logrus.SetFormatter(&logrus.TextFormatter{DisableTimestamp: true})
40+
opts := logging.HandlerOptions{
41+
SlogOpts: slog.HandlerOptions{
42+
Level: slog.LevelInfo,
43+
},
44+
}
45+
handler := logging.NewHandler(os.Stdout, opts)
46+
logger := slog.New(handler)
47+
slog.SetDefault(logger)
3848
}
3949

4050
// Run bootstraps & runs the CLI
@@ -50,7 +60,7 @@ func Run() {
5060
}
5161
externalPlugins, err := cli.DiscoverExternalPlugins(fs.FS)
5262
if err != nil {
53-
logrus.Error(err)
63+
slog.Error("error discovering external plugins", "error", err)
5464
}
5565

5666
c, err := cli.New(
@@ -71,9 +81,9 @@ func Run() {
7181
cli.WithCompletion(),
7282
)
7383
if err != nil {
74-
logrus.Fatal(err)
84+
log.Fatal(err)
7585
}
7686
if err := c.Run(); err != nil {
77-
logrus.Fatal(err)
87+
log.Fatal(err)
7888
}
7989
}

docs/book/install-and-build.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ if [[ ${arch} == "amd64" ]]; then
3838
arch="x86_64"
3939
elif [[ ${arch} == "x86" ]]; then
4040
arch="i686"
41+
elif [[ ${arch} == "arm64" ]]; then
42+
# arm64 is not supported for v0.4.40 mdbook, so using x86_64 type.
43+
# Once the mdbook is upgraded to latest, use 'aarch64'
44+
arch="x86_64"
4145
fi
4246

4347
# translate os to rust's conventions (if we can)
@@ -63,15 +67,21 @@ esac
6367

6468
# grab mdbook
6569
# we hardcode linux/amd64 since rust uses a different naming scheme and it's a pain to tran
66-
echo "downloading mdBook-v0.4.40-${arch}-${target}.${ext}"
70+
MDBOOK_VERSION="v0.4.40"
71+
MDBOOK_BASENAME="mdBook-${MDBOOK_VERSION}-${arch}-${target}"
72+
MDBOOK_URL="https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/${MDBOOK_BASENAME}.${ext}"
73+
74+
echo "downloading ${MDBOOK_BASENAME}.${ext} from ${MDBOOK_URL}"
6775
set -x
68-
curl -sL -o /tmp/mdbook.${ext} https://github.com/rust-lang/mdBook/releases/download/v0.4.40/mdBook-v0.4.40-${arch}-${target}.${ext}
76+
curl -fL -o /tmp/mdbook.${ext} "${MDBOOK_URL}"
6977
${cmd} /tmp/mdbook.${ext}
7078
chmod +x /tmp/mdbook
7179

72-
echo "grabbing the latest released controller-gen"
80+
CONTROLLER_GEN_VERSION="v0.18.0"
81+
82+
echo "grabbing the controller-gen version: ${CONTROLLER_GEN_VERSION}"
7383
go version
74-
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.18.0
84+
go install sigs.k8s.io/controller-tools/cmd/controller-gen@${CONTROLLER_GEN_VERSION}
7585

7686
# make sure we add the go bin directory to our path
7787
gobin=$(go env GOBIN)

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ type CronJobSpec struct {
8181
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet;
8282
// - "Replace": cancels currently running job and replaces it with a new one
8383
// +optional
84+
// +kubebuilder:default:=Allow
8485
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty"`
8586

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

9192
// jobTemplate defines the job that will be created when executing a CronJob.
93+
// +required
9294
JobTemplate batchv1.JobTemplateSpec `json:"jobTemplate"`
9395

9496
// successfulJobsHistoryLimit defines the number of successful finished jobs to retain.
@@ -146,6 +148,9 @@ type CronJobStatus struct {
146148

147149
// active defines a list of pointers to currently running jobs.
148150
// +optional
151+
// +listType=atomic
152+
// +kubebuilder:validation:MinItems=1
153+
// +kubebuilder:validation:MaxItems=10
149154
Active []corev1.ObjectReference `json:"active,omitempty"`
150155

151156
// 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: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
spec:
2828
properties:
2929
concurrencyPolicy:
30+
default: Allow
3031
enum:
3132
- Allow
3233
- Forbid
@@ -3835,7 +3836,10 @@ spec:
38353836
type: string
38363837
type: object
38373838
x-kubernetes-map-type: atomic
3839+
maxItems: 10
3840+
minItems: 1
38383841
type: array
3842+
x-kubernetes-list-type: atomic
38393843
conditions:
38403844
items:
38413845
properties:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ spec:
6464
- --leader-elect
6565
- --health-probe-bind-address=:8081
6666
image: controller:latest
67+
imagePullPolicy: IfNotPresent
6768
name: manager
6869
ports: []
6970
securityContext:

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ spec:
3333
spec:
3434
properties:
3535
concurrencyPolicy:
36+
default: Allow
3637
enum:
3738
- Allow
3839
- Forbid
@@ -3841,7 +3842,10 @@ spec:
38413842
type: string
38423843
type: object
38433844
x-kubernetes-map-type: atomic
3845+
maxItems: 10
3846+
minItems: 1
38443847
type: array
3848+
x-kubernetes-list-type: atomic
38453849
conditions:
38463850
items:
38473851
properties:

docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ spec:
3434
command:
3535
- /manager
3636
image: {{ .Values.controllerManager.container.image.repository }}:{{ .Values.controllerManager.container.image.tag }}
37+
{{- if .Values.controllerManager.container.imagePullPolicy }}
38+
imagePullPolicy: {{ .Values.controllerManager.container.imagePullPolicy }}
39+
{{- end }}
3740
{{- if .Values.controllerManager.container.env }}
3841
env:
3942
{{- range $key, $value := .Values.controllerManager.container.env }}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ controllerManager:
55
image:
66
repository: controller
77
tag: latest
8+
imagePullPolicy: IfNotPresent
89
args:
910
- "--leader-elect"
1011
- "--metrics-bind-address=:8443"

0 commit comments

Comments
 (0)