Skip to content

batch.tutorial.kubebuilder.io/v2 doesn't work when using config sample from the book #4839

Open
@jwilkicki

Description

@jwilkicki

What broke? What's expected?

I followed the instructions for deploying the v2 version of the CronJob example and it doesn't run right. The controller appears to install (and I had the v1 version working fine) but when I apply the sample

apiVersion: batch.tutorial.kubebuilder.io/v2
kind: CronJob
metadata:
  labels:
    app.kubernetes.io/name: project
    app.kubernetes.io/managed-by: kustomize
  name: cronjob-sample
spec:
  schedule:
    minute: "*/1"
  startingDeadlineSeconds: 60
  concurrencyPolicy: Allow # explicitly specify, but Allow is also default.
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox
            args:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure

Error from server: error when retrieving current configuration of:
Resource: "batch.tutorial.kubebuilder.io/v2, Resource=cronjobs", GroupVersionKind: "batch.tutorial.kubebuilder.io/v2, Kind=CronJob"
Name: "cronjob-sample", Namespace: "default"
from server for: "config/samples/batch_v2_cronjob.yaml": conversion webhook for batch.tutorial.kubebuilder.io/v1, Kind=CronJob failed: Post "https://project-webhook-service.project-system.svc:443/convert?timeout=30s": tls: failed to verify certificate: x509: certificate signed by unknown authority

cert manager seems to be installed and working fine in the kind cluster, since the v1 version worked fine.

I expected I could create a v2 version CronJob

Reproducing this issue

No response

KubeBuilder (CLI) Version

Version: cmd.version{KubeBuilderVersion:"4.5.2", KubernetesVendor:"1.32.1", GitCommit:"7c707052daa2e8bd51f47548c02710b1f1f7a77e", BuildDate:"2025-03-26T19:43:05Z", GoOs:"linux", GoArch:"amd64"}

PROJECT version

3

Plugin versions

layout:
- go.kubebuilder.io/v4

Other versions

No response

Extra Labels

/kind documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.kind/documentationCategorizes issue or PR as related to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions