From cce0226179a9ad5d0c2be5094b13cfdea5fc2929 Mon Sep 17 00:00:00 2001 From: Paul Laffitte Date: Mon, 6 May 2024 17:21:27 +0200 Subject: [PATCH] refactor: upgrade kubebuilder to 3.11.1 Also upgrade: - kubebuilder plugin go to v4 - k8s libs to 1.27.13 - controller-runtime to 0.15.0 - ginko to 2.15.0 - and more... --- .dockerignore | 3 + .gitignore | 1 + Dockerfile | 2 - Makefile | 41 +++-- PROJECT | 7 +- api/{ => core}/v1/pod_webhook.go | 8 +- api/{ => core}/v1/pod_webhook_test.go | 10 +- api/{ => kuik}/v1alpha1/cachedimage_types.go | 0 api/{ => kuik}/v1alpha1/cachedimage_utils.go | 0 .../v1alpha1/cachedimage_webhook.go | 0 .../v1alpha1/cachedimage_webhook_test.go | 0 api/{ => kuik}/v1alpha1/groupversion_info.go | 0 api/{ => kuik}/v1alpha1/repository_types.go | 0 api/{ => kuik}/v1alpha1/repository_utils.go | 0 cmd/cache/main.go | 26 +-- cmd/proxy/main.go | 8 +- config/certmanager/certificate.yaml | 18 +- config/certmanager/kustomizeconfig.yaml | 10 +- config/crd/kustomization.yaml | 12 +- ... => cainjection_in_kuik_cachedimages.yaml} | 2 +- ... => cainjection_in_kuik_repositories.yaml} | 2 +- ...yaml => webhook_in_kuik_cachedimages.yaml} | 0 ...yaml => webhook_in_kuik_repositories.yaml} | 0 config/default/kustomization.yaml | 150 +++++++++++---- config/default/manager_auth_proxy_patch.yaml | 28 +-- config/default/webhookcainjection_patch.yaml | 14 +- config/manager/manager.yaml | 22 ++- config/prometheus/monitor.yaml | 4 +- .../rbac/auth_proxy_client_clusterrole.yaml | 4 +- config/rbac/auth_proxy_role.yaml | 4 +- config/rbac/auth_proxy_role_binding.yaml | 4 +- config/rbac/auth_proxy_service.yaml | 5 +- ...yaml => kuik_cachedimage_editor_role.yaml} | 4 +- ...yaml => kuik_cachedimage_viewer_role.yaml} | 4 +- ....yaml => kuik_repository_editor_role.yaml} | 0 ....yaml => kuik_repository_viewer_role.yaml} | 0 config/rbac/leader_election_role.yaml | 4 +- config/rbac/leader_election_role_binding.yaml | 6 +- config/rbac/role_binding.yaml | 6 +- config/rbac/service_account.yaml | 8 +- ...ge.yaml => kuik_v1alpha1_cachedimage.yaml} | 6 +- config/samples/kustomization.yaml | 5 + config/webhook/kustomizeconfig.yaml | 19 +- config/webhook/service.yaml | 5 +- go.mod | 164 ++++++++--------- go.sum | 174 +++++++----------- hack/boilerplate.go.txt | 0 .../controller}/collector.go | 4 +- .../controller/core}/pod_controller.go | 21 +-- .../controller/core}/pod_controller_test.go | 25 +-- internal/controller/core/suite_test.go | 93 ++++++++++ .../controller}/force_name.go | 4 +- .../controller}/healthz.go | 2 +- .../kuik}/cachedimage_controller.go | 42 ++--- .../kuik/cachedimage_controller_test.go | 71 +++++++ .../controller/kuik}/repository_controller.go | 18 +- .../controller/kuik}/suite_test.go | 57 +++--- internal/proxy/server.go | 2 +- internal/scheme/scheme.go | 2 +- main.go | 1 - 60 files changed, 663 insertions(+), 469 deletions(-) create mode 100644 .dockerignore rename api/{ => core}/v1/pod_webhook.go (95%) rename api/{ => core}/v1/pod_webhook_test.go (94%) rename api/{ => kuik}/v1alpha1/cachedimage_types.go (100%) rename api/{ => kuik}/v1alpha1/cachedimage_utils.go (100%) rename api/{ => kuik}/v1alpha1/cachedimage_webhook.go (100%) rename api/{ => kuik}/v1alpha1/cachedimage_webhook_test.go (100%) rename api/{ => kuik}/v1alpha1/groupversion_info.go (100%) rename api/{ => kuik}/v1alpha1/repository_types.go (100%) rename api/{ => kuik}/v1alpha1/repository_utils.go (100%) rename config/crd/patches/{cainjection_in_cachedimages.yaml => cainjection_in_kuik_cachedimages.yaml} (71%) rename config/crd/patches/{cainjection_in_repositories.yaml => cainjection_in_kuik_repositories.yaml} (71%) rename config/crd/patches/{webhook_in_cachedimages.yaml => webhook_in_kuik_cachedimages.yaml} (100%) rename config/crd/patches/{webhook_in_repositories.yaml => webhook_in_kuik_repositories.yaml} (100%) rename config/rbac/{cachedimage_editor_role.yaml => kuik_cachedimage_editor_role.yaml} (84%) rename config/rbac/{cachedimage_viewer_role.yaml => kuik_cachedimage_viewer_role.yaml} (83%) rename config/rbac/{repository_editor_role.yaml => kuik_repository_editor_role.yaml} (100%) rename config/rbac/{repository_viewer_role.yaml => kuik_repository_viewer_role.yaml} (100%) rename config/samples/{kuik.enix.io_v1alpha1_cachedimage.yaml => kuik_v1alpha1_cachedimage.yaml} (64%) create mode 100644 config/samples/kustomization.yaml delete mode 100644 hack/boilerplate.go.txt rename {controllers => internal/controller}/collector.go (97%) rename {controllers => internal/controller/core}/pod_controller.go (93%) rename {controllers => internal/controller/core}/pod_controller_test.go (85%) create mode 100644 internal/controller/core/suite_test.go rename {controllers => internal/controller}/force_name.go (95%) rename {controllers => internal/controller}/healthz.go (92%) rename {controllers => internal/controller/kuik}/cachedimage_controller.go (92%) create mode 100644 internal/controller/kuik/cachedimage_controller_test.go rename {controllers => internal/controller/kuik}/repository_controller.go (94%) rename {controllers => internal/controller/kuik}/suite_test.go (81%) delete mode 120000 main.go diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..a3aab7af --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file +# Ignore build and test binaries. +bin/ diff --git a/.gitignore b/.gitignore index 8b8f7d0a..c17fc016 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ zz_generated.* # editor and IDE paraphernalia .idea +.vscode *.swp *.swo *~ diff --git a/Dockerfile b/Dockerfile index 6927118c..8edff9c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,9 +13,7 @@ COPY go.sum go.sum RUN go mod download # Copy the go source -COPY main.go main.go COPY api/ api/ -COPY controllers/ controllers/ COPY cmd/ cmd/ COPY internal/ internal/ diff --git a/Makefile b/Makefile index 765ba59e..343360f7 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Image URL to use all building/pushing image targets IMG ?= controller:latest # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION ?= 1.26 +ENVTEST_K8S_VERSION ?= 1.27 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) @@ -11,6 +11,12 @@ else GOBIN=$(shell go env GOBIN) endif +# CONTAINER_TOOL defines the container tool to be used for building images. +# Be aware that the target commands are only tested with Docker which is +# scaffolded by default. However, you might want to replace it to use other +# tools. (i.e. podman) +CONTAINER_TOOL ?= docker + # Setting SHELL to bash allows bash commands to be executed by recipes. # Options are set to exit when a recipe line exits non-zero or a piped command fails. SHELL = /usr/bin/env bash -o pipefail @@ -59,26 +65,27 @@ vet: ## Run go vet against code. .PHONY: test test: manifests generate fmt vet envtest ## Run tests. KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./... -covermode=count -coverprofile cover.out + ##@ Build .PHONY: build build: manifests generate fmt vet ## Build manager binary. - go build -o bin/manager main.go + go build -o bin/manager cmd/cache/main.go .PHONY: run run: manifests generate fmt vet ## Run a controller from your host. - go run ./main.go + go run ./cmd/cache/main.go # If you wish built the manager image targeting other platforms you can use the --platform flag. # (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it. # More info: https://docs.docker.com/develop/develop-images/build_enhancements/ .PHONY: docker-build docker-build: test ## Build docker image with the manager. - docker build -t ${IMG} . + $(CONTAINER_TOOL) build -t ${IMG} . .PHONY: docker-push docker-push: ## Push docker image with the manager. - docker push ${IMG} + $(CONTAINER_TOOL) push ${IMG} # PLATFORMS defines the target platforms for the manager image be build to provide support to multiple # architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to: @@ -91,10 +98,10 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le docker-buildx: test ## Build and push docker image for the manager for cross-platform support # copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross - - docker buildx create --name project-v3-builder - docker buildx use project-v3-builder - - docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . - - docker buildx rm project-v3-builder + - $(CONTAINER_TOOL) buildx create --name project-v3-builder + $(CONTAINER_TOOL) buildx use project-v3-builder + - $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross . + - $(CONTAINER_TOOL) buildx rm project-v3-builder rm Dockerfile.cross ##@ Deployment @@ -105,20 +112,20 @@ endif .PHONY: install install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config. - $(KUSTOMIZE) build config/crd | kubectl apply -f - + $(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f - .PHONY: uninstall uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found) -f - + $(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - .PHONY: deploy deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config. cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG} - $(KUSTOMIZE) build config/default | kubectl apply -f - + $(KUSTOMIZE) build config/default | $(KUBECTL) apply -f - .PHONY: undeploy undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. - $(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f - + $(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f - ##@ Build Dependencies @@ -128,15 +135,15 @@ $(LOCALBIN): mkdir -p $(LOCALBIN) ## Tool Binaries +KUBECTL ?= kubectl KUSTOMIZE ?= $(LOCALBIN)/kustomize CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen ENVTEST ?= $(LOCALBIN)/setup-envtest ## Tool Versions -KUSTOMIZE_VERSION ?= v3.8.7 +KUSTOMIZE_VERSION ?= v5.0.1 CONTROLLER_TOOLS_VERSION ?= v0.15.0 -KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" .PHONY: kustomize kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading. $(KUSTOMIZE): $(LOCALBIN) @@ -144,7 +151,7 @@ $(KUSTOMIZE): $(LOCALBIN) echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \ rm -rf $(LOCALBIN)/kustomize; \ fi - test -s $(LOCALBIN)/kustomize || { curl -Ss $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); } + test -s $(LOCALBIN)/kustomize || GOBIN=$(LOCALBIN) GO111MODULE=on go install sigs.k8s.io/kustomize/kustomize/v5@$(KUSTOMIZE_VERSION) .PHONY: controller-gen controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten. @@ -155,7 +162,7 @@ $(CONTROLLER_GEN): $(LOCALBIN) .PHONY: envtest envtest: $(ENVTEST) ## Download envtest-setup locally if necessary. $(ENVTEST): $(LOCALBIN) - test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@release-0.17 + test -s $(LOCALBIN)/setup-envtest || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest # This is not used for kubebuilder, but to generate the Helm chart template README. .PHONY: helm-docs diff --git a/PROJECT b/PROJECT index 3d4c0df0..a47a5898 100644 --- a/PROJECT +++ b/PROJECT @@ -4,7 +4,8 @@ # More info: https://book.kubebuilder.io/reference/project-config.html domain: enix.io layout: -- go.kubebuilder.io/v3 +- go.kubebuilder.io/v4 +multigroup: true projectName: kube-image-keeper repo: github.com/enix/kube-image-keeper resources: @@ -15,7 +16,7 @@ resources: domain: enix.io group: kuik kind: CachedImage - path: github.com/enix/kube-image-keeper/api/v1alpha1 + path: github.com/enix/kube-image-keeper/api/kuik/v1alpha1 version: v1alpha1 webhooks: defaulting: true @@ -35,6 +36,6 @@ resources: domain: enix.io group: kuik kind: Repository - path: github.com/enix/kube-image-keeper/api/v1alpha1 + path: github.com/enix/kube-image-keeper/api/kuik/v1alpha1 version: v1alpha1 version: "3" diff --git a/api/v1/pod_webhook.go b/api/core/v1/pod_webhook.go similarity index 95% rename from api/v1/pod_webhook.go rename to api/core/v1/pod_webhook.go index 86c8cbac..ce3262db 100644 --- a/api/v1/pod_webhook.go +++ b/api/core/v1/pod_webhook.go @@ -11,7 +11,7 @@ import ( _ "crypto/sha256" - "github.com/enix/kube-image-keeper/controllers" + "github.com/enix/kube-image-keeper/internal/controller/core" "github.com/enix/kube-image-keeper/internal/registry" "github.com/google/go-containerregistry/pkg/name" admissionv1 "k8s.io/api/admission/v1" @@ -82,10 +82,10 @@ func (a *ImageRewriter) RewriteImages(pod *corev1.Pod, isNewPod bool) []Rewritte pod.Labels = map[string]string{} } - rewriteImages := pod.Annotations[controllers.AnnotationRewriteImagesName] == "true" || isNewPod + rewriteImages := pod.Annotations[core.AnnotationRewriteImagesName] == "true" || isNewPod - pod.Labels[controllers.LabelManagedName] = "true" - pod.Annotations[controllers.AnnotationRewriteImagesName] = fmt.Sprintf("%t", rewriteImages) + pod.Labels[core.LabelManagedName] = "true" + pod.Annotations[core.AnnotationRewriteImagesName] = fmt.Sprintf("%t", rewriteImages) rewrittenImages := []RewrittenImage{} diff --git a/api/v1/pod_webhook_test.go b/api/core/v1/pod_webhook_test.go similarity index 94% rename from api/v1/pod_webhook_test.go rename to api/core/v1/pod_webhook_test.go index fa72bf02..b2aaf780 100644 --- a/api/v1/pod_webhook_test.go +++ b/api/core/v1/pod_webhook_test.go @@ -6,7 +6,7 @@ import ( "regexp" "testing" - "github.com/enix/kube-image-keeper/controllers" + "github.com/enix/kube-image-keeper/internal/controller/core" "github.com/enix/kube-image-keeper/internal/registry" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" @@ -43,7 +43,7 @@ func TestRewriteImages(t *testing.T) { } ir.RewriteImages(&podStub, false) - g.Expect(podStub.Annotations[controllers.AnnotationRewriteImagesName]).To(Equal("false")) + g.Expect(podStub.Annotations[core.AnnotationRewriteImagesName]).To(Equal("false")) ir.RewriteImages(&podStub, true) @@ -62,7 +62,7 @@ func TestRewriteImages(t *testing.T) { g.Expect(podStub.Spec.InitContainers).To(Equal(rewrittenInitContainers)) g.Expect(podStub.Spec.Containers).To(Equal(rewrittenContainers)) - g.Expect(podStub.Labels[controllers.LabelManagedName]).To(Equal("true")) + g.Expect(podStub.Labels[core.LabelManagedName]).To(Equal("true")) g.Expect(podStub.Annotations[registry.ContainerAnnotationKey("a", true)]).To(Equal("original-init")) g.Expect(podStub.Annotations[registry.ContainerAnnotationKey("b", false)]).To(Equal("original")) @@ -72,7 +72,7 @@ func TestRewriteImages(t *testing.T) { g.Expect(podStub.Annotations[registry.ContainerAnnotationKey("f", false)]).To(Equal("")) ir.RewriteImages(&podStub, false) - g.Expect(podStub.Annotations[controllers.AnnotationRewriteImagesName]).To(Equal("true")) + g.Expect(podStub.Annotations[core.AnnotationRewriteImagesName]).To(Equal("true")) }) } @@ -105,7 +105,7 @@ func TestRewriteImagesWithIgnore(t *testing.T) { g.Expect(podStub.Spec.InitContainers).To(Equal(rewrittenInitContainers)) g.Expect(podStub.Spec.Containers).To(Equal(rewrittenContainers)) - g.Expect(podStub.Labels[controllers.LabelManagedName]).To(Equal("true")) + g.Expect(podStub.Labels[core.LabelManagedName]).To(Equal("true")) g.Expect(podStub.Annotations[registry.ContainerAnnotationKey("a", true)]).To(Equal("")) g.Expect(podStub.Annotations[registry.ContainerAnnotationKey("b", false)]).To(Equal("")) diff --git a/api/v1alpha1/cachedimage_types.go b/api/kuik/v1alpha1/cachedimage_types.go similarity index 100% rename from api/v1alpha1/cachedimage_types.go rename to api/kuik/v1alpha1/cachedimage_types.go diff --git a/api/v1alpha1/cachedimage_utils.go b/api/kuik/v1alpha1/cachedimage_utils.go similarity index 100% rename from api/v1alpha1/cachedimage_utils.go rename to api/kuik/v1alpha1/cachedimage_utils.go diff --git a/api/v1alpha1/cachedimage_webhook.go b/api/kuik/v1alpha1/cachedimage_webhook.go similarity index 100% rename from api/v1alpha1/cachedimage_webhook.go rename to api/kuik/v1alpha1/cachedimage_webhook.go diff --git a/api/v1alpha1/cachedimage_webhook_test.go b/api/kuik/v1alpha1/cachedimage_webhook_test.go similarity index 100% rename from api/v1alpha1/cachedimage_webhook_test.go rename to api/kuik/v1alpha1/cachedimage_webhook_test.go diff --git a/api/v1alpha1/groupversion_info.go b/api/kuik/v1alpha1/groupversion_info.go similarity index 100% rename from api/v1alpha1/groupversion_info.go rename to api/kuik/v1alpha1/groupversion_info.go diff --git a/api/v1alpha1/repository_types.go b/api/kuik/v1alpha1/repository_types.go similarity index 100% rename from api/v1alpha1/repository_types.go rename to api/kuik/v1alpha1/repository_types.go diff --git a/api/v1alpha1/repository_utils.go b/api/kuik/v1alpha1/repository_utils.go similarity index 100% rename from api/v1alpha1/repository_utils.go rename to api/kuik/v1alpha1/repository_utils.go diff --git a/cmd/cache/main.go b/cmd/cache/main.go index 11b5a802..b40bcaef 100644 --- a/cmd/cache/main.go +++ b/cmd/cache/main.go @@ -16,10 +16,12 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log/zap" "sigs.k8s.io/controller-runtime/pkg/webhook" - kuikenixiov1 "github.com/enix/kube-image-keeper/api/v1" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" - "github.com/enix/kube-image-keeper/controllers" + kuikenixiov1 "github.com/enix/kube-image-keeper/api/core/v1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" "github.com/enix/kube-image-keeper/internal" + kuikController "github.com/enix/kube-image-keeper/internal/controller" + "github.com/enix/kube-image-keeper/internal/controller/core" + "github.com/enix/kube-image-keeper/internal/controller/kuik" "github.com/enix/kube-image-keeper/internal/registry" "github.com/enix/kube-image-keeper/internal/scheme" //+kubebuilder:scaffold:imports @@ -85,7 +87,7 @@ func main() { os.Exit(1) } - if err = (&controllers.CachedImageReconciler{ + if err = (&kuik.CachedImageReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Recorder: mgr.GetEventRecorderFor("cachedimage-controller"), @@ -98,7 +100,7 @@ func main() { setupLog.Error(err, "unable to create controller", "controller", "CachedImage") os.Exit(1) } - if err = (&controllers.PodReconciler{ + if err = (&core.PodReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), }).SetupWithManager(mgr); err != nil { @@ -116,7 +118,7 @@ func main() { setupLog.Error(err, "unable to create webhook", "webhook", "CachedImage") os.Exit(1) } - if err = (&controllers.RepositoryReconciler{ + if err = (&kuik.RepositoryReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Recorder: mgr.GetEventRecorderFor("epository-controller"), @@ -132,23 +134,23 @@ func main() { os.Exit(1) } - if err := mgr.AddHealthzCheck("healthz", controllers.MakeChecker(controllers.Healthz)); err != nil { + if err := mgr.AddHealthzCheck("healthz", kuikController.MakeChecker(kuikController.Healthz)); err != nil { setupLog.Error(err, "unable to set up health check") os.Exit(1) } - if err := mgr.AddReadyzCheck("readyz", controllers.MakeChecker(controllers.Readyz)); err != nil { + if err := mgr.AddReadyzCheck("readyz", kuikController.MakeChecker(kuikController.Readyz)); err != nil { setupLog.Error(err, "unable to set up ready check") os.Exit(1) } - controllers.SetLeader(false) + kuikController.SetLeader(false) go func() { <-mgr.Elected() - controllers.SetLeader(true) + kuikController.SetLeader(true) }() - controllers.ProbeAddr = probeAddr - controllers.RegisterMetrics(mgr.GetClient()) + kuikController.ProbeAddr = probeAddr + kuikController.RegisterMetrics(mgr.GetClient()) setupLog.Info("starting manager") if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { diff --git a/cmd/proxy/main.go b/cmd/proxy/main.go index 63160d7d..7652bb28 100644 --- a/cmd/proxy/main.go +++ b/cmd/proxy/main.go @@ -59,13 +59,17 @@ func main() { config, err = clientcmd.BuildConfigFromFlags("", kubeconfig) } + if err != nil { + panic(err) + } + klog.Info("starting") + httpClient, err := rest.HTTPClientFor(config) if err != nil { panic(err) } - - restMapper, err := apiutil.NewDynamicRESTMapper(config, apiutil.WithLazyDiscovery) + restMapper, err := apiutil.NewDynamicRESTMapper(config, httpClient) if err != nil { panic(err) } diff --git a/config/certmanager/certificate.yaml b/config/certmanager/certificate.yaml index b9a8018e..cc679de9 100644 --- a/config/certmanager/certificate.yaml +++ b/config/certmanager/certificate.yaml @@ -5,11 +5,11 @@ apiVersion: cert-manager.io/v1 kind: Issuer metadata: labels: - app.kubernetes.io/name: issuer - app.kubernetes.io/instance: selfsigned-issuer + app.kubernetes.io/name: certificate + app.kubernetes.io/instance: serving-cert app.kubernetes.io/component: certificate - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: selfsigned-issuer namespace: system @@ -23,16 +23,16 @@ metadata: app.kubernetes.io/name: certificate app.kubernetes.io/instance: serving-cert app.kubernetes.io/component: certificate - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml namespace: system spec: - # $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize + # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize dnsNames: - - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc - - $(SERVICE_NAME).$(SERVICE_NAMESPACE).svc.cluster.local + - SERVICE_NAME.SERVICE_NAMESPACE.svc + - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local issuerRef: kind: Issuer name: selfsigned-issuer diff --git a/config/certmanager/kustomizeconfig.yaml b/config/certmanager/kustomizeconfig.yaml index e631f777..cf6f89e8 100644 --- a/config/certmanager/kustomizeconfig.yaml +++ b/config/certmanager/kustomizeconfig.yaml @@ -1,4 +1,4 @@ -# This configuration is for teaching kustomize how to update name ref and var substitution +# This configuration is for teaching kustomize how to update name ref substitution nameReference: - kind: Issuer group: cert-manager.io @@ -6,11 +6,3 @@ nameReference: - kind: Certificate group: cert-manager.io path: spec/issuerRef/name - -varReference: -- kind: Certificate - group: cert-manager.io - path: spec/commonName -- kind: Certificate - group: cert-manager.io - path: spec/dnsNames diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 1e5a5674..f7a5200b 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -6,17 +6,17 @@ resources: - bases/kuik.enix.io_repositories.yaml #+kubebuilder:scaffold:crdkustomizeresource -patchesStrategicMerge: [] +patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD -#- patches/webhook_in_cachedimages.yaml -#- patches/webhook_in_repositories.yaml +#- path: patches/webhook_in_cachedimages.yaml +#- path: patches/webhook_in_repositories.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch -# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix. +# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD -#- patches/cainjection_in_cachedimages.yaml -#- patches/cainjection_in_repositories.yaml +#- path: patches/cainjection_in_cachedimages.yaml +#- path: patches/cainjection_in_repositories.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/config/crd/patches/cainjection_in_cachedimages.yaml b/config/crd/patches/cainjection_in_kuik_cachedimages.yaml similarity index 71% rename from config/crd/patches/cainjection_in_cachedimages.yaml rename to config/crd/patches/cainjection_in_kuik_cachedimages.yaml index 600fbec9..d5e7a3bc 100644 --- a/config/crd/patches/cainjection_in_cachedimages.yaml +++ b/config/crd/patches/cainjection_in_kuik_cachedimages.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME name: cachedimages.kuik.enix.io diff --git a/config/crd/patches/cainjection_in_repositories.yaml b/config/crd/patches/cainjection_in_kuik_repositories.yaml similarity index 71% rename from config/crd/patches/cainjection_in_repositories.yaml rename to config/crd/patches/cainjection_in_kuik_repositories.yaml index c6ef11f3..98171983 100644 --- a/config/crd/patches/cainjection_in_repositories.yaml +++ b/config/crd/patches/cainjection_in_kuik_repositories.yaml @@ -3,5 +3,5 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME name: repositories.kuik.enix.io diff --git a/config/crd/patches/webhook_in_cachedimages.yaml b/config/crd/patches/webhook_in_kuik_cachedimages.yaml similarity index 100% rename from config/crd/patches/webhook_in_cachedimages.yaml rename to config/crd/patches/webhook_in_kuik_cachedimages.yaml diff --git a/config/crd/patches/webhook_in_repositories.yaml b/config/crd/patches/webhook_in_kuik_repositories.yaml similarity index 100% rename from config/crd/patches/webhook_in_repositories.yaml rename to config/crd/patches/webhook_in_kuik_repositories.yaml diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index a0d539d8..822f8d02 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -1,26 +1,28 @@ # Adds namespace to all resources. -namespace: kuik-system +namespace: kube-image-keeper-system # Value of this field is prepended to the # names of all resources, e.g. a deployment named # "wordpress" becomes "alices-wordpress". # Note that it should also match with the prefix (text before '-') of the namespace # field above. -namePrefix: kuik- +namePrefix: kube-image-keeper- # Labels to add to all resources and selectors. -#commonLabels: -# someName: someValue +#labels: +#- includeSelectors: true +# pairs: +# someName: someValue -bases: +resources: - ../crd - ../rbac - ../manager # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml -- ../webhook +#- ../webhook # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required. -- ../certmanager +#- ../certmanager # [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'. #- ../prometheus @@ -28,43 +30,115 @@ patchesStrategicMerge: # Protect the /metrics endpoint by putting it behind auth. # If you want your controller-manager to expose the /metrics # endpoint w/o any authn/z, please comment the following line. -# - manager_auth_proxy_patch.yaml +- manager_auth_proxy_patch.yaml + + # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml -- manager_webhook_patch.yaml +#- manager_webhook_patch.yaml # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. # Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks. # 'CERTMANAGER' needs to be enabled to use ca injection -- webhookcainjection_patch.yaml +#- webhookcainjection_patch.yaml -# the following config is for teaching kustomize how to do var substitution -vars: # [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix. -- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR - objref: - kind: Certificate - group: cert-manager.io - version: v1 - name: serving-cert # this name should match the one in certificate.yaml - fieldref: - fieldpath: metadata.namespace -- name: CERTIFICATE_NAME - objref: - kind: Certificate - group: cert-manager.io - version: v1 - name: serving-cert # this name should match the one in certificate.yaml -- name: SERVICE_NAMESPACE # namespace of the service - objref: - kind: Service - version: v1 - name: webhook-service - fieldref: - fieldpath: metadata.namespace -- name: SERVICE_NAME - objref: - kind: Service - version: v1 - name: webhook-service +# Uncomment the following replacements to add the cert-manager CA injection annotations +#replacements: +# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs +# kind: Certificate +# group: cert-manager.io +# version: v1 +# name: serving-cert # this name should match the one in certificate.yaml +# fieldPath: .metadata.namespace # namespace of the certificate CR +# targets: +# - select: +# kind: ValidatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 0 +# create: true +# - select: +# kind: MutatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 0 +# create: true +# - select: +# kind: CustomResourceDefinition +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 0 +# create: true +# - source: +# kind: Certificate +# group: cert-manager.io +# version: v1 +# name: serving-cert # this name should match the one in certificate.yaml +# fieldPath: .metadata.name +# targets: +# - select: +# kind: ValidatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 1 +# create: true +# - select: +# kind: MutatingWebhookConfiguration +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 1 +# create: true +# - select: +# kind: CustomResourceDefinition +# fieldPaths: +# - .metadata.annotations.[cert-manager.io/inject-ca-from] +# options: +# delimiter: '/' +# index: 1 +# create: true +# - source: # Add cert-manager annotation to the webhook Service +# kind: Service +# version: v1 +# name: webhook-service +# fieldPath: .metadata.name # namespace of the service +# targets: +# - select: +# kind: Certificate +# group: cert-manager.io +# version: v1 +# fieldPaths: +# - .spec.dnsNames.0 +# - .spec.dnsNames.1 +# options: +# delimiter: '.' +# index: 0 +# create: true +# - source: +# kind: Service +# version: v1 +# name: webhook-service +# fieldPath: .metadata.namespace # namespace of the service +# targets: +# - select: +# kind: Certificate +# group: cert-manager.io +# version: v1 +# fieldPaths: +# - .spec.dnsNames.0 +# - .spec.dnsNames.1 +# options: +# delimiter: '.' +# index: 1 +# create: true diff --git a/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml index 9f7a5ac6..73fad2a6 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/config/default/manager_auth_proxy_patch.yaml @@ -8,22 +8,6 @@ metadata: spec: template: spec: - affinity: - nodeAffinity: - requiredDuringSchedulingIgnoredDuringExecution: - nodeSelectorTerms: - - matchExpressions: - - key: kubernetes.io/arch - operator: In - values: - - amd64 - - arm64 - - ppc64le - - s390x - - key: kubernetes.io/os - operator: In - values: - - linux containers: - name: kube-rbac-proxy securityContext: @@ -31,15 +15,23 @@ spec: capabilities: drop: - "ALL" - image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.1 + image: gcr.io/kubebuilder/kube-rbac-proxy:v0.14.1 args: - "--secure-listen-address=0.0.0.0:8443" - "--upstream=http://127.0.0.1:8080/" - "--logtostderr=true" - - "--v=10" + - "--v=0" ports: - containerPort: 8443 + protocol: TCP name: https + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 5m + memory: 64Mi - name: manager args: - "--health-probe-bind-address=:8081" diff --git a/config/default/webhookcainjection_patch.yaml b/config/default/webhookcainjection_patch.yaml index 763e4254..7322774b 100644 --- a/config/default/webhookcainjection_patch.yaml +++ b/config/default/webhookcainjection_patch.yaml @@ -1,5 +1,5 @@ # This patch add annotation to admission webhook config and -# the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize. +# CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize apiVersion: admissionregistration.k8s.io/v1 kind: MutatingWebhookConfiguration metadata: @@ -7,12 +7,12 @@ metadata: app.kubernetes.io/name: mutatingwebhookconfiguration app.kubernetes.io/instance: mutating-webhook-configuration app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: mutating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME --- apiVersion: admissionregistration.k8s.io/v1 kind: ValidatingWebhookConfiguration @@ -21,9 +21,9 @@ metadata: app.kubernetes.io/name: validatingwebhookconfiguration app.kubernetes.io/instance: validating-webhook-configuration app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index f684ab2a..07aadcd5 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: namespace app.kubernetes.io/instance: system app.kubernetes.io/component: manager - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: system --- @@ -21,8 +21,8 @@ metadata: app.kubernetes.io/name: deployment app.kubernetes.io/instance: controller-manager app.kubernetes.io/component: manager - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize spec: selector: @@ -31,6 +31,8 @@ spec: replicas: 1 template: metadata: + annotations: + kubectl.kubernetes.io/default-container: manager labels: control-plane: controller-manager spec: @@ -65,7 +67,7 @@ spec: # type: RuntimeDefault containers: - command: - - manager + - /manager args: - --leader-elect image: controller:latest @@ -87,12 +89,14 @@ spec: port: 8081 initialDelaySeconds: 5 periodSeconds: 10 + # TODO(user): Configure the resources accordingly based on the project requirements. + # More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/ resources: limits: - cpu: 100m - memory: 30Mi + cpu: 500m + memory: 128Mi requests: - cpu: 100m - memory: 20Mi + cpu: 10m + memory: 64Mi serviceAccountName: controller-manager terminationGracePeriodSeconds: 10 diff --git a/config/prometheus/monitor.yaml b/config/prometheus/monitor.yaml index 90a09ac8..ddb1223b 100644 --- a/config/prometheus/monitor.yaml +++ b/config/prometheus/monitor.yaml @@ -8,8 +8,8 @@ metadata: app.kubernetes.io/name: servicemonitor app.kubernetes.io/instance: controller-manager-metrics-monitor app.kubernetes.io/component: metrics - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-monitor namespace: system diff --git a/config/rbac/auth_proxy_client_clusterrole.yaml b/config/rbac/auth_proxy_client_clusterrole.yaml index c8d879d4..5ef6205b 100644 --- a/config/rbac/auth_proxy_client_clusterrole.yaml +++ b/config/rbac/auth_proxy_client_clusterrole.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: metrics-reader app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: metrics-reader rules: diff --git a/config/rbac/auth_proxy_role.yaml b/config/rbac/auth_proxy_role.yaml index 7bc5b715..028d1fc0 100644 --- a/config/rbac/auth_proxy_role.yaml +++ b/config/rbac/auth_proxy_role.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: proxy-role app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: proxy-role rules: diff --git a/config/rbac/auth_proxy_role_binding.yaml b/config/rbac/auth_proxy_role_binding.yaml index 3b124f41..f9d4a68f 100644 --- a/config/rbac/auth_proxy_role_binding.yaml +++ b/config/rbac/auth_proxy_role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrolebinding app.kubernetes.io/instance: proxy-rolebinding app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: proxy-rolebinding roleRef: diff --git a/config/rbac/auth_proxy_service.yaml b/config/rbac/auth_proxy_service.yaml index cfe053f3..d2b8fc52 100644 --- a/config/rbac/auth_proxy_service.yaml +++ b/config/rbac/auth_proxy_service.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: service app.kubernetes.io/instance: controller-manager-metrics-service app.kubernetes.io/component: kube-rbac-proxy - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: controller-manager-metrics-service namespace: system @@ -15,6 +15,7 @@ spec: ports: - name: https port: 8443 + protocol: TCP targetPort: https selector: control-plane: controller-manager diff --git a/config/rbac/cachedimage_editor_role.yaml b/config/rbac/kuik_cachedimage_editor_role.yaml similarity index 84% rename from config/rbac/cachedimage_editor_role.yaml rename to config/rbac/kuik_cachedimage_editor_role.yaml index d8ea0789..6e13e074 100644 --- a/config/rbac/cachedimage_editor_role.yaml +++ b/config/rbac/kuik_cachedimage_editor_role.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: cachedimage-editor-role app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: cachedimage-editor-role rules: diff --git a/config/rbac/cachedimage_viewer_role.yaml b/config/rbac/kuik_cachedimage_viewer_role.yaml similarity index 83% rename from config/rbac/cachedimage_viewer_role.yaml rename to config/rbac/kuik_cachedimage_viewer_role.yaml index 8a20545a..8311dcac 100644 --- a/config/rbac/cachedimage_viewer_role.yaml +++ b/config/rbac/kuik_cachedimage_viewer_role.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: clusterrole app.kubernetes.io/instance: cachedimage-viewer-role app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: cachedimage-viewer-role rules: diff --git a/config/rbac/repository_editor_role.yaml b/config/rbac/kuik_repository_editor_role.yaml similarity index 100% rename from config/rbac/repository_editor_role.yaml rename to config/rbac/kuik_repository_editor_role.yaml diff --git a/config/rbac/repository_viewer_role.yaml b/config/rbac/kuik_repository_viewer_role.yaml similarity index 100% rename from config/rbac/repository_viewer_role.yaml rename to config/rbac/kuik_repository_viewer_role.yaml diff --git a/config/rbac/leader_election_role.yaml b/config/rbac/leader_election_role.yaml index b20139ce..ce0a4b48 100644 --- a/config/rbac/leader_election_role.yaml +++ b/config/rbac/leader_election_role.yaml @@ -6,8 +6,8 @@ metadata: app.kubernetes.io/name: role app.kubernetes.io/instance: leader-election-role app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: leader-election-role rules: diff --git a/config/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml index e29e1411..8b7f0f18 100644 --- a/config/rbac/leader_election_role_binding.yaml +++ b/config/rbac/leader_election_role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: rolebinding app.kubernetes.io/instance: leader-election-rolebinding app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: leader-election-rolebinding roleRef: @@ -16,4 +16,4 @@ roleRef: subjects: - kind: ServiceAccount name: controller-manager - namespace: default + namespace: system diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml index 8d407e3f..a17fc604 100644 --- a/config/rbac/role_binding.yaml +++ b/config/rbac/role_binding.yaml @@ -5,8 +5,8 @@ metadata: app.kubernetes.io/name: clusterrolebinding app.kubernetes.io/instance: manager-rolebinding app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: manager-rolebinding roleRef: @@ -16,4 +16,4 @@ roleRef: subjects: - kind: ServiceAccount name: controller-manager - namespace: default + namespace: system diff --git a/config/rbac/service_account.yaml b/config/rbac/service_account.yaml index 6697d8ea..a1bbbd45 100644 --- a/config/rbac/service_account.yaml +++ b/config/rbac/service_account.yaml @@ -3,10 +3,10 @@ kind: ServiceAccount metadata: labels: app.kubernetes.io/name: serviceaccount - app.kubernetes.io/instance: controller-manager + app.kubernetes.io/instance: controller-manager-sa app.kubernetes.io/component: rbac - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: controller-manager - namespace: default + namespace: system diff --git a/config/samples/kuik.enix.io_v1alpha1_cachedimage.yaml b/config/samples/kuik_v1alpha1_cachedimage.yaml similarity index 64% rename from config/samples/kuik.enix.io_v1alpha1_cachedimage.yaml rename to config/samples/kuik_v1alpha1_cachedimage.yaml index 8254f74d..4041c88e 100644 --- a/config/samples/kuik.enix.io_v1alpha1_cachedimage.yaml +++ b/config/samples/kuik_v1alpha1_cachedimage.yaml @@ -4,9 +4,9 @@ metadata: labels: app.kubernetes.io/name: cachedimage app.kubernetes.io/instance: cachedimage-sample - app.kubernetes.io/part-of: kuik + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize - app.kubernetes.io/created-by: kuik + app.kubernetes.io/created-by: kube-image-keeper name: cachedimage-sample spec: - sourceImage: library/nginx:latest + # TODO(user): Add fields here diff --git a/config/samples/kustomization.yaml b/config/samples/kustomization.yaml new file mode 100644 index 00000000..23d996bb --- /dev/null +++ b/config/samples/kustomization.yaml @@ -0,0 +1,5 @@ +## Append samples of your project ## +resources: +- kuik_v1alpha1_cachedimage.yaml +- kuik_v1alpha1_repository.yaml +#+kubebuilder:scaffold:manifestskustomizesamples diff --git a/config/webhook/kustomizeconfig.yaml b/config/webhook/kustomizeconfig.yaml index 7405cf0f..206316e5 100644 --- a/config/webhook/kustomizeconfig.yaml +++ b/config/webhook/kustomizeconfig.yaml @@ -1,4 +1,4 @@ -# the following config is for teaching kustomize where to look at when substituting vars. +# the following config is for teaching kustomize where to look at when substituting nameReference. # It requires kustomize v2.1.0 or newer to work properly. nameReference: - kind: Service @@ -7,19 +7,16 @@ nameReference: - kind: MutatingWebhookConfiguration group: admissionregistration.k8s.io path: webhooks/clientConfig/service/name - # - kind: ValidatingWebhookConfiguration - # group: admissionregistration.k8s.io - # path: webhooks/clientConfig/service/name + - kind: ValidatingWebhookConfiguration + group: admissionregistration.k8s.io + path: webhooks/clientConfig/service/name namespace: - kind: MutatingWebhookConfiguration group: admissionregistration.k8s.io path: webhooks/clientConfig/service/namespace create: true -# - kind: ValidatingWebhookConfiguration -# group: admissionregistration.k8s.io -# path: webhooks/clientConfig/service/namespace -# create: true - -varReference: -- path: metadata/annotations +- kind: ValidatingWebhookConfiguration + group: admissionregistration.k8s.io + path: webhooks/clientConfig/service/namespace + create: true diff --git a/config/webhook/service.yaml b/config/webhook/service.yaml index cf3c4e7f..ed6966c5 100644 --- a/config/webhook/service.yaml +++ b/config/webhook/service.yaml @@ -6,14 +6,15 @@ metadata: app.kubernetes.io/name: service app.kubernetes.io/instance: webhook-service app.kubernetes.io/component: webhook - app.kubernetes.io/created-by: kuik - app.kubernetes.io/part-of: kuik + app.kubernetes.io/created-by: kube-image-keeper + app.kubernetes.io/part-of: kube-image-keeper app.kubernetes.io/managed-by: kustomize name: webhook-service namespace: system spec: ports: - port: 443 + protocol: TCP targetPort: 9443 selector: control-plane: controller-manager diff --git a/go.mod b/go.mod index a9345f7b..f629c823 100644 --- a/go.mod +++ b/go.mod @@ -4,89 +4,82 @@ go 1.22 require ( github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230519004202-7f2db5bd753e - github.com/distribution/reference v0.5.0 + github.com/distribution/reference v0.6.0 github.com/docker/cli v26.1.3+incompatible github.com/docker/docker v26.1.3+incompatible github.com/docker/go-connections v0.5.0 github.com/gin-gonic/gin v1.10.0 github.com/go-logr/logr v1.4.2 github.com/google/go-containerregistry v0.19.1 - github.com/onsi/ginkgo v1.16.5 + github.com/onsi/ginkgo/v2 v2.17.2 github.com/onsi/gomega v1.33.1 github.com/prometheus/client_golang v1.19.1 go.uber.org/automaxprocs v1.5.3 go.uber.org/zap v1.27.0 - golang.org/x/exp v0.0.0-20231006140011-7918f672742d - k8s.io/api v0.26.13 - k8s.io/apimachinery v0.26.13 - k8s.io/client-go v0.26.13 + golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f + k8s.io/api v0.27.13 + k8s.io/apimachinery v0.27.13 + k8s.io/client-go v0.27.13 k8s.io/klog/v2 v2.120.1 - k8s.io/kubernetes v1.26.13 + k8s.io/kubernetes v1.27.13 k8s.io/utils v0.0.0-20230726121419-3b25d923346b - sigs.k8s.io/controller-runtime v0.14.1 -) - -require ( - github.com/blang/semver/v4 v4.0.0 // indirect - github.com/bytedance/sonic/loader v0.1.1 // indirect - github.com/cloudwego/base64x v0.1.4 // indirect - github.com/cloudwego/iasm v0.2.0 // indirect - github.com/containerd/log v0.1.0 // indirect - github.com/felixge/httpsnoop v1.0.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/moby/docker-image-spec v1.3.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect - go.opentelemetry.io/otel v1.26.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 // indirect - go.opentelemetry.io/otel/metric v1.26.0 // indirect - go.opentelemetry.io/otel/sdk v1.26.0 // indirect - go.opentelemetry.io/otel/trace v1.26.0 // indirect + sigs.k8s.io/controller-runtime v0.15.0 ) require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/aws/aws-sdk-go-v2 v1.18.0 // indirect - github.com/aws/aws-sdk-go-v2/config v1.18.25 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.13.24 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34 // indirect - github.com/aws/aws-sdk-go-v2/service/ecr v1.18.11 // indirect - github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.16.2 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.12.10 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 // indirect - github.com/aws/smithy-go v1.13.5 // indirect + github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect + github.com/aws/aws-sdk-go-v2/config v1.27.11 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.17.11 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4 // indirect + github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect + github.com/aws/smithy-go v1.20.2 // indirect github.com/beorn7/perks v1.0.1 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect github.com/bytedance/sonic v1.11.6 // indirect + github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect + github.com/containerd/log v0.1.0 // indirect github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.3+incompatible // indirect - github.com/docker/docker-credential-helpers v0.7.0 // indirect + github.com/docker/docker-credential-helpers v0.8.1 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/emicklei/go-restful/v3 v3.9.0 // indirect + github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect - github.com/go-logr/zapr v1.2.4 // indirect - github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.20.0 // indirect - github.com/go-openapi/swag v0.19.14 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-logr/zapr v1.3.0 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.1 // indirect + github.com/go-openapi/swag v0.22.3 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.20.0 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect github.com/google/uuid v1.3.0 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect @@ -95,13 +88,13 @@ require ( github.com/klauspost/compress v1.16.5 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/mailru/easyjson v0.7.6 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/nxadm/tail v1.4.8 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc3 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect @@ -114,6 +107,12 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect github.com/vbatts/tar-split v0.11.3 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect + go.opentelemetry.io/otel v1.26.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.26.0 // indirect + go.opentelemetry.io/otel/metric v1.26.0 // indirect + go.opentelemetry.io/otel/sdk v1.26.0 // indirect + go.opentelemetry.io/otel/trace v1.26.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/crypto v0.23.0 // indirect @@ -130,47 +129,46 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.34.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.26.16 // indirect; indirec3 - k8s.io/apiserver v0.26.16 // indirect; indirec3 - k8s.io/component-base v0.26.16 // indirect; indirec3 - k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect + k8s.io/apiextensions-apiserver v0.27.13 // indirect + k8s.io/apiserver v0.27.13 // indirect + k8s.io/component-base v0.27.13 // indirect + k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) replace ( - k8s.io/api => k8s.io/api v0.26.13 - k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.26.13 - k8s.io/apimachinery => k8s.io/apimachinery v0.26.13 - k8s.io/apiserver => k8s.io/apiserver v0.26.13 - k8s.io/cli-runtime => k8s.io/cli-runtime v0.26.13 - k8s.io/client-go => k8s.io/client-go v0.26.13 - k8s.io/cloud-provider => k8s.io/cloud-provider v0.26.13 - k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.26.13 - k8s.io/code-generator => k8s.io/code-generator v0.26.13 - k8s.io/component-base => k8s.io/component-base v0.26.13 - k8s.io/component-helpers => k8s.io/component-helpers v0.26.13 - k8s.io/controller-manager => k8s.io/controller-manager v0.26.13 - k8s.io/cri-api => k8s.io/cri-api v0.26.13 - k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.26.13 - k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.26.13 - k8s.io/endpointslice => k8s.io/endpointslice v0.26.13 - k8s.io/kms => k8s.io/kms v0.26.13 - k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.26.13 - k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.26.13 - k8s.io/kube-proxy => k8s.io/kube-proxy v0.26.13 - k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.26.13 - k8s.io/kubectl => k8s.io/kubectl v0.26.13 - k8s.io/kubelet => k8s.io/kubelet v0.26.13 - k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.26.13 - k8s.io/metrics => k8s.io/metrics v0.26.13 - k8s.io/mount-utils => k8s.io/mount-utils v0.26.13 - k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.26.13 - k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.26.13 - k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.26.13 - k8s.io/sample-controller => k8s.io/sample-controller v0.26.13 + k8s.io/api => k8s.io/api v0.27.13 + k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.27.13 + k8s.io/apimachinery => k8s.io/apimachinery v0.27.13 + k8s.io/apiserver => k8s.io/apiserver v0.27.13 + k8s.io/cli-runtime => k8s.io/cli-runtime v0.27.13 + k8s.io/client-go => k8s.io/client-go v0.27.13 + k8s.io/cloud-provider => k8s.io/cloud-provider v0.27.13 + k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.27.13 + k8s.io/code-generator => k8s.io/code-generator v0.27.13 + k8s.io/component-base => k8s.io/component-base v0.27.13 + k8s.io/component-helpers => k8s.io/component-helpers v0.27.13 + k8s.io/controller-manager => k8s.io/controller-manager v0.27.13 + k8s.io/cri-api => k8s.io/cri-api v0.27.13 + k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.27.13 + k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.27.13 + k8s.io/endpointslice => k8s.io/endpointslice v0.27.13 + k8s.io/kms => k8s.io/kms v0.27.13 + k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.27.13 + k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.27.13 + k8s.io/kube-proxy => k8s.io/kube-proxy v0.27.13 + k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.27.13 + k8s.io/kubectl => k8s.io/kubectl v0.27.13 + k8s.io/kubelet => k8s.io/kubelet v0.27.13 + k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.27.13 + k8s.io/metrics => k8s.io/metrics v0.27.13 + k8s.io/mount-utils => k8s.io/mount-utils v0.27.13 + k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.27.13 + k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.27.13 + k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.27.13 + k8s.io/sample-controller => k8s.io/sample-controller v0.27.13 ) diff --git a/go.sum b/go.sum index d6530bde..4bf00ba9 100644 --- a/go.sum +++ b/go.sum @@ -5,37 +5,52 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/aws/aws-sdk-go-v2 v1.18.0 h1:882kkTpSFhdgYRKVZ/VCgf7sd0ru57p2JCxz4/oN5RY= github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= -github.com/aws/aws-sdk-go-v2/config v1.18.25 h1:JuYyZcnMPBiFqn87L2cRppo+rNwgah6YwD3VuyvaW6Q= +github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA= +github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM= github.com/aws/aws-sdk-go-v2/config v1.18.25/go.mod h1:dZnYpD5wTW/dQF0rRNLVypB396zWCcPiBIvdvSWHEg4= -github.com/aws/aws-sdk-go-v2/credentials v1.13.24 h1:PjiYyls3QdCrzqUN35jMWtUK1vqVZ+zLfdOa/UPFDp0= +github.com/aws/aws-sdk-go-v2/config v1.27.11 h1:f47rANd2LQEYHda2ddSCKYId18/8BhSRM4BULGmfgNA= +github.com/aws/aws-sdk-go-v2/config v1.27.11/go.mod h1:SMsV78RIOYdve1vf36z8LmnszlRWkwMQtomCAI0/mIE= github.com/aws/aws-sdk-go-v2/credentials v1.13.24/go.mod h1:jYPYi99wUOPIFi0rhiOvXeSEReVOzBqFNOX5bXYoG2o= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 h1:jJPgroehGvjrde3XufFIJUZVK5A2L9a3KwSFgKy9n8w= +github.com/aws/aws-sdk-go-v2/credentials v1.17.11 h1:YuIB1dJNf1Re822rriUOTxopaHHvIq0l/pX3fwO+Tzs= +github.com/aws/aws-sdk-go-v2/credentials v1.17.11/go.mod h1:AQtFPsDH9bI2O+71anW6EKL+NcD7LG3dpKGMV4SShgo= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3/go.mod h1:4Q0UFP0YJf0NrsEuEYHpM9fTSEVnD16Z3uyEF7J9JGM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33 h1:kG5eQilShqmJbv11XL1VpyDbaEJzWxd4zRiCG30GSn4= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 h1:FVJ0r5XTHSmIHJV6KuDmdYhEpvlHpiSd38RQWhut5J4= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1/go.mod h1:zusuAeqezXzAB24LGuzuekqMAEgWkVYukBec3kr3jUg= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.33/go.mod h1:7i0PF1ME/2eUPFcjkVIwq+DOygHEoK92t5cDqNgYbIw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27 h1:vFQlirhuM8lLlpI7imKOMsjdQLuN9CPi+k44F/OFVsk= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 h1:aw39xVGeRWlWx9EzGVnhOR4yOjQDHPQ6o6NmBlscyQg= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5/go.mod h1:FSaRudD0dXiMPK2UjknVwwTYyZMRsHv3TtkabsZih5I= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.27/go.mod h1:UrHnn3QV/d0pBZ6QBAEQcqFLf8FAzLmoUfPVIueOvoM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34 h1:gGLG7yKaXG02/jBlg210R7VgQIotiQntNhsCFejawx8= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 h1:PG1F3OD1szkuQPzDw3CIQsRIrtTlUC3lP84taWzHlq0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5/go.mod h1:jU1li6RFryMz+so64PpKtudI+QzbKoIEivqdf6LNpOc= github.com/aws/aws-sdk-go-v2/internal/ini v1.3.34/go.mod h1:Etz2dj6UHYuw+Xw830KfzCfWGMzqvUTCjUj5b76GVDc= -github.com/aws/aws-sdk-go-v2/service/ecr v1.18.11 h1:wlTgmb/sCmVRJrN5De3CiHj4v/bTCgL5+qpdEd0CPtw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 h1:hT8rVHwugYE2lEfdFE0QWVo81lF7jMrYJVDWI+f+VxU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0/go.mod h1:8tu/lYfQfFe6IGnaOdrpVgEL2IrrDOf6/m9RQum4NkY= github.com/aws/aws-sdk-go-v2/service/ecr v1.18.11/go.mod h1:Ce1q2jlNm8BVpjLaOnwnm5v2RClAbK6txwPljFzyW6c= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.16.2 h1:yflJrGmi1pXtP9lOpOeaNZyc0vXnJTuP2sor3nJcGGo= +github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4 h1:Qr9W21mzWT3RhfYn9iAux7CeRIdbnTAqmiOlASqQgZI= +github.com/aws/aws-sdk-go-v2/service/ecr v1.27.4/go.mod h1:if7ybzzjOmDB8pat9FE35AHTY6ZxlYSy3YviSmFZv8c= github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.16.2/go.mod h1:uHtRE7aqXNmpeYL+7Ec7LacH5zC9+w2T5MBOeEKDdu0= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27 h1:0iKliEXAcCa2qVtRs7Ot5hItA2MsufrphbRFlz1Owxo= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.4 h1:aNuiieMaS2IHxqAsTdM/pjHyY1aoaDLBGLqpNnFMMqk= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.23.4/go.mod h1:8pvvNAklmq+hKmqyvFoMRg0bwg9sdGOvdwximmKiKP0= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 h1:Ji0DY1xUsUr3I8cHps0G+XM3WWU16lP6yG8qu1GAZAs= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2/go.mod h1:5CsjAbs3NlGQyZNFACh+zztPDI7fU6eW9QsxjfnuBKg= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.27/go.mod h1:EOwBD4J4S5qYszS5/3DpkejfuK+Z5/1uzICfPaZLtqw= -github.com/aws/aws-sdk-go-v2/service/sso v1.12.10 h1:UBQjaMTCKwyUYwiVnUt6toEJwGXsLBI6al083tpjJzY= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 h1:ogRAwT1/gxJBcSWDMZlgyFUM962F51A5CRhDLbxLdmo= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7/go.mod h1:YCsIZhXfRPLFFCl5xxY+1T9RKzOKjCut+28JSX2DnAk= github.com/aws/aws-sdk-go-v2/service/sso v1.12.10/go.mod h1:ouy2P4z6sJN70fR3ka3wD3Ro3KezSxU6eKGQI2+2fjI= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10 h1:PkHIIJs8qvq0e5QybnZoG1K/9QTrLr9OsqCIo59jOBA= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 h1:vN8hEbpRnL7+Hopy9dzmRle1xmDc7o8tmY0klsr175w= +github.com/aws/aws-sdk-go-v2/service/sso v1.20.5/go.mod h1:qGzynb/msuZIE8I75DVRCUXw3o3ZyBmUvMwQ2t/BrGM= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.14.10/go.mod h1:AFvkxc8xfBe8XA+5St5XIHHrQQtkxqrRincx4hmMHOk= -github.com/aws/aws-sdk-go-v2/service/sts v1.19.0 h1:2DQLAKDteoEDI8zpCzqBMaZlJuoE9iTYD0gFmXVax9E= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 h1:Jux+gDDyi1Lruk+KHF91tK2KCuY61kzoCpvtvJJBtOE= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4/go.mod h1:mUYPBhaF2lGiukDEjJX2BLRRKTmoUSitGDUgM4tRxak= github.com/aws/aws-sdk-go-v2/service/sts v1.19.0/go.mod h1:BgQOMsg8av8jset59jelyPW7NoZcZXLVpDsXunGDrk8= -github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 h1:cwIxeBttqPN3qkaAjcEcsh8NYr8n2HZPkcKgPAi1phU= +github.com/aws/aws-sdk-go-v2/service/sts v1.28.6/go.mod h1:FZf1/nKNEkHdGGJP/cI2MoIMquumuRK6ol3QQJNDxmw= github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q= +github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E= github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230519004202-7f2db5bd753e h1:hli0IOU73/tNWARHav2a41uMg7arHx0Qbhgcm4bDKXI= github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20230519004202-7f2db5bd753e/go.mod h1:cheRroDS4qmOzi+Ue/oMHG4AV6n9F52W5QFdEKU59a0= -github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= @@ -64,23 +79,24 @@ github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnG github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= -github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= +github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= +github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v26.1.3+incompatible h1:bUpXT/N0kDE3VUHI2r5VMsYQgi38kYuoC0oL9yt3lqc= github.com/docker/cli v26.1.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v26.1.3+incompatible h1:lLCzRbrVZrljpVNobJu1J2FHk8V0s4BawoZippkc+xo= github.com/docker/docker v26.1.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= +github.com/docker/docker-credential-helpers v0.8.1 h1:j/eKUktUltBtMzKqmfLB0PAgqYyMHOp5vfsD1807oKo= +github.com/docker/docker-credential-helpers v0.8.1/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= -github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= -github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= +github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= @@ -89,8 +105,6 @@ github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJ github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -100,21 +114,18 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU= github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-logr/zapr v1.2.4 h1:QHVo+6stLbfJmYGkQ7uGHUCu5hnAFAj6mDe6Ea0SeOo= -github.com/go-logr/zapr v1.2.4/go.mod h1:FyHWQIzQORZ0QVE1BtVHv3cKtNLuXsbNLtpuhNapBOA= -github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonreference v0.20.0 h1:MYlu0sBgChmCfJxxUKZ8g1cPWFOB37YSZqewK7OKeyA= -github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.14 h1:gm3vOOXfiuw5i9p5N9xJvfjvuofpyvLA9Wr6QfK5Fng= -github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= +github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.1 h1:FBLnyygC4/IZZr893oiomc9XaghoveYTrLC1F86HID8= +github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -123,8 +134,6 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8= github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= @@ -144,11 +153,10 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -172,7 +180,6 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0QDGLKzqOmktBjT+Is= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU= github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= @@ -192,8 +199,8 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -202,10 +209,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= -github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -223,18 +228,8 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= -github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.17.2 h1:7eMhcy3GimbsA3hEnVKdw/PQM9XN9krpKVXsZdph0/g= github.com/onsi/ginkgo/v2 v2.17.2/go.mod h1:nP2DPOQoNsQmsVyv5rDA8JkXQoCs6goXIvr/PRJ1eCc= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= @@ -275,7 +270,6 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -293,7 +287,6 @@ github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RV github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= go.opentelemetry.io/otel v1.26.0 h1:LQwgL5s/1W7YiiRwxf03QGnWLb2HW4pLiAhaA5cZXBs= @@ -310,16 +303,12 @@ go.opentelemetry.io/otel/trace v1.26.0 h1:1ieeAUb4y0TE26jUFrCIXKpTuVK7uJGN9/Z/2L go.opentelemetry.io/otel/trace v1.26.0/go.mod h1:4iDxvGDQuUkHve82hJJ8UqrwswHYsZuWCBllGV2U2y0= go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94= go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A= -go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/automaxprocs v1.5.3 h1:kWazyxZUrS3Gs4qUpbwo5kEIMGe/DAvi5Z4tl2NW4j8= go.uber.org/automaxprocs v1.5.3/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= -go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= @@ -331,29 +320,24 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= -golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f h1:99ci1mjWVBWwJiEKYY6jWa4d2nTQVIEhZIptnrVb1XY= +golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -364,22 +348,12 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -389,7 +363,6 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -406,9 +379,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -441,7 +412,6 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= @@ -449,18 +419,12 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -473,30 +437,30 @@ gotest.tools/v3 v3.0.3 h1:4AuOwCGf4lLR9u3YOe2awrHygurzhO/HeQ6laiA6Sx0= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.26.13 h1:65j5feDeimcvWLjxYyiSmCpQrV4cArU3DJQjAtPOmos= -k8s.io/api v0.26.13/go.mod h1:VXIh4xfQZf+gHowQ43lFgohkElTBwZ8hQjikp1Bkm2c= -k8s.io/apiextensions-apiserver v0.26.13 h1:eb4fGFYWU5IX+BdajL8lPrxk+TutekKPuHkHYpM1waE= -k8s.io/apiextensions-apiserver v0.26.13/go.mod h1:Ux/bcBgpMd0po5Mo2Z3Mez6gMvjzKMWQi/zHUnLn5uw= -k8s.io/apimachinery v0.26.13 h1:gTwNkZp+qrfZuhQFMD594ggzvcr06mbgAtLBTbdc4Mg= -k8s.io/apimachinery v0.26.13/go.mod h1:2/HZp0l6coXtS26du1Bk36fCuAEr/lVs9Q9NbpBtd1Y= -k8s.io/apiserver v0.26.13 h1:jnzAsozh94IEkdZrdEW5mHqiW/7stTQDPIdRmo0DD2Y= -k8s.io/apiserver v0.26.13/go.mod h1:lGSp1jJwLRhYIzGiEA+VuYa4pQbHlPnP4x5oP1ue4GE= -k8s.io/client-go v0.26.13 h1:KBIXrz1Rbkuq586BOWoGuNi79pGJM4uAbYg8F83u0Vk= -k8s.io/client-go v0.26.13/go.mod h1:Cc2v7fVnJ1a9wj11fv12fhoFIjqbZT/Ksono6bK0iw8= -k8s.io/component-base v0.26.13 h1:NiygriNjTaEhbv0P6h49GXnKG0cELGcQywFs8ITUSK4= -k8s.io/component-base v0.26.13/go.mod h1:ptCvZ+D/a0ojYB5QV+dn4qGM8oBoRaCV/iDBIY+p3ao= +k8s.io/api v0.27.13 h1:d49LYs1dh+JMMDNYQSu8FhEzCjc2TNpYvDWoSGAKs80= +k8s.io/api v0.27.13/go.mod h1:W3lYMPs34i0XQA+cmKfejve+HwbRZjy67fL05RyJUTo= +k8s.io/apiextensions-apiserver v0.27.13 h1:it32SCkrjzhimZasL++nsshG66m2O570y56R+xj1/WE= +k8s.io/apiextensions-apiserver v0.27.13/go.mod h1:LkAz0+pjqr/92kPigX/B2sjsPhGCuG+hi8GyyjUNNsE= +k8s.io/apimachinery v0.27.13 h1:xDAnOWaRVNSkaKdfB0Ab11hixH90KGTbLwEHMloMjFM= +k8s.io/apimachinery v0.27.13/go.mod h1:TWo+8wOIz3CytsrlI9k/LBWXLRr9dqf5hRSCbbggMAg= +k8s.io/apiserver v0.27.13 h1:Yf69zVdbuQVIMpz7N4dtntWsUklKpcFXGAdVh7vKOH4= +k8s.io/apiserver v0.27.13/go.mod h1:XHth2MKAUdcLvdhPOwvDPbSyOrMev2vRqE05oUEC5Hk= +k8s.io/client-go v0.27.13 h1:SfUbIukb6BSqaadlYRX0AzMoN6+e+9FZGEKqfisidho= +k8s.io/client-go v0.27.13/go.mod h1:I9SBaI28r6ii465Fb0dTpf5O3adOnDwNBoeqlDNbbFg= +k8s.io/component-base v0.27.13 h1:JuDLZqD8L+Wu9nUNv9msjQjkh172Ag6crphzASEvlKo= +k8s.io/component-base v0.27.13/go.mod h1:QKur/xRE4R25PhScEe3lAhrVSwEuZPGlFPyEDOaWCgU= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= -k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= -k8s.io/kubernetes v1.26.13 h1:35SetZIBad4bsvQgLwLs8/m4isGB5aw+WGheuxqR2LU= -k8s.io/kubernetes v1.26.13/go.mod h1:Y5N3uFKuSpAI0lqQ8Qo8GY/T3St+nWPs/0k8atin6E8= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= +k8s.io/kubernetes v1.27.13 h1:5NBz3aNy5Jwcgi+w2+rP4x5B0Wa21NXUJxDJwdUtxlY= +k8s.io/kubernetes v1.27.13/go.mod h1:T4toI2XSWG5FJoq/H8q9eFYPymAxe/k4UnaC00uPnMs= k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -sigs.k8s.io/controller-runtime v0.14.1 h1:vThDes9pzg0Y+UbCPY3Wj34CGIYPgdmspPm2GIpxpzM= -sigs.k8s.io/controller-runtime v0.14.1/go.mod h1:GaRkrY8a7UZF0kqFFbUKG7n9ICiTY5T55P1RiE3UZlU= +sigs.k8s.io/controller-runtime v0.15.0 h1:ML+5Adt3qZnMSYxZ7gAverBLNPSMQEibtzAgp0UPojU= +sigs.k8s.io/controller-runtime v0.15.0/go.mod h1:7ngYvp1MLT+9GeZ+6lH3LOlcHkp/+tzA/fmHa4iq9kk= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/controllers/collector.go b/internal/controller/collector.go similarity index 97% rename from controllers/collector.go rename to internal/controller/collector.go index 912ddb18..345ce05a 100644 --- a/controllers/collector.go +++ b/internal/controller/collector.go @@ -1,10 +1,10 @@ -package controllers +package controller import ( "context" "strconv" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" kuikMetrics "github.com/enix/kube-image-keeper/internal/metrics" "github.com/prometheus/client_golang/prometheus" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/pod_controller.go b/internal/controller/core/pod_controller.go similarity index 93% rename from controllers/pod_controller.go rename to internal/controller/core/pod_controller.go index 63dae4a5..15839a6c 100644 --- a/controllers/pod_controller.go +++ b/internal/controller/core/pod_controller.go @@ -1,4 +1,4 @@ -package controllers +package core import ( "context" @@ -12,7 +12,7 @@ import ( "k8s.io/apimachinery/pkg/types" "github.com/distribution/reference" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" "github.com/enix/kube-image-keeper/internal/registry" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -26,10 +26,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - "sigs.k8s.io/controller-runtime/pkg/source" ) -const cachedImageOwnerKey = ".metadata.podOwner" +const CachedImageOwnerKey = ".metadata.podOwner" const LabelManagedName = "kuik.enix.io/managed" const AnnotationRewriteImagesName = "kuik.enix.io/rewrite-images" @@ -68,7 +67,7 @@ func (r *PodReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.R return ctrl.Result{}, nil } - cachedImages := desiredCachedImages(ctx, &pod) + cachedImages := DesiredCachedImages(ctx, &pod) repositories, err := r.desiredRepositories(ctx, &pod, cachedImages) if err != nil { return ctrl.Result{}, client.IgnoreNotFound(err) @@ -142,23 +141,23 @@ func (r *PodReconciler) SetupWithManager(mgr ctrl.Manager) error { return ok }))). Watches( - &source.Kind{Type: &kuikv1alpha1.CachedImage{}}, + &kuikv1alpha1.CachedImage{}, handler.EnqueueRequestsFromMapFunc(r.podsWithDeletingCachedImages), builder.WithPredicates(p), ). Complete(r) } -func (r *PodReconciler) podsWithDeletingCachedImages(obj client.Object) []ctrl.Request { +func (r *PodReconciler) podsWithDeletingCachedImages(ctx context.Context, obj client.Object) []ctrl.Request { log := log. - FromContext(context.Background()). + FromContext(ctx). WithName("controller-runtime.manager.controller.pod.deletingCachedImages"). WithValues("cachedImage", klog.KObj(obj)) cachedImage := obj.(*kuikv1alpha1.CachedImage) var currentCachedImage kuikv1alpha1.CachedImage // wait for the CachedImage to be really deleted - if err := r.Get(context.Background(), client.ObjectKeyFromObject(cachedImage), ¤tCachedImage); err == nil || !apierrors.IsNotFound(err) { + if err := r.Get(ctx, client.ObjectKeyFromObject(cachedImage), ¤tCachedImage); err == nil || !apierrors.IsNotFound(err) { return make([]ctrl.Request, 0) } @@ -166,7 +165,7 @@ func (r *PodReconciler) podsWithDeletingCachedImages(obj client.Object) []ctrl.R podRequirements, _ := labels.NewRequirement(LabelManagedName, selection.Equals, []string{"true"}) selector := labels.NewSelector() selector = selector.Add(*podRequirements) - if err := r.List(context.Background(), &podList, &client.ListOptions{ + if err := r.List(ctx, &podList, &client.ListOptions{ LabelSelector: selector, }); err != nil { log.Error(err, "could not list pods") @@ -217,7 +216,7 @@ func (r *PodReconciler) desiredRepositories(ctx context.Context, pod *corev1.Pod return maps.Values(repositories), nil } -func desiredCachedImages(ctx context.Context, pod *corev1.Pod) []kuikv1alpha1.CachedImage { +func DesiredCachedImages(ctx context.Context, pod *corev1.Pod) []kuikv1alpha1.CachedImage { cachedImages := desiredCachedImagesForContainers(ctx, pod.Spec.Containers, pod.Annotations, false) cachedImages = append(cachedImages, desiredCachedImagesForContainers(ctx, pod.Spec.InitContainers, pod.Annotations, true)...) return cachedImages diff --git a/controllers/pod_controller_test.go b/internal/controller/core/pod_controller_test.go similarity index 85% rename from controllers/pod_controller_test.go rename to internal/controller/core/pod_controller_test.go index 7fcf3a1c..54216cf1 100644 --- a/controllers/pod_controller_test.go +++ b/internal/controller/core/pod_controller_test.go @@ -1,14 +1,13 @@ -package controllers +package core import ( "context" "testing" "time" - "github.com/enix/kube-image-keeper/api/v1alpha1" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" "github.com/enix/kube-image-keeper/internal/registry" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -58,12 +57,12 @@ func TestDesiredCachedImages(t *testing.T) { tests := []struct { name string pod corev1.Pod - cachedImages []v1alpha1.CachedImage + cachedImages []kuikv1alpha1.CachedImage }{ { name: "basic", pod: podStub, - cachedImages: []v1alpha1.CachedImage{ + cachedImages: []kuikv1alpha1.CachedImage{ {Spec: kuikv1alpha1.CachedImageSpec{ SourceImage: "nginx", }}, @@ -80,7 +79,7 @@ func TestDesiredCachedImages(t *testing.T) { g := NewWithT(t) for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - cachedImages := desiredCachedImages(context.Background(), &tt.pod) + cachedImages := DesiredCachedImages(context.Background(), &tt.pod) g.Expect(cachedImages).To(HaveLen(len(tt.cachedImages))) for i, cachedImage := range cachedImages { g.Expect(cachedImage.Spec.SourceImage).To(Equal(tt.cachedImages[i].Spec.SourceImage)) @@ -135,7 +134,6 @@ var _ = Describe("Pod Controller", func() { const interval = time.Second * 1 BeforeEach(func() { - // Add any setup steps that needs to be executed before each test }) AfterEach(func() { @@ -174,17 +172,6 @@ var _ = Describe("Pod Controller", func() { By("Deleting previously created pod") Expect(k8sClient.Delete(context.Background(), &podStub)).Should(Succeed()) - - Eventually(func() []kuikv1alpha1.CachedImage { - expiringCachedImages := []kuikv1alpha1.CachedImage{} - _ = k8sClient.List(context.Background(), fetched) - for _, cachedImage := range fetched.Items { - if cachedImage.Spec.ExpiresAt != nil { - expiringCachedImages = append(expiringCachedImages, cachedImage) - } - } - return expiringCachedImages - }, timeout, interval).Should(HaveLen(len(podStub.Spec.Containers) + len(podStub.Spec.InitContainers))) }) It("Should not create CachedImages", func() { By("Creating a pod without rewriting images") diff --git a/internal/controller/core/suite_test.go b/internal/controller/core/suite_test.go new file mode 100644 index 00000000..21cedb86 --- /dev/null +++ b/internal/controller/core/suite_test.go @@ -0,0 +1,93 @@ +package core + +import ( + "context" + "os" + "path/filepath" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + corev1 "k8s.io/api/core/v1" + + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" + //+kubebuilder:scaffold:imports +) + +// These tests use Ginkgo (BDD-style Go testing framework). Refer to +// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. + +var cfg *rest.Config +var k8sClient client.Client +var testEnv *envtest.Environment +var ctx context.Context +var cancel context.CancelFunc + +func TestAPIs(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "Controller Suite") +} + +var _ = BeforeSuite(func() { + logf.SetLogger(zap.New(zap.WriteTo(os.Stdout), zap.UseDevMode(true))) + + ctx, cancel = context.WithCancel(context.TODO()) + + By("bootstrapping test environment") + testEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, + ErrorIfCRDPathMissing: true, + } + + var err error + // cfg is defined in this file globally. + cfg, err = testEnv.Start() + Expect(err).NotTo(HaveOccurred()) + Expect(cfg).NotTo(BeNil()) + + err = kuikv1alpha1.AddToScheme(scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) + + err = corev1.AddToScheme(scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) + + //+kubebuilder:scaffold:scheme + + k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) + Expect(err).NotTo(HaveOccurred()) + Expect(k8sClient).NotTo(BeNil()) + + k8sManager, err := ctrl.NewManager(cfg, ctrl.Options{ + Scheme: scheme.Scheme, + }) + Expect(err).ToNot(HaveOccurred()) + + err = (&PodReconciler{ + Client: k8sManager.GetClient(), + Scheme: k8sManager.GetScheme(), + }).SetupWithManager(k8sManager) + Expect(err).ToNot(HaveOccurred()) + + go func() { + defer GinkgoRecover() + err = k8sManager.Start(ctx) + Expect(err).ToNot(HaveOccurred(), "failed to run manager") + }() +}) + +var _ = AfterSuite(func() { + cancel() + By("tearing down the test environment") + err := testEnv.Stop() + Expect(err).NotTo(HaveOccurred()) +}) diff --git a/controllers/force_name.go b/internal/controller/force_name.go similarity index 95% rename from controllers/force_name.go rename to internal/controller/force_name.go index 259b4bce..1d583607 100644 --- a/controllers/force_name.go +++ b/internal/controller/force_name.go @@ -1,4 +1,4 @@ -package controllers +package controller import ( "context" @@ -11,7 +11,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" ) -func forceName(c client.Client, ctx context.Context, newName string, obj client.Object, finalizerName string) error { +func ForceName(c client.Client, ctx context.Context, newName string, obj client.Object, finalizerName string) error { log := log.FromContext(ctx) kind := obj.GetObjectKind().GroupVersionKind().Kind diff --git a/controllers/healthz.go b/internal/controller/healthz.go similarity index 92% rename from controllers/healthz.go rename to internal/controller/healthz.go index fb1e3505..88320f47 100644 --- a/controllers/healthz.go +++ b/internal/controller/healthz.go @@ -1,4 +1,4 @@ -package controllers +package controller import ( "net/http" diff --git a/controllers/cachedimage_controller.go b/internal/controller/kuik/cachedimage_controller.go similarity index 92% rename from controllers/cachedimage_controller.go rename to internal/controller/kuik/cachedimage_controller.go index 9eb10af9..7ab7394c 100644 --- a/controllers/cachedimage_controller.go +++ b/internal/controller/kuik/cachedimage_controller.go @@ -1,4 +1,4 @@ -package controllers +package kuik import ( "context" @@ -27,10 +27,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - "sigs.k8s.io/controller-runtime/pkg/source" - "github.com/enix/kube-image-keeper/api/v1alpha1" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" + kuikController "github.com/enix/kube-image-keeper/internal/controller" + "github.com/enix/kube-image-keeper/internal/controller/core" "github.com/enix/kube-image-keeper/internal/registry" ) @@ -91,7 +91,7 @@ func (r *CachedImageReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{}, err } - if err := forceName(r.Client, ctx, sanitizedName, &cachedImage, cachedImageFinalizerName); err != nil { + if err := kuikController.ForceName(r.Client, ctx, sanitizedName, &cachedImage, cachedImageFinalizerName); err != nil { return ctrl.Result{}, err } @@ -140,7 +140,7 @@ func (r *CachedImageReconciler) Reconcile(ctx context.Context, req ctrl.Request) return ctrl.Result{}, err } r.Recorder.Eventf(&cachedImage, "Normal", "CleanedUp", "Image %s successfully removed from cache", cachedImage.Spec.SourceImage) - imageRemovedFromCache.Inc() + // imageRemovedFromCache.Inc() log.Info("removing finalizer") controllerutil.RemoveFinalizer(&cachedImage, cachedImageFinalizerName) @@ -237,7 +237,7 @@ func (r *CachedImageReconciler) Reconcile(ctx context.Context, req ctrl.Request) } else { log.Info("image cached") r.Recorder.Eventf(&cachedImage, "Normal", "Cached", "Successfully cached image %s", cachedImage.Spec.SourceImage) - imagePutInCache.Inc() + // imagePutInCache.Inc() } } else { log.Info("image already present in cache, ignoring") @@ -370,9 +370,9 @@ func (r *CachedImageReconciler) patchPhase(cachedImage *kuikv1alpha1.CachedImage // SetupWithManager sets up the controller with the Manager. func (r *CachedImageReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrentReconciles int) error { // Create an index to list Pods by CachedImage - if err := mgr.GetFieldIndexer().IndexField(context.Background(), &corev1.Pod{}, cachedImageOwnerKey, func(rawObj client.Object) []string { + if err := mgr.GetFieldIndexer().IndexField(context.Background(), &corev1.Pod{}, core.CachedImageOwnerKey, func(rawObj client.Object) []string { pod := rawObj.(*corev1.Pod) - if _, ok := pod.Labels[LabelManagedName]; !ok { + if _, ok := pod.Labels[core.LabelManagedName]; !ok { return []string{} } @@ -381,7 +381,7 @@ func (r *CachedImageReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrent WithValues("pod", klog.KObj(pod)) ctx := logr.NewContext(context.Background(), logger) - cachedImages := desiredCachedImages(ctx, pod) + cachedImages := core.DesiredCachedImages(ctx, pod) cachedImageNames := make([]string, len(cachedImages)) for _, cachedImage := range cachedImages { @@ -396,7 +396,7 @@ func (r *CachedImageReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrent return ctrl.NewControllerManagedBy(mgr). For(&kuikv1alpha1.CachedImage{}). Watches( - &source.Kind{Type: &corev1.Pod{}}, + &corev1.Pod{}, handler.EnqueueRequestsFromMapFunc(r.cachedImagesRequestFromPod), builder.WithPredicates(predicate.Funcs{ // GenericFunc: func(e event.GenericEvent) bool { @@ -412,7 +412,7 @@ func (r *CachedImageReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrent }), ). Watches( - &source.Kind{Type: &corev1.Pod{}}, + &corev1.Pod{}, handler.EnqueueRequestsFromMapFunc(r.cachedImagesRequestFromPod), builder.WithPredicates(predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { @@ -435,19 +435,19 @@ func (r *CachedImageReconciler) SetupWithManager(mgr ctrl.Manager, maxConcurrent // updatePodCount update CachedImage UsedBy status func (r *CachedImageReconciler) updatePodCount(ctx context.Context, cachedImage *kuikv1alpha1.CachedImage) (requeue bool, err error) { var podsList corev1.PodList - if err = r.List(ctx, &podsList, client.MatchingFields{cachedImageOwnerKey: cachedImage.Name}); err != nil && !apierrors.IsNotFound(err) { + if err = r.List(ctx, &podsList, client.MatchingFields{core.CachedImageOwnerKey: cachedImage.Name}); err != nil && !apierrors.IsNotFound(err) { return } - pods := []v1alpha1.PodReference{} + pods := []kuikv1alpha1.PodReference{} for _, pod := range podsList.Items { if !pod.DeletionTimestamp.IsZero() { continue } - pods = append(pods, v1alpha1.PodReference{NamespacedName: pod.Namespace + "/" + pod.Name}) + pods = append(pods, kuikv1alpha1.PodReference{NamespacedName: pod.Namespace + "/" + pod.Name}) } - cachedImage.Status.UsedBy = v1alpha1.UsedBy{ + cachedImage.Status.UsedBy = kuikv1alpha1.UsedBy{ Pods: pods, Count: len(pods), } @@ -463,15 +463,9 @@ func (r *CachedImageReconciler) updatePodCount(ctx context.Context, cachedImage return } -func (r *CachedImageReconciler) cachedImagesRequestFromPod(obj client.Object) []ctrl.Request { - log := log. - FromContext(context.Background()). - WithName("controller-runtime.manager.controller.cachedImage.deletingPods"). - WithValues("pod", klog.KObj(obj)) - +func (r *CachedImageReconciler) cachedImagesRequestFromPod(ctx context.Context, obj client.Object) []ctrl.Request { pod := obj.(*corev1.Pod) - ctx := logr.NewContext(context.Background(), log) - cachedImages := desiredCachedImages(ctx, pod) + cachedImages := core.DesiredCachedImages(ctx, pod) res := []ctrl.Request{} for _, cachedImage := range cachedImages { diff --git a/internal/controller/kuik/cachedimage_controller_test.go b/internal/controller/kuik/cachedimage_controller_test.go new file mode 100644 index 00000000..ad847fba --- /dev/null +++ b/internal/controller/kuik/cachedimage_controller_test.go @@ -0,0 +1,71 @@ +package kuik + +import ( + "context" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var _ = Describe("CachedImage Controller", func() { + + const timeout = time.Second * 30 + const interval = time.Second * 1 + + Context("When creating CachedImages", func() { + It("Should expire image that are not retained only", func() { + fetched := &kuikv1alpha1.CachedImageList{} + + By("Creating an image without the retain flag", func() { + Expect(k8sClient.Create(context.Background(), &kuikv1alpha1.CachedImage{ + ObjectMeta: v1.ObjectMeta{ + Name: "nginx", + }, + Spec: kuikv1alpha1.CachedImageSpec{ + SourceImage: "nginx", + }, + })).Should(Succeed()) + + Eventually(func() []kuikv1alpha1.CachedImage { + expiringCachedImages := []kuikv1alpha1.CachedImage{} + _ = k8sClient.List(context.Background(), fetched) + for _, cachedImage := range fetched.Items { + if cachedImage.Spec.ExpiresAt != nil { + expiringCachedImages = append(expiringCachedImages, cachedImage) + } + } + return expiringCachedImages + }, timeout, interval).Should(HaveLen(1)) + }) + + By("Creating an expiring image with the retain flag", func() { + Expect(k8sClient.Create(context.Background(), &kuikv1alpha1.CachedImage{ + ObjectMeta: v1.ObjectMeta{ + Name: "alpine", + }, + Spec: kuikv1alpha1.CachedImageSpec{ + SourceImage: "alpine", + Retain: true, + ExpiresAt: &v1.Time{Time: time.Now().Add(time.Hour)}, + }, + })).Should(Succeed()) + + Eventually(func() []kuikv1alpha1.CachedImage { + expiringCachedImages := []kuikv1alpha1.CachedImage{} + _ = k8sClient.List(context.Background(), fetched) + for _, cachedImage := range fetched.Items { + if cachedImage.Spec.ExpiresAt != nil { + expiringCachedImages = append(expiringCachedImages, cachedImage) + } + } + return expiringCachedImages + }, timeout, interval).Should(HaveLen(1)) + }) + + }) + }) +}) diff --git a/controllers/repository_controller.go b/internal/controller/kuik/repository_controller.go similarity index 94% rename from controllers/repository_controller.go rename to internal/controller/kuik/repository_controller.go index 66d54a44..1d865b07 100644 --- a/controllers/repository_controller.go +++ b/internal/controller/kuik/repository_controller.go @@ -1,4 +1,4 @@ -package controllers +package kuik import ( "context" @@ -19,9 +19,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/handler" "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/predicate" - "sigs.k8s.io/controller-runtime/pkg/source" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" + kuikController "github.com/enix/kube-image-keeper/internal/controller" "github.com/enix/kube-image-keeper/internal/registry" ) @@ -63,7 +63,7 @@ func (r *RepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Request) // Handle repositories with an invalid name sanitizedName := registry.SanitizeName(repository.Spec.Name) - if err := forceName(r.Client, ctx, sanitizedName, &repository, repositoryFinalizerName); err != nil { + if err := kuikController.ForceName(r.Client, ctx, sanitizedName, &repository, repositoryFinalizerName); err != nil { return ctrl.Result{}, err } @@ -237,7 +237,7 @@ func (r *RepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&kuikv1alpha1.Repository{}). Watches( - &source.Kind{Type: &kuikv1alpha1.CachedImage{}}, + &kuikv1alpha1.CachedImage{}, handler.EnqueueRequestsFromMapFunc(r.repositoryWithDeletingCachedImages), builder.WithPredicates(predicate.Funcs{ DeleteFunc: func(e event.DeleteEvent) bool { @@ -246,7 +246,7 @@ func (r *RepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error { }), ). Watches( - &source.Kind{Type: &kuikv1alpha1.CachedImage{}}, + &kuikv1alpha1.CachedImage{}, handler.EnqueueRequestsFromMapFunc(requestRepositoryFromCachedImage), builder.WithPredicates(predicate.Funcs{ CreateFunc: func(e event.CreateEvent) bool { @@ -260,7 +260,7 @@ func (r *RepositoryReconciler) SetupWithManager(mgr ctrl.Manager) error { Complete(r) } -func (r *RepositoryReconciler) repositoryWithDeletingCachedImages(obj client.Object) []ctrl.Request { +func (r *RepositoryReconciler) repositoryWithDeletingCachedImages(ctx context.Context, obj client.Object) []ctrl.Request { cachedImage := obj.(*kuikv1alpha1.CachedImage) var currentCachedImage kuikv1alpha1.CachedImage // wait for the CachedImage to be really deleted @@ -268,10 +268,10 @@ func (r *RepositoryReconciler) repositoryWithDeletingCachedImages(obj client.Obj return nil } - return requestRepositoryFromCachedImage(cachedImage) + return requestRepositoryFromCachedImage(ctx, cachedImage) } -func requestRepositoryFromCachedImage(obj client.Object) []ctrl.Request { +func requestRepositoryFromCachedImage(ctx context.Context, obj client.Object) []ctrl.Request { cachedImage := obj.(*kuikv1alpha1.CachedImage) repositoryName, ok := cachedImage.Labels[kuikv1alpha1.RepositoryLabelName] if !ok { diff --git a/controllers/suite_test.go b/internal/controller/kuik/suite_test.go similarity index 81% rename from controllers/suite_test.go rename to internal/controller/kuik/suite_test.go index 9d0a8a67..85e6ed2a 100644 --- a/controllers/suite_test.go +++ b/internal/controller/kuik/suite_test.go @@ -1,4 +1,20 @@ -package controllers +/* +Copyright 2024. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kuik import ( "context" @@ -10,11 +26,11 @@ import ( "github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/image" - dockerClient "github.com/docker/docker/client" - "github.com/docker/go-connections/nat" - . "github.com/onsi/ginkgo" + . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + dockerClient "github.com/docker/docker/client" + "github.com/docker/go-connections/nat" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" ctrl "sigs.k8s.io/controller-runtime" @@ -23,9 +39,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - corev1 "k8s.io/api/core/v1" - - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" "github.com/enix/kube-image-keeper/internal/registry" //+kubebuilder:scaffold:imports ) @@ -41,12 +55,6 @@ var cancel context.CancelFunc var registryContainerId string var dockerClientApiVersion = os.Getenv("DOCKER_CLIENT_API_VERSION") -func TestAPIs(t *testing.T) { - RegisterFailHandler(Fail) - - RunSpecs(t, "Controller Suite") -} - func setupRegistry() { client, err := dockerClient.NewClientWithOpts(dockerClient.FromEnv, dockerClient.WithVersion(dockerClientApiVersion)) Expect(err).NotTo(HaveOccurred()) @@ -103,14 +111,20 @@ func removeRegistry() { Expect(err).NotTo(HaveOccurred()) } +func TestControllers(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "Controller Suite") +} + var _ = BeforeSuite(func() { - logf.SetLogger(zap.New(zap.WriteTo(os.Stdout), zap.UseDevMode(true))) + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) ctx, cancel = context.WithCancel(context.TODO()) By("bootstrapping test environment") testEnv = &envtest.Environment{ - CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")}, + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, ErrorIfCRDPathMissing: true, } @@ -123,9 +137,6 @@ var _ = BeforeSuite(func() { err = kuikv1alpha1.AddToScheme(scheme.Scheme) Expect(err).NotTo(HaveOccurred()) - err = corev1.AddToScheme(scheme.Scheme) - Expect(err).NotTo(HaveOccurred()) - //+kubebuilder:scaffold:scheme setupRegistry() @@ -135,7 +146,8 @@ var _ = BeforeSuite(func() { Expect(k8sClient).NotTo(BeNil()) k8sManager, err := ctrl.NewManager(cfg, ctrl.Options{ - Scheme: scheme.Scheme, + Scheme: scheme.Scheme, + MetricsBindAddress: ":8081", }) Expect(err).ToNot(HaveOccurred()) @@ -148,17 +160,12 @@ var _ = BeforeSuite(func() { }).SetupWithManager(k8sManager, 3) Expect(err).ToNot(HaveOccurred()) - err = (&PodReconciler{ - Client: k8sManager.GetClient(), - Scheme: k8sManager.GetScheme(), - }).SetupWithManager(k8sManager) - Expect(err).ToNot(HaveOccurred()) - go func() { defer GinkgoRecover() err = k8sManager.Start(ctx) Expect(err).ToNot(HaveOccurred(), "failed to run manager") }() + }) var _ = AfterSuite(func() { diff --git a/internal/proxy/server.go b/internal/proxy/server.go index d2ff6c8b..dbc57a32 100644 --- a/internal/proxy/server.go +++ b/internal/proxy/server.go @@ -13,7 +13,7 @@ import ( "strings" "github.com/distribution/reference" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" "github.com/enix/kube-image-keeper/internal/metrics" "github.com/enix/kube-image-keeper/internal/registry" "github.com/gin-gonic/gin" diff --git a/internal/scheme/scheme.go b/internal/scheme/scheme.go index 52507495..a685106d 100644 --- a/internal/scheme/scheme.go +++ b/internal/scheme/scheme.go @@ -10,7 +10,7 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" - kuikv1alpha1 "github.com/enix/kube-image-keeper/api/v1alpha1" + kuikv1alpha1 "github.com/enix/kube-image-keeper/api/kuik/v1alpha1" //+kubebuilder:scaffold:imports ) diff --git a/main.go b/main.go deleted file mode 120000 index 285c239a..00000000 --- a/main.go +++ /dev/null @@ -1 +0,0 @@ -cmd/cache/main.go \ No newline at end of file