From 10f7bcda336225257d4cdf703f86d93da8f8b84b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:08:31 +0100 Subject: [PATCH 01/13] add new rule in pod mutatingwebhook to cath the updates of the pod's resize subresource --- ...enerate_resources_pod_mutating_webhooks.go | 64 ++++++++++--------- 1 file changed, 34 insertions(+), 30 deletions(-) diff --git a/internal/resources/generate_resources_pod_mutating_webhooks.go b/internal/resources/generate_resources_pod_mutating_webhooks.go index 6f11e46..05f7a19 100644 --- a/internal/resources/generate_resources_pod_mutating_webhooks.go +++ b/internal/resources/generate_resources_pod_mutating_webhooks.go @@ -175,7 +175,7 @@ func getSelectorClassNotExist(label string) *metav1.LabelSelector { } } -func getMatchCondition(isDefault bool, name string, excludedNamespaces string, label string) []admissionv1.MatchCondition { +func getMatchCondition(excludedNamespaces string) []admissionv1.MatchCondition { matchConditions := []admissionv1.MatchCondition{} matchConditions = append(matchConditions, admissionv1.MatchCondition{ Name: "exclude-namespaces", @@ -202,11 +202,36 @@ func getObjectSelector(isDefault bool, label string, name string) *metav1.LabelS } func CreateMutatingWebhookConfiguration(class overcommit.OvercommitClass, svc corev1.Service, cert certmanager.Certificate, label string) *admissionv1.MutatingWebhookConfiguration { - var path = "/mutate--v1-pod" var scope = admissionv1.NamespacedScope var policy = admissionv1.Fail var sideEffect = admissionv1.SideEffectClassNone + var reinvocationPolicy = admissionv1.IfNeededReinvocationPolicy + + rules := []admissionv1.RuleWithOperations{ + { + Operations: []admissionv1.OperationType{ + admissionv1.Create, + }, + Rule: admissionv1.Rule{ + APIGroups: []string{""}, + APIVersions: []string{"v1"}, + Resources: []string{"pods"}, + Scope: &scope, + }, + }, + { + Operations: []admissionv1.OperationType{ + admissionv1.Update, + }, + Rule: admissionv1.Rule{ + APIGroups: []string{""}, + APIVersions: []string{"v1"}, + Resources: []string{"pods/resize"}, + Scope: &scope, + }, + }, + } webhookConfig := &admissionv1.MutatingWebhookConfiguration{ ObjectMeta: metav1.ObjectMeta{ @@ -225,23 +250,12 @@ func CreateMutatingWebhookConfiguration(class overcommit.OvercommitClass, svc co Path: &path, }, }, - Rules: []admissionv1.RuleWithOperations{ - { - Operations: []admissionv1.OperationType{ - admissionv1.Create, - }, - Rule: admissionv1.Rule{ - APIGroups: []string{""}, - APIVersions: []string{"v1"}, - Resources: []string{"pods"}, - Scope: &scope, - }, - }, - }, + Rules: rules, AdmissionReviewVersions: []string{"v1"}, FailurePolicy: &policy, SideEffects: &sideEffect, - MatchConditions: getMatchCondition(false, class.Name, class.Spec.ExcludedNamespaces, label), + ReinvocationPolicy: &reinvocationPolicy, + MatchConditions: getMatchCondition(class.Spec.ExcludedNamespaces), ObjectSelector: getObjectSelector(false, label, class.Name), }, }, @@ -257,25 +271,15 @@ func CreateMutatingWebhookConfiguration(class overcommit.OvercommitClass, svc co Path: &path, }, }, - Rules: []admissionv1.RuleWithOperations{ - { - Operations: []admissionv1.OperationType{ - admissionv1.Create, - }, - Rule: admissionv1.Rule{ - APIGroups: []string{""}, - APIVersions: []string{"v1"}, - Resources: []string{"pods"}, - Scope: &scope, - }, - }, - }, + Rules: rules, AdmissionReviewVersions: []string{"v1"}, FailurePolicy: &policy, SideEffects: &sideEffect, - MatchConditions: getMatchCondition(class.Spec.IsDefault, class.Name, class.Spec.ExcludedNamespaces, label), + ReinvocationPolicy: &reinvocationPolicy, + MatchConditions: getMatchCondition(class.Spec.ExcludedNamespaces), ObjectSelector: getObjectSelector(class.Spec.IsDefault, label, class.Name), }) } + return webhookConfig } From 1b474c3069235eeaae32c465faa7b9c2e74a67c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:11:46 +0100 Subject: [PATCH 02/13] add new function for make overcommit on resize operations --- pkg/overcommit/make_overcommit.go | 118 +++++++++++------------------- 1 file changed, 44 insertions(+), 74 deletions(-) diff --git a/pkg/overcommit/make_overcommit.go b/pkg/overcommit/make_overcommit.go index d86574a..558fade 100644 --- a/pkg/overcommit/make_overcommit.go +++ b/pkg/overcommit/make_overcommit.go @@ -1,8 +1,3 @@ -// SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.) -// SPDX-FileContributor: enriqueavi@inditex.com -// -// SPDX-License-Identifier: Apache-2.0 - package overcommit import ( @@ -10,7 +5,6 @@ import ( "os" "github.com/InditexTech/k8s-overcommit-operator/internal/metrics" - corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" "k8s.io/client-go/tools/record" @@ -24,100 +18,76 @@ func mutateContainers(containers []corev1.Container, pod *corev1.Pod, cpuValue f for i, container := range containers { limits := container.Resources.Limits requests := container.Resources.Requests - // If the container doesn't have limits, don't mutate the container + if requests == nil { + requests = corev1.ResourceList{} + } + if limits == nil { - podlog.Info( - "Limits is nil, don't mutate the container", - "containerName", container.Name, "generateName", pod.GenerateName, - ) - } else if cpuValue == 1 && memoryValue == 1 { - podlog.Info( - "Container didn't mutate the cpu and memory", - "generateName", pod.GenerateName, "cpuValue", cpuValue, "memoryValue", memoryValue, - ) - } else { - if cpuLimit, ok := limits[corev1.ResourceCPU]; ok { - // If the cpu overcommit value is 1, don't mutate the container - if cpuValue == 1 { - podlog.Info( - "Container didn't mutate the cpu", - "generateName", pod.GenerateName, "cpuValue", cpuValue, - ) - } - newCPURequest := float64(cpuLimit.MilliValue()) * cpuValue - requests[corev1.ResourceCPU] = *resource.NewMilliQuantity(int64(newCPURequest), resource.DecimalSI) - } - if memoryLimit, ok := limits[corev1.ResourceMemory]; ok { - // If the memory overcommit value is 1, don't mutate the container - if memoryValue == 1 { - podlog.Info( - "Container didn't mutate the memory", - "generateName", pod.GenerateName, "memoryValue", memoryValue, - ) - } - newMemoryRequest := float64(memoryLimit.Value()) * memoryValue - requests[corev1.ResourceMemory] = *resource.NewQuantity(int64(newMemoryRequest), resource.BinarySI) - } - containers[i].Resources.Requests = requests + continue } - } -} -func makeOvercommit(pod *corev1.Pod, cpuValue float64, memoryValue float64) { - mutateContainers(pod.Spec.Containers, pod, cpuValue, memoryValue) - podlog.Info( - "Containers mutated", "generateName", pod.GenerateName, "cpuValue", cpuValue, "memoryValue", memoryValue, - ) -} + if cpuLimit, ok := limits[corev1.ResourceCPU]; ok && cpuValue != 1 { + newCPURequest := float64(cpuLimit.MilliValue()) * cpuValue + requests[corev1.ResourceCPU] = *resource.NewMilliQuantity(int64(newCPURequest), resource.DecimalSI) + } -func makeOvercommitInitContainers(pod *corev1.Pod, cpuValue float64, memoryValue float64) { - mutateContainers(pod.Spec.InitContainers, pod, cpuValue, memoryValue) - podlog.Info( - "InitContainers mutated", "generateName", pod.GenerateName, "cpuValue", cpuValue, "memoryValue", memoryValue, - ) + if memoryLimit, ok := limits[corev1.ResourceMemory]; ok && memoryValue != 1 { + newMemoryRequest := float64(memoryLimit.Value()) * memoryValue + requests[corev1.ResourceMemory] = *resource.NewQuantity(int64(newMemoryRequest), resource.BinarySI) + } + + containers[i].Resources.Requests = requests + } } func Overcommit(pod *corev1.Pod, recorder record.EventRecorder, client client.Client) { ctx := context.Background() - podlog.Info("Mutating Pod", "generateGame", pod.GenerateName) + metrics.K8sOvercommitOperatorPodsRequestedTotal.WithLabelValues(os.Getenv("OVERCOMMIT_CLASS_NAME")).Inc() - // Get the overcommit values from the labels cpuValue, memoryValue := checkOvercommitType(ctx, *pod, client) - // Check if the values are valid - // Multiplicate the limits by the overcommit value and set the new value as request - makeOvercommit(pod, cpuValue, memoryValue) - podlog.Info( - "Pod mutated", "generateName", pod.GenerateName, "cpuValue", cpuValue, "memoryValue", memoryValue, - ) + mutateContainers(pod.Spec.Containers, pod, cpuValue, memoryValue) - // If it has initContainers, make the overcommit - podlog.Info("cheking if pod has initContainer") + // comportamiento actual para CREATE/UPDATE normales if len(pod.Spec.InitContainers) > 0 { - podlog.Info("Pod has initContainers, mutating them", "generateName", pod.GenerateName) - makeOvercommitInitContainers(pod, cpuValue, memoryValue) + mutateContainers(pod.Spec.InitContainers, pod, cpuValue, memoryValue) } - // Increment the metric K8sOvercommitOperatorMutatedPodsTotal metrics.K8sOvercommitOperatorMutatedPodsTotal.WithLabelValues(os.Getenv("OVERCOMMIT_CLASS_NAME")).Inc() - // Add an event to the pod recorder.Eventf( pod, corev1.EventTypeNormal, "OvercommitApplied", - "Applied overcommit to containers of Pod '%s': OvercommitClass = %s, CPU Overcommit = %.2f, Memory Overcommit = %.2f", + "Applied overcommit to Pod '%s': OvercommitClass = %s, CPU Overcommit = %.2f, Memory Overcommit = %.2f", pod.Name, os.Getenv("OVERCOMMIT_CLASS_NAME"), cpuValue, memoryValue, ) - if cpuValue == 1 && memoryValue == 1 { - metrics.K8sOvercommitOperatorPodsNotMutatedTotal.WithLabelValues( - os.Getenv("OVERCOMMIT_CLASS_NAME"), pod.GenerateName, pod.Namespace, "overcommit values = 1", - ).Inc() +} - } - podlog.Info("Pod mutated", "generateName", pod.GenerateName, "cpuValue", cpuValue, "memoryValue", memoryValue) +func OvercommitOnResize(pod *corev1.Pod, recorder record.EventRecorder, client client.Client) { + ctx := context.Background() + + metrics.K8sOvercommitOperatorPodsRequestedTotal.WithLabelValues(os.Getenv("OVERCOMMIT_CLASS_NAME")).Inc() + + cpuValue, memoryValue := checkOvercommitType(ctx, *pod, client) + + // En resize: solo containers normales. + mutateContainers(pod.Spec.Containers, pod, cpuValue, memoryValue) + + metrics.K8sOvercommitOperatorMutatedPodsTotal.WithLabelValues(os.Getenv("OVERCOMMIT_CLASS_NAME")).Inc() + + recorder.Eventf( + pod, + corev1.EventTypeNormal, + "OvercommitAppliedOnResize", + "Applied overcommit on resize to Pod '%s': OvercommitClass = %s, CPU Overcommit = %.2f, Memory Overcommit = %.2f", + pod.Name, + os.Getenv("OVERCOMMIT_CLASS_NAME"), + cpuValue, + memoryValue, + ) } From 75e855877c7457f6d7b4a3c0c0dde1dfb0bb6cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:12:47 +0100 Subject: [PATCH 03/13] fix overcommit test --- pkg/overcommit/make_overcommit_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/overcommit/make_overcommit_test.go b/pkg/overcommit/make_overcommit_test.go index e59b50e..ae5688b 100644 --- a/pkg/overcommit/make_overcommit_test.go +++ b/pkg/overcommit/make_overcommit_test.go @@ -67,7 +67,7 @@ var _ = Describe("Overcommit", func() { Describe("makeOvercommit", func() { It("should apply overcommit to containers", func() { - makeOvercommit(pod, 0.5, 0.5) + Overcommit(pod, recorder, k8sClient) Expect(pod.Spec.Containers[0].Resources.Requests).To(Equal(expectedRequests)) }) From 380b0bf2496a79ab6be6e429cdbc9011c8a224ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:14:19 +0100 Subject: [PATCH 04/13] check if the request is a resize operation and use his own function for overcommit --- .../webhook/v1alphav1/mutating/pod_webhook.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/webhook/v1alphav1/mutating/pod_webhook.go b/internal/webhook/v1alphav1/mutating/pod_webhook.go index 0c1ca19..958d10b 100644 --- a/internal/webhook/v1alphav1/mutating/pod_webhook.go +++ b/internal/webhook/v1alphav1/mutating/pod_webhook.go @@ -16,13 +16,12 @@ import ( "k8s.io/client-go/tools/record" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" - logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" ) // nolint:unused // log is for logging in this package. -var podlog = logf.Log.WithName("webhook") // PodCustomDefaulter struct is responsible for setting default values on the custom resource of the Kind Pod. type PodCustomDefaulter struct { @@ -40,19 +39,27 @@ func (d *PodCustomDefaulter) InjectClient(c client.Client) { var _ webhook.CustomDefaulter = &PodCustomDefaulter{} -// Default implements webhook.CustomDefaulter so a webhook will be registered for the Kind Pod. func (d *PodCustomDefaulter) Default(ctx context.Context, obj runtime.Object) error { pod, ok := obj.(*corev1.Pod) if !ok { return fmt.Errorf("expected a Pod object but got %T", obj) } - // Call the Overcommit function and pass the EventRecorder + isResize := false + if req, err := admission.RequestFromContext(ctx); err == nil { + isResize = req.SubResource == "resize" + } + + if isResize { + overcommit.OvercommitOnResize(pod, d.Recorder, d.Client) + return nil + } + overcommit.Overcommit(pod, d.Recorder, d.Client) return nil } -// +kubebuilder:webhook:path=/mutate--v1-pod,mutating=true,failurePolicy=ignore,sideEffects=None,groups="",resources=pods,verbs=create;update,versions=v1,name=mutating-pod-v1.overcommit.inditex.dev,admissionReviewVersions=v1 +// +kubebuilder:webhook:path=/mutate--v1-pod,mutating=true,failurePolicy=ignore,reinvocationPolicy=IfNeeded,sideEffects=None,groups="",resources=pods;pods/resize,verbs=create;update,versions=v1,name=mutating-pod-v1.overcommit.inditex.dev,admissionReviewVersions=v1 // +kubebuilder:rbac:groups="",resources=pods,verbs=get;list;watch // SetupPodWebhookWithManager registers the webhook for Pod in the manager. From 51a018c3277809c2564da29785f3b0eab38c5d23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:26:04 +0100 Subject: [PATCH 05/13] add missing SPDX header, update controller gen version in makefile --- Makefile | 2 +- .../crd/bases/overcommit.inditex.dev_overcommitclasses.yaml | 2 +- config/crd/bases/overcommit.inditex.dev_overcommits.yaml | 2 +- config/webhook/manifests.yaml | 2 ++ pkg/overcommit/make_overcommit.go | 5 +++++ 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 387bd9a..bfbc9b0 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint ## Tool Versions KUSTOMIZE_VERSION ?= v5.4.3 -CONTROLLER_TOOLS_VERSION ?= v0.16.1 +CONTROLLER_TOOLS_VERSION ?= v0.17.2 ENVTEST_VERSION ?= release-0.19 GOLANGCI_LINT_VERSION ?= v1.59.1 diff --git a/config/crd/bases/overcommit.inditex.dev_overcommitclasses.yaml b/config/crd/bases/overcommit.inditex.dev_overcommitclasses.yaml index 75969b9..47eb667 100644 --- a/config/crd/bases/overcommit.inditex.dev_overcommitclasses.yaml +++ b/config/crd/bases/overcommit.inditex.dev_overcommitclasses.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.17.2 name: overcommitclasses.overcommit.inditex.dev spec: group: overcommit.inditex.dev diff --git a/config/crd/bases/overcommit.inditex.dev_overcommits.yaml b/config/crd/bases/overcommit.inditex.dev_overcommits.yaml index f28bb86..bead084 100644 --- a/config/crd/bases/overcommit.inditex.dev_overcommits.yaml +++ b/config/crd/bases/overcommit.inditex.dev_overcommits.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.1 + controller-gen.kubebuilder.io/version: v0.17.2 name: overcommits.overcommit.inditex.dev spec: group: overcommit.inditex.dev diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index b15a0be..19ad31f 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -13,6 +13,7 @@ webhooks: path: /mutate--v1-pod failurePolicy: Ignore name: mutating-pod-v1.overcommit.inditex.dev + reinvocationPolicy: IfNeeded rules: - apiGroups: - "" @@ -23,6 +24,7 @@ webhooks: - UPDATE resources: - pods + - pods/resize sideEffects: None --- apiVersion: admissionregistration.k8s.io/v1 diff --git a/pkg/overcommit/make_overcommit.go b/pkg/overcommit/make_overcommit.go index 558fade..2108024 100644 --- a/pkg/overcommit/make_overcommit.go +++ b/pkg/overcommit/make_overcommit.go @@ -1,3 +1,8 @@ +// SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.) +// SPDX-FileContributor: enriqueavi@inditex.com +// +// SPDX-License-Identifier: Apache-2.0 + package overcommit import ( From d4553a2beb3fd9d08f50d24ae55947d5bc6bfdbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:44:33 +0100 Subject: [PATCH 06/13] add test for resize overcommit function --- pkg/overcommit/make_overcommit_test.go | 47 +++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/pkg/overcommit/make_overcommit_test.go b/pkg/overcommit/make_overcommit_test.go index ae5688b..31e7866 100644 --- a/pkg/overcommit/make_overcommit_test.go +++ b/pkg/overcommit/make_overcommit_test.go @@ -17,7 +17,8 @@ import ( var _ = Describe("Overcommit", func() { var ( - pod *corev1.Pod + pod *corev1.Pod + expectedRequests = corev1.ResourceList{ corev1.ResourceCPU: *resource.NewMilliQuantity(500, resource.DecimalSI), corev1.ResourceMemory: *resource.NewQuantity(536870912, resource.BinarySI), @@ -51,6 +52,7 @@ var _ = Describe("Overcommit", func() { }) Describe("mutateContainers", func() { + It("should mutate container requests based on overcommit values", func() { mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) @@ -59,10 +61,32 @@ var _ = Describe("Overcommit", func() { It("should not mutate containers if limits are nil", func() { pod.Spec.Containers[0].Resources.Limits = nil + mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) Expect(pod.Spec.Containers[0].Resources.Requests).To(BeEmpty()) }) + + It("should initialize requests if requests is nil", func() { + pod.Spec.Containers[0].Resources.Requests = nil + + mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) + + Expect(pod.Spec.Containers[0].Resources.Requests).To(Equal(expectedRequests)) + }) + + It("should be idempotent when applied multiple times", func() { + mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) + + first := pod.Spec.Containers[0].Resources.Requests.Cpu().MilliValue() + + mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) + + second := pod.Spec.Containers[0].Resources.Requests.Cpu().MilliValue() + + Expect(first).To(Equal(second)) + }) + }) Describe("makeOvercommit", func() { @@ -74,6 +98,7 @@ var _ = Describe("Overcommit", func() { }) Describe("Overcommit", func() { + BeforeEach(func() { os.Setenv("OVERCOMMIT_CLASS_NAME", "test-class") }) @@ -86,7 +111,27 @@ var _ = Describe("Overcommit", func() { Overcommit(pod, recorder, k8sClient) Expect(pod.Spec.Containers[0].Resources.Requests).To(Equal(expectedRequests)) + }) + + }) + + Describe("Resize behaviour", func() { + + It("should recompute requests when limits change", func() { + + mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) + + Expect(pod.Spec.Containers[0].Resources.Requests).To(Equal(expectedRequests)) + + pod.Spec.Containers[0].Resources.Limits[corev1.ResourceCPU] = resource.MustParse("2") + mutateContainers(pod.Spec.Containers, pod, 0.5, 0.5) + + Expect( + pod.Spec.Containers[0].Resources.Requests.Cpu().MilliValue(), + ).To(Equal(int64(1000))) }) + }) + }) From b5814b15db07ca2cf3b38aa9fb3a215fb865411e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 11:56:27 +0100 Subject: [PATCH 07/13] update kuttl version in CI --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5b774c..1d3e5ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,8 @@ jobs: - name: Install kubectl, helm, kind and kuttl ⬇️ env: - KUTTL_VERSION: '0.20.0' - KUTTL_PLUGIN_FILENAME: 'kubectl-kuttl_0.20.0_linux_x86_64' + KUTTL_VERSION: '0.25.0' + KUTTL_PLUGIN_FILENAME: 'kubectl-kuttl_0.25.0_linux_x86_64' run: bash hack/install-dependencies.sh - name: Run kind ⚙️ From db5a58c65c36b9f6f8bbd64c3a425c3cbe496866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 12:01:07 +0100 Subject: [PATCH 08/13] update kind cluster version to 1.35 for E2E test --- hack/ci-mount-image.sh | 2 +- hack/kind-config.yaml | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 hack/kind-config.yaml diff --git a/hack/ci-mount-image.sh b/hack/ci-mount-image.sh index e2abc72..4fb1f22 100755 --- a/hack/ci-mount-image.sh +++ b/hack/ci-mount-image.sh @@ -10,7 +10,7 @@ echo "Mounting image in the Kind cluster" kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.yaml kubectl wait --for=condition=available --timeout=40s deployment/cert-manager-webhook -n cert-manager make docker-build IMG=k8s-overcommit/webhook:teste2e -kind load docker-image k8s-overcommit/webhook:teste2e --name kuttl-cluster +kind load docker-image k8s-overcommit/webhook:teste2e --name kuttl-cluster --config ./hack/kind-config.yaml echo "Mounted image in the Kind cluster, instaling operator" helm install k8s-overcommit chart --set createClasses=false --set createNamespace=true --set namespace=k8s-overcommit --set deployment.image.tag=teste2e --set deployment.image.registry=docker.io --set deployment.image.image=k8s-overcommit/webhook echo "Operator installed, waiting for the deployment to be ready" diff --git a/hack/kind-config.yaml b/hack/kind-config.yaml new file mode 100644 index 0000000..d58f723 --- /dev/null +++ b/hack/kind-config.yaml @@ -0,0 +1,24 @@ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 + +featureGates: + InPlacePodVerticalScaling: true + +nodes: +- role: control-plane + image: kindest/node:v1.35.0 + kubeadmConfigPatches: + - | + kind: ClusterConfiguration + apiServer: + extraArgs: + feature-gates: InPlacePodVerticalScaling=true + controllerManager: + extraArgs: + feature-gates: InPlacePodVerticalScaling=true + scheduler: + extraArgs: + feature-gates: InPlacePodVerticalScaling=true + +- role: worker + image: kindest/node:v1.35.0 \ No newline at end of file From b63e8b32f5eaef43689f044d7add3548dc31b97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 12:05:54 +0100 Subject: [PATCH 09/13] fix kind config file --- .github/workflows/ci.yml | 2 +- hack/ci-mount-image.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d3e5ec..5d690c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,7 @@ jobs: run: bash hack/install-dependencies.sh - name: Run kind ⚙️ - run: kind create cluster --name kuttl-cluster + run: kind create cluster --name kuttl-cluster --config ./hack/kind-config.yaml - name: Mount the image in the Kind cluster ⚙️ run: | diff --git a/hack/ci-mount-image.sh b/hack/ci-mount-image.sh index 4fb1f22..e2abc72 100755 --- a/hack/ci-mount-image.sh +++ b/hack/ci-mount-image.sh @@ -10,7 +10,7 @@ echo "Mounting image in the Kind cluster" kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.yaml kubectl wait --for=condition=available --timeout=40s deployment/cert-manager-webhook -n cert-manager make docker-build IMG=k8s-overcommit/webhook:teste2e -kind load docker-image k8s-overcommit/webhook:teste2e --name kuttl-cluster --config ./hack/kind-config.yaml +kind load docker-image k8s-overcommit/webhook:teste2e --name kuttl-cluster echo "Mounted image in the Kind cluster, instaling operator" helm install k8s-overcommit chart --set createClasses=false --set createNamespace=true --set namespace=k8s-overcommit --set deployment.image.tag=teste2e --set deployment.image.registry=docker.io --set deployment.image.image=k8s-overcommit/webhook echo "Operator installed, waiting for the deployment to be ready" From 2bfa7a4dc78d2c95ac77f4f09b1a3ea4a68265a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 12:24:19 +0100 Subject: [PATCH 10/13] update E2E dependencies --- hack/install-dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/install-dependencies.sh b/hack/install-dependencies.sh index a26dd80..688618b 100644 --- a/hack/install-dependencies.sh +++ b/hack/install-dependencies.sh @@ -8,7 +8,7 @@ set -e #Kubectl -curl -LO https://dl.k8s.io/release/v1.31.0/bin/linux/amd64/kubectl +curl -LO https://dl.k8s.io/release/v1.35.0/bin/linux/amd64/kubectl sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl #Helm3 @@ -22,6 +22,6 @@ sudo mv ${KUTTL_PLUGIN_FILENAME} /usr/local/bin/kubectl-kuttl sudo chmod +x /usr/local/bin/kubectl-kuttl #Kind -curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64 +curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.31.0/kind-linux-amd64 chmod +x ./kind sudo mv ./kind /usr/local/bin/kind From 565619ba01b2568693fd85b6e95cc972d10a8198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 13:53:13 +0100 Subject: [PATCH 11/13] add E2E test for patch resize operation --- .github/workflows/ci.yml | 2 +- docs/e2e-test.md | 2 +- e2e.json | 267 ++++++++++++++++++ .../00-assert.yaml | 12 + .../00-setup.yaml | 19 ++ .../01-assert.yaml | 11 + .../01-setup.yaml | 8 + 7 files changed, 319 insertions(+), 2 deletions(-) create mode 100644 e2e.json create mode 100644 test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml create mode 100644 test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml create mode 100644 test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml create mode 100644 test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d690c4..81843ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Run the tests 🔎 run: | echo "Running the tests" - kubectl kuttl test test/e2e/ --start-kind=false + kubectl kuttl test --config test/e2e/kuttl-test.yaml test/e2e/kuttl --start-kind=false - name: Clean up Kind cluster ☠️ if: always() diff --git a/docs/e2e-test.md b/docs/e2e-test.md index 841db55..492f088 100644 --- a/docs/e2e-test.md +++ b/docs/e2e-test.md @@ -24,5 +24,5 @@ Then build the image and install the test chart in the kind cluster And finally run the tests ```[sh] -kubectl kuttl test code/test/e2e/ --config code/test/e2e/kuttl-tests.yaml --start-kind=false +kubectl kuttl test --config test/e2e/kuttl-test.yaml test/e2e/kuttl --start-kind=false ``` diff --git a/e2e.json b/e2e.json new file mode 100644 index 0000000..87df29d --- /dev/null +++ b/e2e.json @@ -0,0 +1,267 @@ +{ + "name": "", + "tests": 24, + "failures": 1, + "time": "59.795", + "testsuite": [ + { + "tests": 24, + "failures": 1, + "timestamp": "2026-03-13T13:48:30.306505082+01:00", + "time": "54.322", + "name": "test/e2e/kuttl", + "testsuite": [ + { + "tests": 2, + "failures": 0, + "timestamp": "2026-03-13T13:48:30.307384902+01:00", + "time": "0.020", + "name": "1-00_validate_deployments_by_overcommit", + "testcase": [ + { + "classname": "1-00_validate_deployments_by_overcommit", + "name": "setup", + "timestamp": "2026-03-13T13:48:30.327587629+01:00", + "time": "0.000" + }, + { + "classname": "1-00_validate_deployments_by_overcommit", + "name": "step 0-", + "timestamp": "2026-03-13T13:48:30.327592472+01:00", + "time": "0.000", + "assertions": 4 + } + ] + }, + { + "tests": 2, + "failures": 0, + "timestamp": "2026-03-13T13:49:24.566194167+01:00", + "time": "0.062", + "name": "1-01_validate_default_webhook", + "testcase": [ + { + "classname": "1-01_validate_default_webhook", + "name": "setup", + "timestamp": "2026-03-13T13:49:24.628043486+01:00", + "time": "0.000" + }, + { + "classname": "1-01_validate_default_webhook", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:49:24.628053571+01:00", + "time": "0.000", + "assertions": 1 + } + ] + }, + { + "tests": 3, + "failures": 0, + "timestamp": "2026-03-13T13:49:18.678419386+01:00", + "time": "0.215", + "name": "1-02_validate_excluded_namespaces", + "testcase": [ + { + "classname": "1-02_validate_excluded_namespaces", + "name": "setup", + "timestamp": "2026-03-13T13:49:18.893112587+01:00", + "time": "0.000" + }, + { + "classname": "1-02_validate_excluded_namespaces", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:49:18.893132187+01:00", + "time": "0.000" + }, + { + "classname": "1-02_validate_excluded_namespaces", + "name": "step 1-", + "timestamp": "2026-03-13T13:49:18.893141747+01:00", + "time": "0.000", + "assertions": 3 + } + ] + }, + { + "tests": 2, + "failures": 0, + "timestamp": "2026-03-13T13:49:06.64447353+01:00", + "time": "0.099", + "name": "1-03_validate_namespace_labeled", + "testcase": [ + { + "classname": "1-03_validate_namespace_labeled", + "name": "setup", + "timestamp": "2026-03-13T13:49:06.743204738+01:00", + "time": "0.000" + }, + { + "classname": "1-03_validate_namespace_labeled", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:49:06.743226684+01:00", + "time": "0.000", + "assertions": 1 + } + ] + }, + { + "tests": 2, + "failures": 0, + "timestamp": "2026-03-13T13:49:12.317621641+01:00", + "time": "1.037", + "name": "1-04_validate_e2e_class", + "testcase": [ + { + "classname": "1-04_validate_e2e_class", + "name": "setup", + "timestamp": "2026-03-13T13:49:13.354606589+01:00", + "time": "0.000" + }, + { + "classname": "1-04_validate_e2e_class", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:49:13.354635573+01:00", + "time": "0.000", + "assertions": 2 + } + ] + }, + { + "tests": 2, + "failures": 0, + "timestamp": "2026-03-13T13:48:35.635640314+01:00", + "time": "0.066", + "name": "1-05_validate_pod_label", + "testcase": [ + { + "classname": "1-05_validate_pod_label", + "name": "setup", + "timestamp": "2026-03-13T13:48:35.70170288+01:00", + "time": "0.000" + }, + { + "classname": "1-05_validate_pod_label", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:48:35.701715356+01:00", + "time": "0.000", + "assertions": 1 + } + ] + }, + { + "tests": 3, + "failures": 0, + "timestamp": "2026-03-13T13:49:01.035899521+01:00", + "time": "0.067", + "name": "1-06_validate_pod_without_limits", + "testcase": [ + { + "classname": "1-06_validate_pod_without_limits", + "name": "setup", + "timestamp": "2026-03-13T13:49:01.102912966+01:00", + "time": "0.000" + }, + { + "classname": "1-06_validate_pod_without_limits", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:49:01.102925827+01:00", + "time": "0.000" + }, + { + "classname": "1-06_validate_pod_without_limits", + "name": "step 1-", + "timestamp": "2026-03-13T13:49:01.102931645+01:00", + "time": "0.000", + "assertions": 1 + } + ] + }, + { + "tests": 2, + "failures": 0, + "timestamp": "2026-03-13T13:48:55.690165424+01:00", + "time": "0.022", + "name": "1-07_validate_init_containers_mutated", + "testcase": [ + { + "classname": "1-07_validate_init_containers_mutated", + "name": "setup", + "timestamp": "2026-03-13T13:48:55.712273359+01:00", + "time": "0.000" + }, + { + "classname": "1-07_validate_init_containers_mutated", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:48:55.712280767+01:00", + "time": "0.000", + "assertions": 1 + } + ] + }, + { + "tests": 3, + "failures": 0, + "timestamp": "2026-03-13T13:48:49.382038741+01:00", + "time": "1.086", + "name": "1-08_validate_tolerations_nodeSelector", + "testcase": [ + { + "classname": "1-08_validate_tolerations_nodeSelector", + "name": "setup", + "timestamp": "2026-03-13T13:48:50.468274962+01:00", + "time": "0.000" + }, + { + "classname": "1-08_validate_tolerations_nodeSelector", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:48:50.468288003+01:00", + "time": "0.000", + "assertions": 1 + }, + { + "classname": "1-08_validate_tolerations_nodeSelector", + "name": "step 1-setup", + "timestamp": "2026-03-13T13:48:50.468293001+01:00", + "time": "0.000", + "assertions": 1 + } + ] + }, + { + "tests": 3, + "failures": 1, + "timestamp": "2026-03-13T13:48:41.132093378+01:00", + "time": "2.919", + "name": "1-09_validate_inplace_resize", + "testcase": [ + { + "classname": "1-09_validate_inplace_resize", + "name": "setup", + "timestamp": "2026-03-13T13:48:44.050795625+01:00", + "time": "0.000" + }, + { + "classname": "1-09_validate_inplace_resize", + "name": "step 0-setup", + "timestamp": "2026-03-13T13:48:44.0508048+01:00", + "time": "0.000", + "assertions": 1 + }, + { + "classname": "1-09_validate_inplace_resize", + "name": "step 1-setup", + "timestamp": "2026-03-13T13:48:44.050807747+01:00", + "time": "0.000", + "assertions": 1, + "failure": { + "text": "command \"kubectl wait --for=condition=Ready pod/resize-test -n resize-test-n...\" failed, exit status 1", + "message": "failed in step 1-setup" + } + } + ] + } + ] + } + ] + } \ No newline at end of file diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml new file mode 100644 index 0000000..36def27 --- /dev/null +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Pod +metadata: + name: resize-test + namespace: resize-test-ns +spec: + containers: + - name: test + resources: + requests: + cpu: "250m" + memory: "512Mi" \ No newline at end of file diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml new file mode 100644 index 0000000..dd951aa --- /dev/null +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: resize-test-ns +--- +apiVersion: v1 +kind: Pod +metadata: + name: resize-test + namespace: resize-test-ns +spec: + containers: + - name: test + image: busybox + command: ["sleep","3600"] + resources: + limits: + cpu: "500m" + memory: "1Gi" \ No newline at end of file diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml new file mode 100644 index 0000000..432aacb --- /dev/null +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Pod +metadata: + name: resize-test + namespace: resize-test-ns +spec: + containers: + - name: test + resources: + requests: + cpu: "500m" \ No newline at end of file diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml new file mode 100644 index 0000000..b9134fb --- /dev/null +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml @@ -0,0 +1,8 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - command: > + kubectl patch pod resize-test + -n resize-test-ns + --subresource=resize + -p '{"spec":{"containers":[{"name":"test","resources":{"limits":{"cpu":"2"}}}]}}' \ No newline at end of file From 988d27f21e7e13396eb95776692b3891d776c95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 13:59:00 +0100 Subject: [PATCH 12/13] fix expected requests in resize e2e test --- e2e.json | 96 +++++++++---------- .../01-setup.yaml | 2 +- 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/e2e.json b/e2e.json index 87df29d..e783410 100644 --- a/e2e.json +++ b/e2e.json @@ -2,32 +2,32 @@ "name": "", "tests": 24, "failures": 1, - "time": "59.795", + "time": "58.181", "testsuite": [ { "tests": 24, "failures": 1, - "timestamp": "2026-03-13T13:48:30.306505082+01:00", - "time": "54.322", + "timestamp": "2026-03-13T13:55:51.205547039+01:00", + "time": "52.617", "name": "test/e2e/kuttl", "testsuite": [ { "tests": 2, "failures": 0, - "timestamp": "2026-03-13T13:48:30.307384902+01:00", - "time": "0.020", + "timestamp": "2026-03-13T13:55:51.207026264+01:00", + "time": "0.054", "name": "1-00_validate_deployments_by_overcommit", "testcase": [ { "classname": "1-00_validate_deployments_by_overcommit", "name": "setup", - "timestamp": "2026-03-13T13:48:30.327587629+01:00", + "timestamp": "2026-03-13T13:55:51.261452259+01:00", "time": "0.000" }, { "classname": "1-00_validate_deployments_by_overcommit", "name": "step 0-", - "timestamp": "2026-03-13T13:48:30.327592472+01:00", + "timestamp": "2026-03-13T13:55:51.261474327+01:00", "time": "0.000", "assertions": 4 } @@ -36,20 +36,20 @@ { "tests": 2, "failures": 0, - "timestamp": "2026-03-13T13:49:24.566194167+01:00", - "time": "0.062", + "timestamp": "2026-03-13T13:56:43.748431116+01:00", + "time": "0.074", "name": "1-01_validate_default_webhook", "testcase": [ { "classname": "1-01_validate_default_webhook", "name": "setup", - "timestamp": "2026-03-13T13:49:24.628043486+01:00", + "timestamp": "2026-03-13T13:56:43.82246063+01:00", "time": "0.000" }, { "classname": "1-01_validate_default_webhook", "name": "step 0-setup", - "timestamp": "2026-03-13T13:49:24.628053571+01:00", + "timestamp": "2026-03-13T13:56:43.822475+01:00", "time": "0.000", "assertions": 1 } @@ -58,26 +58,26 @@ { "tests": 3, "failures": 0, - "timestamp": "2026-03-13T13:49:18.678419386+01:00", - "time": "0.215", + "timestamp": "2026-03-13T13:56:38.057824913+01:00", + "time": "0.253", "name": "1-02_validate_excluded_namespaces", "testcase": [ { "classname": "1-02_validate_excluded_namespaces", "name": "setup", - "timestamp": "2026-03-13T13:49:18.893112587+01:00", + "timestamp": "2026-03-13T13:56:38.310314119+01:00", "time": "0.000" }, { "classname": "1-02_validate_excluded_namespaces", "name": "step 0-setup", - "timestamp": "2026-03-13T13:49:18.893132187+01:00", + "timestamp": "2026-03-13T13:56:38.310321999+01:00", "time": "0.000" }, { "classname": "1-02_validate_excluded_namespaces", "name": "step 1-", - "timestamp": "2026-03-13T13:49:18.893141747+01:00", + "timestamp": "2026-03-13T13:56:38.310325325+01:00", "time": "0.000", "assertions": 3 } @@ -86,20 +86,20 @@ { "tests": 2, "failures": 0, - "timestamp": "2026-03-13T13:49:06.64447353+01:00", - "time": "0.099", + "timestamp": "2026-03-13T13:56:25.910339475+01:00", + "time": "0.095", "name": "1-03_validate_namespace_labeled", "testcase": [ { "classname": "1-03_validate_namespace_labeled", "name": "setup", - "timestamp": "2026-03-13T13:49:06.743204738+01:00", + "timestamp": "2026-03-13T13:56:26.005100214+01:00", "time": "0.000" }, { "classname": "1-03_validate_namespace_labeled", "name": "step 0-setup", - "timestamp": "2026-03-13T13:49:06.743226684+01:00", + "timestamp": "2026-03-13T13:56:26.005119652+01:00", "time": "0.000", "assertions": 1 } @@ -108,20 +108,20 @@ { "tests": 2, "failures": 0, - "timestamp": "2026-03-13T13:49:12.317621641+01:00", - "time": "1.037", + "timestamp": "2026-03-13T13:56:31.673222422+01:00", + "time": "1.054", "name": "1-04_validate_e2e_class", "testcase": [ { "classname": "1-04_validate_e2e_class", "name": "setup", - "timestamp": "2026-03-13T13:49:13.354606589+01:00", + "timestamp": "2026-03-13T13:56:32.726721028+01:00", "time": "0.000" }, { "classname": "1-04_validate_e2e_class", "name": "step 0-setup", - "timestamp": "2026-03-13T13:49:13.354635573+01:00", + "timestamp": "2026-03-13T13:56:32.726731765+01:00", "time": "0.000", "assertions": 2 } @@ -130,20 +130,20 @@ { "tests": 2, "failures": 0, - "timestamp": "2026-03-13T13:48:35.635640314+01:00", - "time": "0.066", + "timestamp": "2026-03-13T13:55:56.580167859+01:00", + "time": "0.108", "name": "1-05_validate_pod_label", "testcase": [ { "classname": "1-05_validate_pod_label", "name": "setup", - "timestamp": "2026-03-13T13:48:35.70170288+01:00", + "timestamp": "2026-03-13T13:55:56.687688548+01:00", "time": "0.000" }, { "classname": "1-05_validate_pod_label", "name": "step 0-setup", - "timestamp": "2026-03-13T13:48:35.701715356+01:00", + "timestamp": "2026-03-13T13:55:56.687699089+01:00", "time": "0.000", "assertions": 1 } @@ -152,26 +152,26 @@ { "tests": 3, "failures": 0, - "timestamp": "2026-03-13T13:49:01.035899521+01:00", - "time": "0.067", + "timestamp": "2026-03-13T13:56:20.231599048+01:00", + "time": "0.056", "name": "1-06_validate_pod_without_limits", "testcase": [ { "classname": "1-06_validate_pod_without_limits", "name": "setup", - "timestamp": "2026-03-13T13:49:01.102912966+01:00", + "timestamp": "2026-03-13T13:56:20.287893295+01:00", "time": "0.000" }, { "classname": "1-06_validate_pod_without_limits", "name": "step 0-setup", - "timestamp": "2026-03-13T13:49:01.102925827+01:00", + "timestamp": "2026-03-13T13:56:20.287902753+01:00", "time": "0.000" }, { "classname": "1-06_validate_pod_without_limits", "name": "step 1-", - "timestamp": "2026-03-13T13:49:01.102931645+01:00", + "timestamp": "2026-03-13T13:56:20.287906041+01:00", "time": "0.000", "assertions": 1 } @@ -180,20 +180,20 @@ { "tests": 2, "failures": 0, - "timestamp": "2026-03-13T13:48:55.690165424+01:00", - "time": "0.022", + "timestamp": "2026-03-13T13:56:14.540376536+01:00", + "time": "0.059", "name": "1-07_validate_init_containers_mutated", "testcase": [ { "classname": "1-07_validate_init_containers_mutated", "name": "setup", - "timestamp": "2026-03-13T13:48:55.712273359+01:00", + "timestamp": "2026-03-13T13:56:14.599069534+01:00", "time": "0.000" }, { "classname": "1-07_validate_init_containers_mutated", "name": "step 0-setup", - "timestamp": "2026-03-13T13:48:55.712280767+01:00", + "timestamp": "2026-03-13T13:56:14.599078826+01:00", "time": "0.000", "assertions": 1 } @@ -202,27 +202,27 @@ { "tests": 3, "failures": 0, - "timestamp": "2026-03-13T13:48:49.382038741+01:00", - "time": "1.086", + "timestamp": "2026-03-13T13:56:08.115054971+01:00", + "time": "1.091", "name": "1-08_validate_tolerations_nodeSelector", "testcase": [ { "classname": "1-08_validate_tolerations_nodeSelector", "name": "setup", - "timestamp": "2026-03-13T13:48:50.468274962+01:00", + "timestamp": "2026-03-13T13:56:09.206251296+01:00", "time": "0.000" }, { "classname": "1-08_validate_tolerations_nodeSelector", "name": "step 0-setup", - "timestamp": "2026-03-13T13:48:50.468288003+01:00", + "timestamp": "2026-03-13T13:56:09.206261631+01:00", "time": "0.000", "assertions": 1 }, { "classname": "1-08_validate_tolerations_nodeSelector", "name": "step 1-setup", - "timestamp": "2026-03-13T13:48:50.468293001+01:00", + "timestamp": "2026-03-13T13:56:09.206267047+01:00", "time": "0.000", "assertions": 1 } @@ -231,31 +231,31 @@ { "tests": 3, "failures": 1, - "timestamp": "2026-03-13T13:48:41.132093378+01:00", - "time": "2.919", + "timestamp": "2026-03-13T13:56:02.230677123+01:00", + "time": "0.255", "name": "1-09_validate_inplace_resize", "testcase": [ { "classname": "1-09_validate_inplace_resize", "name": "setup", - "timestamp": "2026-03-13T13:48:44.050795625+01:00", + "timestamp": "2026-03-13T13:56:02.485568945+01:00", "time": "0.000" }, { "classname": "1-09_validate_inplace_resize", "name": "step 0-setup", - "timestamp": "2026-03-13T13:48:44.0508048+01:00", + "timestamp": "2026-03-13T13:56:02.485579494+01:00", "time": "0.000", "assertions": 1 }, { "classname": "1-09_validate_inplace_resize", "name": "step 1-setup", - "timestamp": "2026-03-13T13:48:44.050807747+01:00", + "timestamp": "2026-03-13T13:56:02.485583237+01:00", "time": "0.000", "assertions": 1, "failure": { - "text": "command \"kubectl wait --for=condition=Ready pod/resize-test -n resize-test-n...\" failed, exit status 1", + "text": "command \"kubectl patch pod resize-test -n resize-test-ns --subresource=resize -p '{\\\"spec\\\":{\\\"containers\\\":[{\\\"name\\\":\\\"test\\\",\\\"resources\\\":{\\\"limits\\\":{\\\"cpu\\\":\\\"2\\\"}}}]}}'\\n\" failed, exit status 1", "message": "failed in step 1-setup" } } diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml index b9134fb..9a10cfb 100644 --- a/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml @@ -5,4 +5,4 @@ commands: kubectl patch pod resize-test -n resize-test-ns --subresource=resize - -p '{"spec":{"containers":[{"name":"test","resources":{"limits":{"cpu":"2"}}}]}}' \ No newline at end of file + -p '{"spec":{"containers":[{"name":"test","resources":{"limits":{"cpu":"1"}}}]}}' \ No newline at end of file From 47def390f36293bf27b26ddcb4f87cbd2e573ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Andr=C3=A9s=20Villar?= Date: Fri, 13 Mar 2026 14:05:49 +0100 Subject: [PATCH 13/13] add missing SPDX headers in inplace resize tests --- .gitignore | 2 + Makefile | 2 +- e2e.json | 267 ------------------ .../00-assert.yaml | 4 + .../00-setup.yaml | 4 + .../01-assert.yaml | 4 + .../01-setup.yaml | 4 + 7 files changed, 19 insertions(+), 268 deletions(-) delete mode 100644 e2e.json diff --git a/.gitignore b/.gitignore index 2eaaf45..bf00ff0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ hack/tilt/bin hack/tilt/chart *kubeconfig* + +e2e.json \ No newline at end of file diff --git a/Makefile b/Makefile index bfbc9b0..80adef1 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ endif OPERATOR_SDK_VERSION ?= v1.40.0 # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. -ENVTEST_K8S_VERSION = 1.31.0 +ENVTEST_K8S_VERSION = 1.35.0 # Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) ifeq (,$(shell go env GOBIN)) diff --git a/e2e.json b/e2e.json deleted file mode 100644 index e783410..0000000 --- a/e2e.json +++ /dev/null @@ -1,267 +0,0 @@ -{ - "name": "", - "tests": 24, - "failures": 1, - "time": "58.181", - "testsuite": [ - { - "tests": 24, - "failures": 1, - "timestamp": "2026-03-13T13:55:51.205547039+01:00", - "time": "52.617", - "name": "test/e2e/kuttl", - "testsuite": [ - { - "tests": 2, - "failures": 0, - "timestamp": "2026-03-13T13:55:51.207026264+01:00", - "time": "0.054", - "name": "1-00_validate_deployments_by_overcommit", - "testcase": [ - { - "classname": "1-00_validate_deployments_by_overcommit", - "name": "setup", - "timestamp": "2026-03-13T13:55:51.261452259+01:00", - "time": "0.000" - }, - { - "classname": "1-00_validate_deployments_by_overcommit", - "name": "step 0-", - "timestamp": "2026-03-13T13:55:51.261474327+01:00", - "time": "0.000", - "assertions": 4 - } - ] - }, - { - "tests": 2, - "failures": 0, - "timestamp": "2026-03-13T13:56:43.748431116+01:00", - "time": "0.074", - "name": "1-01_validate_default_webhook", - "testcase": [ - { - "classname": "1-01_validate_default_webhook", - "name": "setup", - "timestamp": "2026-03-13T13:56:43.82246063+01:00", - "time": "0.000" - }, - { - "classname": "1-01_validate_default_webhook", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:43.822475+01:00", - "time": "0.000", - "assertions": 1 - } - ] - }, - { - "tests": 3, - "failures": 0, - "timestamp": "2026-03-13T13:56:38.057824913+01:00", - "time": "0.253", - "name": "1-02_validate_excluded_namespaces", - "testcase": [ - { - "classname": "1-02_validate_excluded_namespaces", - "name": "setup", - "timestamp": "2026-03-13T13:56:38.310314119+01:00", - "time": "0.000" - }, - { - "classname": "1-02_validate_excluded_namespaces", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:38.310321999+01:00", - "time": "0.000" - }, - { - "classname": "1-02_validate_excluded_namespaces", - "name": "step 1-", - "timestamp": "2026-03-13T13:56:38.310325325+01:00", - "time": "0.000", - "assertions": 3 - } - ] - }, - { - "tests": 2, - "failures": 0, - "timestamp": "2026-03-13T13:56:25.910339475+01:00", - "time": "0.095", - "name": "1-03_validate_namespace_labeled", - "testcase": [ - { - "classname": "1-03_validate_namespace_labeled", - "name": "setup", - "timestamp": "2026-03-13T13:56:26.005100214+01:00", - "time": "0.000" - }, - { - "classname": "1-03_validate_namespace_labeled", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:26.005119652+01:00", - "time": "0.000", - "assertions": 1 - } - ] - }, - { - "tests": 2, - "failures": 0, - "timestamp": "2026-03-13T13:56:31.673222422+01:00", - "time": "1.054", - "name": "1-04_validate_e2e_class", - "testcase": [ - { - "classname": "1-04_validate_e2e_class", - "name": "setup", - "timestamp": "2026-03-13T13:56:32.726721028+01:00", - "time": "0.000" - }, - { - "classname": "1-04_validate_e2e_class", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:32.726731765+01:00", - "time": "0.000", - "assertions": 2 - } - ] - }, - { - "tests": 2, - "failures": 0, - "timestamp": "2026-03-13T13:55:56.580167859+01:00", - "time": "0.108", - "name": "1-05_validate_pod_label", - "testcase": [ - { - "classname": "1-05_validate_pod_label", - "name": "setup", - "timestamp": "2026-03-13T13:55:56.687688548+01:00", - "time": "0.000" - }, - { - "classname": "1-05_validate_pod_label", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:55:56.687699089+01:00", - "time": "0.000", - "assertions": 1 - } - ] - }, - { - "tests": 3, - "failures": 0, - "timestamp": "2026-03-13T13:56:20.231599048+01:00", - "time": "0.056", - "name": "1-06_validate_pod_without_limits", - "testcase": [ - { - "classname": "1-06_validate_pod_without_limits", - "name": "setup", - "timestamp": "2026-03-13T13:56:20.287893295+01:00", - "time": "0.000" - }, - { - "classname": "1-06_validate_pod_without_limits", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:20.287902753+01:00", - "time": "0.000" - }, - { - "classname": "1-06_validate_pod_without_limits", - "name": "step 1-", - "timestamp": "2026-03-13T13:56:20.287906041+01:00", - "time": "0.000", - "assertions": 1 - } - ] - }, - { - "tests": 2, - "failures": 0, - "timestamp": "2026-03-13T13:56:14.540376536+01:00", - "time": "0.059", - "name": "1-07_validate_init_containers_mutated", - "testcase": [ - { - "classname": "1-07_validate_init_containers_mutated", - "name": "setup", - "timestamp": "2026-03-13T13:56:14.599069534+01:00", - "time": "0.000" - }, - { - "classname": "1-07_validate_init_containers_mutated", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:14.599078826+01:00", - "time": "0.000", - "assertions": 1 - } - ] - }, - { - "tests": 3, - "failures": 0, - "timestamp": "2026-03-13T13:56:08.115054971+01:00", - "time": "1.091", - "name": "1-08_validate_tolerations_nodeSelector", - "testcase": [ - { - "classname": "1-08_validate_tolerations_nodeSelector", - "name": "setup", - "timestamp": "2026-03-13T13:56:09.206251296+01:00", - "time": "0.000" - }, - { - "classname": "1-08_validate_tolerations_nodeSelector", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:09.206261631+01:00", - "time": "0.000", - "assertions": 1 - }, - { - "classname": "1-08_validate_tolerations_nodeSelector", - "name": "step 1-setup", - "timestamp": "2026-03-13T13:56:09.206267047+01:00", - "time": "0.000", - "assertions": 1 - } - ] - }, - { - "tests": 3, - "failures": 1, - "timestamp": "2026-03-13T13:56:02.230677123+01:00", - "time": "0.255", - "name": "1-09_validate_inplace_resize", - "testcase": [ - { - "classname": "1-09_validate_inplace_resize", - "name": "setup", - "timestamp": "2026-03-13T13:56:02.485568945+01:00", - "time": "0.000" - }, - { - "classname": "1-09_validate_inplace_resize", - "name": "step 0-setup", - "timestamp": "2026-03-13T13:56:02.485579494+01:00", - "time": "0.000", - "assertions": 1 - }, - { - "classname": "1-09_validate_inplace_resize", - "name": "step 1-setup", - "timestamp": "2026-03-13T13:56:02.485583237+01:00", - "time": "0.000", - "assertions": 1, - "failure": { - "text": "command \"kubectl patch pod resize-test -n resize-test-ns --subresource=resize -p '{\\\"spec\\\":{\\\"containers\\\":[{\\\"name\\\":\\\"test\\\",\\\"resources\\\":{\\\"limits\\\":{\\\"cpu\\\":\\\"2\\\"}}}]}}'\\n\" failed, exit status 1", - "message": "failed in step 1-setup" - } - } - ] - } - ] - } - ] - } \ No newline at end of file diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml index 36def27..b562225 100644 --- a/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/00-assert.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.) +# SPDX-FileContributor: enriqueavi@inditex.com +# +# SPDX-License-Identifier: Apache-2.0 apiVersion: v1 kind: Pod metadata: diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml index dd951aa..fdfe96d 100644 --- a/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/00-setup.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.) +# SPDX-FileContributor: enriqueavi@inditex.com +# +# SPDX-License-Identifier: Apache-2.0 apiVersion: v1 kind: Namespace metadata: diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml index 432aacb..6052a7c 100644 --- a/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/01-assert.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.) +# SPDX-FileContributor: enriqueavi@inditex.com +# +# SPDX-License-Identifier: Apache-2.0 apiVersion: v1 kind: Pod metadata: diff --git a/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml b/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml index 9a10cfb..2156fb8 100644 --- a/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml +++ b/test/e2e/kuttl/1-09_validate_inplace_resize/01-setup.yaml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2025 2025 INDUSTRIA DE DISEÑO TEXTIL S.A. (INDITEX S.A.) +# SPDX-FileContributor: enriqueavi@inditex.com +# +# SPDX-License-Identifier: Apache-2.0 apiVersion: kuttl.dev/v1beta1 kind: TestStep commands: