Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNORE #4535

Closed
wants to merge 21 commits into from
Closed

IGNORE #4535

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
82fa6bb
Make kubebuilder go-installable
migueleliasweb Jan 19, 2025
7ee23df
Merge pull request #4481 from migueleliasweb/make-go-install-able
k8s-ci-robot Jan 21, 2025
52765f9
:bug: Fix Kubernetes version in the goreleaser by upgrading it from 1…
camilamacedo86 Jan 21, 2025
c122bee
fix: webhook testEnv
mateusoliveira43 Dec 27, 2024
d2968d1
fix: disallow files containing unwanted extension files when initiali…
afzal442 Jan 20, 2025
bcb09cd
:book: Bump sigs.k8s.io/kubebuilder/v4
dependabot[bot] Jan 21, 2025
24f9711
Merge pull request #4449 from mateusoliveira43/fix/webhook-test-suite…
k8s-ci-robot Jan 22, 2025
6a72afe
Merge pull request #4517 from kubernetes-sigs/camilamacedo86-patch-1
k8s-ci-robot Jan 22, 2025
51866b3
test: add to commmon.sh the latest k8s release 1.32
camilamacedo86 Jan 22, 2025
21dcb35
Merge pull request #4519 from kubernetes-sigs/dependabot/go_modules/d…
k8s-ci-robot Jan 22, 2025
507284d
Merge pull request #4521 from camilamacedo86/add-common-k8s-132
k8s-ci-robot Jan 22, 2025
5fa06db
Merge pull request #4510 from afzal442/fix-allowed-files-ext
k8s-ci-robot Jan 23, 2025
02f8e8b
doc: update the Artifacts with the latest changes on the EnvTest Make…
camilamacedo86 Jan 22, 2025
2d657c5
✨ Upgrade controller-runtime from v0.20.0 to v0.20.1 (#4528)
camilamacedo86 Jan 26, 2025
87b0139
Merge pull request #4520 from camilamacedo86/fix-doc-envtest-artefacts
k8s-ci-robot Jan 26, 2025
da128f3
:book: bump github.com/spf13/pflag
dependabot[bot] Jan 29, 2025
768cb6e
:seedling: bump github.com/spf13/pflag from 1.0.5 to 1.0.6
dependabot[bot] Jan 29, 2025
aa6afc8
Merge pull request #4531 from kubernetes-sigs/dependabot/go_modules/d…
k8s-ci-robot Jan 30, 2025
74ab2da
Merge pull request #4532 from kubernetes-sigs/dependabot/go_modules/g…
k8s-ci-robot Jan 30, 2025
a64bab9
fix: correct minor typos in documentation
SaphMB Jan 31, 2025
d908e83
Merge pull request #4534 from SaphMB/master
k8s-ci-robot Jan 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ help: ## Display this help
##@ Build

LD_FLAGS=-ldflags " \
-X main.kubeBuilderVersion=$(shell git describe --tags --dirty --broken) \
-X main.goos=$(shell go env GOOS) \
-X main.goarch=$(shell go env GOARCH) \
-X main.gitCommit=$(shell git rev-parse HEAD) \
-X main.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \
-X cmd.kubeBuilderVersion=$(shell git describe --tags --dirty --broken) \
-X cmd.goos=$(shell go env GOOS) \
-X cmd.goarch=$(shell go env GOARCH) \
-X cmd.gitCommit=$(shell git rev-parse HEAD) \
-X cmd.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \
"
.PHONY: build
build: ## Build the project locally
go build $(LD_FLAGS) -o bin/kubebuilder ./cmd
go build $(LD_FLAGS) -o bin/kubebuilder

.PHONY: install
install: build ## Build and install the binary with the current source code. Use it to test your changes locally.
Expand Down
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The releases occur in an account in the Google Cloud (See [here](https://console
### To build the Kubebuilder CLI binaries:

A trigger GitHub action [release](.github/workflows/release.yml) is trigged when a new tag is pushed.
This action will caall the job [./build/.goreleaser.yml](./build/.goreleaser.yml).
This action will call the job [./build/.goreleaser.yml](./build/.goreleaser.yml).

### (Deprecated) - To build the Kubebuilder-tools: (Artifacts required to use ENV TEST)

Expand All @@ -93,7 +93,7 @@ see: https://github.com/kubernetes-sigs/kubebuilder/discussions/3907
These images are built from the project [brancz/kube-rbac-proxy](https://github.com/brancz/kube-rbac-proxy).
The projects built with Kubebuilder creates a side container with `kube-rbac-proxy` to protect the Manager.

These images are can be checked in the consolse, see [here](https://console.cloud.google.com/gcr/images/kubebuilder/GLOBAL/kube-rbac-proxy).
These images can be checked in the console, see [here](https://console.cloud.google.com/gcr/images/kubebuilder/GLOBAL/kube-rbac-proxy).

The project `kube-rbac-proxy` is in the process to be donated to the k8s org. However, it is going on for a long time and then,
we have no ETA for that to occur. When that occurs we can automate this process. But until there we need to generate these images
Expand Down
15 changes: 7 additions & 8 deletions build/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@ before:
# Build a binary for each target in targets.
builds:
- id: kubebuilder
main: ./cmd
binary: kubebuilder
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -X main.kubeBuilderVersion={{ .Version }}
- -X main.goos={{ .Os }}
- -X main.goarch={{ .Arch }}
- -X main.gitCommit={{ .Commit }}
- -X main.buildDate={{ .Date }}
- -X main.kubernetesVendorVersion={{ .Env.KUBERNETES_VERSION }}
- -X cmd.kubeBuilderVersion={{ .Version }}
- -X cmd.goos={{ .Os }}
- -X cmd.goarch={{ .Arch }}
- -X cmd.gitCommit={{ .Commit }}
- -X cmd.buildDate={{ .Date }}
- -X cmd.kubernetesVendorVersion={{ .Env.KUBERNETES_VERSION }}
targets:
- linux_amd64
- linux_arm64
Expand All @@ -47,7 +46,7 @@ builds:
- darwin_amd64
- darwin_arm64
env:
- KUBERNETES_VERSION=1.31.0
- KUBERNETES_VERSION=1.32.0
- CGO_ENABLED=0

# Only binaries of the form "kubebuilder_${goos}_${goarch}" will be released.
Expand Down
5 changes: 3 additions & 2 deletions cmd/main.go → cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package main
package cmd

import (
"github.com/sirupsen/logrus"
Expand All @@ -36,7 +36,8 @@ func init() {
logrus.SetFormatter(&logrus.TextFormatter{DisableTimestamp: true})
}

func main() {
// Run bootstraps & runs the CLI
func Run() {
// Bundle plugin which built the golang projects scaffold with base.go/v4 and kustomize/v2 plugins
gov4Bundle, _ := plugin.NewBundleWithOptions(plugin.WithName(golang.DefaultNameQualifier),
plugin.WithVersion(plugin.Version{Number: 4}),
Expand Down
19 changes: 14 additions & 5 deletions cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package main
package cmd

import (
"fmt"
"runtime/debug"
)

const unknown = "unknown"

// var needs to be used instead of const as ldflags is used to fill this
// information in the release process
var (
kubeBuilderVersion = "unknown"
kubernetesVendorVersion = "unknown"
goos = "unknown"
goarch = "unknown"
kubeBuilderVersion = unknown
kubernetesVendorVersion = unknown
goos = unknown
goarch = unknown
gitCommit = "$Format:%H$" // sha1 from git, output of $(git rev-parse HEAD)

buildDate = "1970-01-01T00:00:00Z" // build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
Expand All @@ -44,6 +47,12 @@ type version struct {

// versionString returns the CLI version
func versionString() string {
if kubeBuilderVersion == unknown {
if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "" {
kubeBuilderVersion = info.Main.Version
}
}

return fmt.Sprintf("Version: %#v", version{
kubeBuilderVersion,
kubernetesVendorVersion,
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/cronjob-tutorial/testdata/project/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func main() {

// Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
// More info:
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/server
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/server
// - https://book.kubebuilder.io/reference/metrics.html
metricsServerOptions := metricsserver.Options{
BindAddress: metricsAddr,
Expand All @@ -167,7 +167,7 @@ func main() {
// FilterProvider is used to protect the metrics endpoint with authn/authz.
// These configurations ensure that only authorized users and service accounts
// can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
// https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/filters#WithAuthenticationAndAuthorization
// https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/filters#WithAuthenticationAndAuthorization
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
}

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/cronjob-tutorial/testdata/project/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
k8s.io/api v0.32.0
k8s.io/apimachinery v0.32.0
k8s.io/client-go v0.32.0
sigs.k8s.io/controller-runtime v0.20.0
sigs.k8s.io/controller-runtime v0.20.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/cronjob-tutorial/testdata/project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs=
sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE=
sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var (
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/reconcile
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/reconcile
func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := log.FromContext(ctx)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

admissionv1 "k8s.io/api/admission/v1"
apimachineryruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -67,11 +66,7 @@ var _ = BeforeSuite(func() {
ctx, cancel = context.WithCancel(context.TODO())

var err error
scheme := apimachineryruntime.NewScheme()
err = batchv1.AddToScheme(scheme)
Expect(err).NotTo(HaveOccurred())

err = admissionv1.AddToScheme(scheme)
err = batchv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

// +kubebuilder:scaffold:scheme
Expand All @@ -96,14 +91,14 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

// start webhook server using Manager.
webhookInstallOptions := &testEnv.WebhookInstallOptions
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
Scheme: scheme.Scheme,
WebhookServer: webhook.NewServer(webhook.Options{
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/getting-started/testdata/project/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func main() {

// Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
// More info:
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/server
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/server
// - https://book.kubebuilder.io/reference/metrics.html
metricsServerOptions := metricsserver.Options{
BindAddress: metricsAddr,
Expand All @@ -147,7 +147,7 @@ func main() {
// FilterProvider is used to protect the metrics endpoint with authn/authz.
// These configurations ensure that only authorized users and service accounts
// can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
// https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/filters#WithAuthenticationAndAuthorization
// https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/filters#WithAuthenticationAndAuthorization
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
}

Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/getting-started/testdata/project/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
k8s.io/apimachinery v0.32.0
k8s.io/client-go v0.32.0
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
sigs.k8s.io/controller-runtime v0.20.0
sigs.k8s.io/controller-runtime v0.20.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/getting-started/testdata/project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs=
sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE=
sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type MemcachedReconciler struct {
// - About Controllers: https://kubernetes.io/docs/concepts/architecture/controller/
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/reconcile
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/reconcile
func (r *MemcachedReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := log.FromContext(ctx)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ controller(s), and webhook(s) in order to compare the generated configuration wi
Also, after all updates you would run the following commands:
- `make manifests` (to re-generate the files using the latest version of the contrller-gen after you update the Makefile)
- `make manifests` (to re-generate the files using the latest version of the controller-gen after you update the Makefile)
- `make all` (to ensure that you are able to build and perform all operations)
[v3vsv4]: v3vsv4.md
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func main() {

// Metrics endpoint is enabled in 'config/default/kustomization.yaml'. The Metrics options configure the server.
// More info:
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/server
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/server
// - https://book.kubebuilder.io/reference/metrics.html
metricsServerOptions := metricsserver.Options{
BindAddress: metricsAddr,
Expand All @@ -166,7 +166,7 @@ func main() {
// FilterProvider is used to protect the metrics endpoint with authn/authz.
// These configurations ensure that only authorized users and service accounts
// can access the metrics endpoint. The RBAC are configured in 'config/rbac/kustomization.yaml'. More info:
// https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/metrics/filters#WithAuthenticationAndAuthorization
// https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/metrics/filters#WithAuthenticationAndAuthorization
metricsServerOptions.FilterProvider = filters.WithAuthenticationAndAuthorization
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
k8s.io/api v0.32.0
k8s.io/apimachinery v0.32.0
k8s.io/client-go v0.32.0
sigs.k8s.io/controller-runtime v0.20.0
sigs.k8s.io/controller-runtime v0.20.1
)

require (
Expand Down
4 changes: 2 additions & 2 deletions docs/book/src/multiversion-tutorial/testdata/project/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo=
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
sigs.k8s.io/controller-runtime v0.20.0 h1:jjkMo29xEXH+02Md9qaVXfEIaMESSpy3TBWPrsfQkQs=
sigs.k8s.io/controller-runtime v0.20.0/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/controller-runtime v0.20.1 h1:JbGMAG/X94NeM3xvjenVUaBjy6Ui4Ogd/J5ZtjZnHaE=
sigs.k8s.io/controller-runtime v0.20.1/go.mod h1:BrP3w158MwvB3ZbNpaAcIKkHQ7YGpYnzpoSTZ8E14WU=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var (
// the user.
//
// For more details, check Reconcile and its Result here:
// - https://pkg.go.dev/sigs.k8s.io/[email protected].0/pkg/reconcile
// - https://pkg.go.dev/sigs.k8s.io/[email protected].1/pkg/reconcile
func (r *CronJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
log := log.FromContext(ctx)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

admissionv1 "k8s.io/api/admission/v1"
apimachineryruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down Expand Up @@ -67,11 +66,7 @@ var _ = BeforeSuite(func() {
ctx, cancel = context.WithCancel(context.TODO())

var err error
scheme := apimachineryruntime.NewScheme()
err = batchv1.AddToScheme(scheme)
Expect(err).NotTo(HaveOccurred())

err = admissionv1.AddToScheme(scheme)
err = batchv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

// +kubebuilder:scaffold:scheme
Expand All @@ -96,14 +91,14 @@ var _ = BeforeSuite(func() {
Expect(err).NotTo(HaveOccurred())
Expect(cfg).NotTo(BeNil())

k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme})
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())

// start webhook server using Manager.
webhookInstallOptions := &testEnv.WebhookInstallOptions
mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
Scheme: scheme.Scheme,
WebhookServer: webhook.NewServer(webhook.Options{
Host: webhookInstallOptions.LocalServingHost,
Port: webhookInstallOptions.LocalServingPort,
Expand Down
Loading
Loading