From 0dd72b5f6e4fb1a2acc23022605f9af90d6249a1 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 19 Feb 2025 16:44:51 +0000 Subject: [PATCH 1/7] Set new SNAPSHOT version into pom files. --- bootstrapper-maven-plugin/pom.xml | 2 +- caffeine-bounded-cache-support/pom.xml | 2 +- micrometer-support/pom.xml | 2 +- operator-framework-bom/pom.xml | 2 +- operator-framework-core/pom.xml | 2 +- operator-framework-junit5/pom.xml | 2 +- operator-framework/pom.xml | 2 +- pom.xml | 2 +- sample-operators/controller-namespace-deletion/pom.xml | 2 +- sample-operators/leader-election/pom.xml | 2 +- sample-operators/mysql-schema/pom.xml | 2 +- sample-operators/pom.xml | 2 +- sample-operators/tomcat-operator/pom.xml | 2 +- sample-operators/webpage/pom.xml | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/bootstrapper-maven-plugin/pom.xml b/bootstrapper-maven-plugin/pom.xml index 725b904c9f..5756037cd8 100644 --- a/bootstrapper-maven-plugin/pom.xml +++ b/bootstrapper-maven-plugin/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT bootstrapper diff --git a/caffeine-bounded-cache-support/pom.xml b/caffeine-bounded-cache-support/pom.xml index 1696a57e37..ce51895803 100644 --- a/caffeine-bounded-cache-support/pom.xml +++ b/caffeine-bounded-cache-support/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT caffeine-bounded-cache-support diff --git a/micrometer-support/pom.xml b/micrometer-support/pom.xml index 1cfd506336..d39a5fad8f 100644 --- a/micrometer-support/pom.xml +++ b/micrometer-support/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT micrometer-support diff --git a/operator-framework-bom/pom.xml b/operator-framework-bom/pom.xml index bf598ef822..9874f8ce76 100644 --- a/operator-framework-bom/pom.xml +++ b/operator-framework-bom/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk operator-framework-bom - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT pom Operator SDK - Bill of Materials Java SDK for implementing Kubernetes operators diff --git a/operator-framework-core/pom.xml b/operator-framework-core/pom.xml index d18f46d0f5..61e7d71e4c 100644 --- a/operator-framework-core/pom.xml +++ b/operator-framework-core/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT ../pom.xml diff --git a/operator-framework-junit5/pom.xml b/operator-framework-junit5/pom.xml index 465bbc0d20..dd319d954b 100644 --- a/operator-framework-junit5/pom.xml +++ b/operator-framework-junit5/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT operator-framework-junit-5 diff --git a/operator-framework/pom.xml b/operator-framework/pom.xml index 1f505fae78..a9ff8d2334 100644 --- a/operator-framework/pom.xml +++ b/operator-framework/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT operator-framework diff --git a/pom.xml b/pom.xml index 3d894384b2..b1d9c1c6eb 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT pom Operator SDK for Java Java SDK for implementing Kubernetes operators diff --git a/sample-operators/controller-namespace-deletion/pom.xml b/sample-operators/controller-namespace-deletion/pom.xml index c5f6e7abc3..133a745ddb 100644 --- a/sample-operators/controller-namespace-deletion/pom.xml +++ b/sample-operators/controller-namespace-deletion/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk sample-operators - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT sample-controller-namespace-deletion diff --git a/sample-operators/leader-election/pom.xml b/sample-operators/leader-election/pom.xml index 42b54bf5be..4002f98450 100644 --- a/sample-operators/leader-election/pom.xml +++ b/sample-operators/leader-election/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk sample-operators - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT sample-leader-election diff --git a/sample-operators/mysql-schema/pom.xml b/sample-operators/mysql-schema/pom.xml index ecd3398a76..9e91548801 100644 --- a/sample-operators/mysql-schema/pom.xml +++ b/sample-operators/mysql-schema/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk sample-operators - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT sample-mysql-schema-operator diff --git a/sample-operators/pom.xml b/sample-operators/pom.xml index 7b13dc5d7e..8aa9a53fce 100644 --- a/sample-operators/pom.xml +++ b/sample-operators/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk java-operator-sdk - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT sample-operators diff --git a/sample-operators/tomcat-operator/pom.xml b/sample-operators/tomcat-operator/pom.xml index 9a126f5995..dac3246700 100644 --- a/sample-operators/tomcat-operator/pom.xml +++ b/sample-operators/tomcat-operator/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk sample-operators - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT sample-tomcat-operator diff --git a/sample-operators/webpage/pom.xml b/sample-operators/webpage/pom.xml index 5128cf0d0f..192853edc3 100644 --- a/sample-operators/webpage/pom.xml +++ b/sample-operators/webpage/pom.xml @@ -5,7 +5,7 @@ io.javaoperatorsdk sample-operators - 5.0.2-SNAPSHOT + 5.0.3-SNAPSHOT sample-webpage-operator From 8a37956aa68c8db2df35d26aa28bbfdd75d769a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Feb 2025 16:52:21 +0100 Subject: [PATCH 2/7] chore(deps): bump org.apache.maven.plugins:maven-clean-plugin (#2692) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b1d9c1c6eb..25d6bb558b 100644 --- a/pom.xml +++ b/pom.xml @@ -84,7 +84,7 @@ 3.3.1 3.3.1 3.4.2 - 3.4.0 + 3.4.1 3.2.7 1.7.0 3.0.0 From 0b47463af54ce98d65d9897947e3d97abfe2ceea Mon Sep 17 00:00:00 2001 From: Martin Stefanko Date: Sat, 22 Feb 2025 12:10:49 +0100 Subject: [PATCH 3/7] refactor: CI only pulls each minikube once for each kubernetes version (#2691) Signed-off-by: xstefank --- .github/workflows/build.yml | 54 ++++++++++++++++++++++--- .github/workflows/integration-tests.yml | 20 +++++---- .github/workflows/pr.yml | 8 +++- 3 files changed, 69 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1e813a075..97555ae1b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,39 +1,73 @@ -name: Build +name: Build with Kubernetes env: MAVEN_ARGS: -V -ntp -e on: workflow_call: + inputs: + kube-version: + type: string + required: true jobs: + set_up_kubernetes: + name: Set up Kubernetes ${{ inputs.kube-version }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Minikube + uses: manusa/actions-setup-minikube@v2.13.1 + with: + minikube version: 'v1.34.0' + kubernetes version: '${{ inputs.kube-version }}' + driver: 'docker' + github token: ${{ secrets.GITHUB_TOKEN }} + + - name: Save minikube directory + id: minikube + run: | + echo "minikube-dir=$MINIKUBE_HOME" >> $GITHUB_OUTPUT + + - name: Upload minikube + uses: actions/upload-artifact@v4 + with: + name: minikube-${{ inputs.kube-version }} + path: ${{ steps.minikube.outputs.minikube-dir }} + include-hidden-files: true + integration_tests: + name: "JDK: ${{ matrix.java }}, IT category: ${{ matrix.it-category }}" + needs: set_up_kubernetes strategy: matrix: java: [ 17, 21 ] - kubernetes: [ 'v1.29.12','1.30.8', '1.31.4', '1.32.0' ] it-category: [ 'baseapi', 'dependent', 'workflow' ] uses: ./.github/workflows/integration-tests.yml with: + kube-version: ${{ inputs.kube-version }} java-version: ${{ matrix.java }} - kube-version: ${{ matrix.kubernetes }} it-category: ${{ matrix.it-category }} http_client_tests: + name: "JDK: ${{ matrix.java }}, IT category: ${{ matrix.it-category }}, HTTP client: ${{ matrix.httpclient }}" + needs: set_up_kubernetes strategy: matrix: java: [ 17, 21 ] - kubernetes: [ 'v1.29.12','1.30.8', '1.31.4', '1.32.0' ] it-category: [ 'baseapi' ] httpclient: [ 'vertx', 'jdk', 'jetty' ] uses: ./.github/workflows/integration-tests.yml with: + kube-version: ${{ inputs.kube-version }} java-version: ${{ matrix.java }} - kube-version: ${{ matrix.kubernetes }} it-category: ${{ matrix.it-category }} http-client: ${{ matrix.httpclient }} special_integration_tests: + name: "Special integration tests (${{ matrix.java }})" + needs: set_up_kubernetes runs-on: ubuntu-latest strategy: matrix: @@ -47,3 +81,13 @@ jobs: java-version: ${{ matrix.java }} - name: Run Special Integration Tests run: ./mvnw ${MAVEN_ARGS} -B package -P minimal-watch-timeout-dependent-it --file pom.xml + + delete_kubernetes: + needs: [ integration_tests, http_client_tests, special_integration_tests ] + if: always() + name: Delete Kubernetes ${{ inputs.kube-version }} artifact + runs-on: ubuntu-latest + steps: + - uses: geekyeggo/delete-artifact@v5 + with: + name: minikube-${{ inputs.kube-version }} diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a40c9c8b9a..dff59bfe7c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -28,6 +28,7 @@ on: jobs: integration_tests: + name: "Experimental: ${{ inputs.experimental }}, Checkout ref: ${{ inputs.checkout-ref }}" runs-on: ubuntu-latest continue-on-error: ${{ inputs.experimental }} timeout-minutes: 40 @@ -43,13 +44,18 @@ jobs: distribution: temurin java-version: ${{ inputs.java-version }} cache: 'maven' - - name: Set up Minikube - uses: manusa/actions-setup-minikube@v2.13.1 + - name: Download minikube artifact for Kubernetes ${{ inputs.kube-version }} + uses: actions/download-artifact@v4 with: - minikube version: 'v1.34.0' - kubernetes version: '${{ inputs.kube-version }}' - driver: 'docker' - github token: ${{ secrets.GITHUB_TOKEN }} + name: minikube-${{inputs.kube-version}} + path: minikube + - name: Start minikube with Kubernetes ${{ inputs.kube-version }} + run: | + # wait for docker + docker version -f '{{.Server.Version}} - {{.Client.Version}}' + export MINIKUBE_HOME=$PWD/minikube + minikube start --driver=docker + kubectl version - name: "${{inputs.it-category}} integration tests (kube: ${{ inputs.kube-version }} / java: ${{ inputs.java-version }} / client: ${{ inputs.http-client }})" run: | if [ -z "${{inputs.it-category}}" ]; then @@ -59,4 +65,4 @@ jobs: fi echo "Using profile: ${it_profile}" ./mvnw ${MAVEN_ARGS} -T1C -B install -DskipTests -Pno-apt --file pom.xml - ./mvnw ${MAVEN_ARGS} -T1C -B package -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml \ No newline at end of file + ./mvnw ${MAVEN_ARGS} -T1C -B package -P${it_profile} -Dfabric8-httpclient-impl.name=${{inputs.http-client}} --file pom.xml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index facd6be13a..df0d2eee2b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -31,4 +31,10 @@ jobs: run: ./mvnw ${MAVEN_ARGS} clean install -Pno-apt --file pom.xml build: - uses: ./.github/workflows/build.yml \ No newline at end of file + name: Integration tests with Kubernetes ${{ matrix.kubernetes }} + strategy: + matrix: + kubernetes: [ 'v1.29.12','1.30.8', '1.31.4', '1.32.0' ] + uses: ./.github/workflows/build.yml + with: + kube-version: ${{ matrix.kubernetes }} \ No newline at end of file From cde1bf22641661dfdda6d21f19282dec77e575c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20M=C3=A9sz=C3=A1ros?= Date: Sat, 22 Feb 2025 12:20:10 +0100 Subject: [PATCH 4/7] fix: patch version handling (#2696) --- .../api/reconciler/DefaultContext.java | 6 +- .../event/ReconciliationDispatcher.java | 56 +++++++++++-------- .../event/ReconciliationDispatcherTest.java | 42 +++++++------- .../junit/LocallyRunOperatorExtension.java | 8 +-- .../ChangeNamespaceTestReconciler.java | 13 ++++- .../StatusPatchLockingReconciler.java | 1 + ... => StatusPatchNotLockingForNonSSAIT.java} | 3 +- 7 files changed, 74 insertions(+), 55 deletions(-) rename operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/{StatusPatchNotLockingIT.java => StatusPatchNotLockingForNonSSAIT.java} (95%) diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java index 4c8b857d47..ce6f67176c 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/DefaultContext.java @@ -117,7 +117,7 @@ public DefaultContext

setRetryInfo(RetryInfo retryInfo) { return this; } - public P getPrimaryResource() { - return primaryResource; - } + public P getPrimaryResource() { + return primaryResource; + } } diff --git a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java index 8c502d41ff..baa7c36121 100644 --- a/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java +++ b/operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcher.java @@ -58,7 +58,8 @@ class ReconciliationDispatcher

{ public ReconciliationDispatcher(Controller

controller) { this(controller, - new CustomResourceFacade<>(controller.getCRClient(), controller.getConfiguration())); + new CustomResourceFacade<>(controller.getCRClient(), controller.getConfiguration(), + controller.getConfiguration().getConfigurationService().getResourceCloner())); } public PostExecutionControl

handleExecution(ExecutionScope

executionScope) { @@ -364,14 +365,16 @@ static class CustomResourceFacade { private final MixedOperation, Resource> resourceOperation; private final boolean useSSA; private final String fieldManager; + private final Cloner cloner; public CustomResourceFacade( - MixedOperation, Resource> resourceOperation, - ControllerConfiguration configuration) { + MixedOperation, Resource> resourceOperation, + ControllerConfiguration configuration, Cloner cloner) { this.resourceOperation = resourceOperation; this.useSSA = configuration.getConfigurationService().useSSAToPatchPrimaryResource(); this.fieldManager = configuration.fieldManager(); + this.cloner = cloner; } public R getResource(String namespace, String name) { @@ -402,30 +405,37 @@ public R patchResource(R resource, R originalResource) { public R patchStatus(R resource, R originalResource) { log.trace("Patching status for resource: {} with ssa: {}", resource, useSSA); + if (useSSA) { + var managedFields = resource.getMetadata().getManagedFields(); + try { + resource.getMetadata().setManagedFields(null); + var res = resource(resource); + return res.subresource("status").patch(new PatchContext.Builder() + .withFieldManager(fieldManager) + .withForce(true) + .withPatchType(PatchType.SERVER_SIDE_APPLY) + .build()); + } finally { + resource.getMetadata().setManagedFields(managedFields); + } + } else { + return editStatus(resource, originalResource); + } + } + + private R editStatus(R resource, R originalResource) { String resourceVersion = resource.getMetadata().getResourceVersion(); - originalResource.getMetadata().setResourceVersion(null); - resource.getMetadata().setResourceVersion(null); + // the cached resource should not be changed in any circumstances + // that can lead to all kinds of race conditions. + R clonedOriginal = cloner.clone(originalResource); try { - if (useSSA) { - var managedFields = resource.getMetadata().getManagedFields(); - try { - resource.getMetadata().setManagedFields(null); - var res = resource(resource); - return res.subresource("status").patch(new PatchContext.Builder() - .withFieldManager(fieldManager) - .withForce(true) - .withPatchType(PatchType.SERVER_SIDE_APPLY) - .build()); - } finally { - resource.getMetadata().setManagedFields(managedFields); - } - } else { - var res = resource(originalResource); - return res.editStatus(r -> resource); - } + clonedOriginal.getMetadata().setResourceVersion(null); + resource.getMetadata().setResourceVersion(null); + var res = resource(clonedOriginal); + return res.editStatus(r -> resource); } finally { // restore initial resource version - originalResource.getMetadata().setResourceVersion(resourceVersion); + clonedOriginal.getMetadata().setResourceVersion(resourceVersion); resource.getMetadata().setResourceVersion(resourceVersion); } } diff --git a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcherTest.java b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcherTest.java index e5fe1c5882..f8f0c59845 100644 --- a/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcherTest.java +++ b/operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/event/ReconciliationDispatcherTest.java @@ -7,8 +7,6 @@ import java.util.function.BiFunction; import java.util.function.Supplier; -import io.fabric8.kubernetes.client.utils.KubernetesSerialization; -import io.javaoperatorsdk.operator.api.reconciler.DefaultContext; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; @@ -19,6 +17,7 @@ import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.client.CustomResource; import io.fabric8.kubernetes.client.KubernetesClientException; +import io.fabric8.kubernetes.client.utils.KubernetesSerialization; import io.javaoperatorsdk.operator.MockKubernetesClient; import io.javaoperatorsdk.operator.OperatorException; import io.javaoperatorsdk.operator.TestUtils; @@ -29,6 +28,7 @@ import io.javaoperatorsdk.operator.api.config.MockControllerConfiguration; import io.javaoperatorsdk.operator.api.reconciler.Cleaner; import io.javaoperatorsdk.operator.api.reconciler.Context; +import io.javaoperatorsdk.operator.api.reconciler.DefaultContext; import io.javaoperatorsdk.operator.api.reconciler.DeleteControl; import io.javaoperatorsdk.operator.api.reconciler.ErrorStatusUpdateControl; import io.javaoperatorsdk.operator.api.reconciler.Reconciler; @@ -70,8 +70,9 @@ void setup() { } static void initConfigService(boolean useSSA) { - initConfigService(useSSA,true); + initConfigService(useSSA, true); } + static void initConfigService(boolean useSSA, boolean noCloning) { /* * We need this for mock reconcilers to properly generate the expected UpdateControl: without @@ -82,18 +83,19 @@ static void initConfigService(boolean useSSA, boolean noCloning) { */ configurationService = ConfigurationService.newOverriddenConfigurationService(new BaseConfigurationService(), - overrider -> overrider.checkingCRDAndValidateLocalModel(false) + overrider -> overrider.checkingCRDAndValidateLocalModel(false) .withResourceCloner(new Cloner() { @Override public R clone(R object) { - if (noCloning) { - return object; - }else { - return new KubernetesSerialization().clone(object); + if (noCloning) { + return object; + } else { + return new KubernetesSerialization().clone(object); + } } - }}) - .withUseSSAToPatchPrimaryResource(useSSA)); + }) + .withUseSSAToPatchPrimaryResource(useSSA)); } private ReconciliationDispatcher init(R customResource, @@ -669,22 +671,24 @@ void reSchedulesFromErrorHandler() { @Test void reconcilerContextUsesTheSameInstanceOfResourceAsParam() { - initConfigService(false,false); + initConfigService(false, false); final ReconciliationDispatcher dispatcher = - init(testCustomResource, reconciler, null, customResourceFacade, true); + init(testCustomResource, reconciler, null, customResourceFacade, true); testCustomResource.addFinalizer(DEFAULT_FINALIZER); - ArgumentCaptor contextArgumentCaptor = ArgumentCaptor.forClass(DefaultContext.class); - ArgumentCaptor customResourceCaptor = ArgumentCaptor.forClass(TestCustomResource.class); + ArgumentCaptor contextArgumentCaptor = + ArgumentCaptor.forClass(DefaultContext.class); + ArgumentCaptor customResourceCaptor = + ArgumentCaptor.forClass(TestCustomResource.class); dispatcher.handleExecution(executionScopeWithCREvent(testCustomResource)); - verify(reconciler, times(1)) - .reconcile(customResourceCaptor.capture(), contextArgumentCaptor.capture()); + verify(reconciler, times(1)) + .reconcile(customResourceCaptor.capture(), contextArgumentCaptor.capture()); - assertThat(contextArgumentCaptor.getValue().getPrimaryResource()) - .isSameAs(customResourceCaptor.getValue()) - .isNotSameAs(testCustomResource); + assertThat(contextArgumentCaptor.getValue().getPrimaryResource()) + .isSameAs(customResourceCaptor.getValue()) + .isNotSameAs(testCustomResource); } private ObservedGenCustomResource createObservedGenCustomResource() { diff --git a/operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java b/operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java index 45cd85b468..14bc096ff2 100644 --- a/operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java +++ b/operator-framework-junit5/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java @@ -8,13 +8,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.time.Duration; -import java.util.ArrayDeque; import java.util.ArrayList; -import java.util.Deque; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -22,7 +18,6 @@ import java.util.function.Function; import java.util.stream.Stream; -import io.fabric8.kubernetes.client.dsl.NamespaceListVisitFromServerGetDeleteRecreateWaitApplicable; import org.junit.jupiter.api.extension.ExtensionContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +44,8 @@ public class LocallyRunOperatorExtension extends AbstractOperatorExtension { private static final Logger LOGGER = LoggerFactory.getLogger(LocallyRunOperatorExtension.class); private static final int CRD_DELETE_TIMEOUT = 1000; private static final Set appliedCRDs = new HashSet<>(); - private static final boolean deleteCRDs = Boolean.parseBoolean(System.getProperty("testsuite.deleteCRDs", "true")); + private static final boolean deleteCRDs = + Boolean.parseBoolean(System.getProperty("testsuite.deleteCRDs", "true")); private final Operator operator; private final List reconcilers; diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/changenamespace/ChangeNamespaceTestReconciler.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/changenamespace/ChangeNamespaceTestReconciler.java index bac97514b6..fc14b0951f 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/changenamespace/ChangeNamespaceTestReconciler.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/changenamespace/ChangeNamespaceTestReconciler.java @@ -45,13 +45,20 @@ public UpdateControl reconcile( .create(); } - increaseNumberOfResourceExecutions(primary); if (primary.getStatus() == null) { primary.setStatus(new ChangeNamespaceTestCustomResourceStatus()); } + increaseNumberOfResourceExecutions(primary); + + var statusPatchResource = new ChangeNamespaceTestCustomResource(); + statusPatchResource.setMetadata(new ObjectMetaBuilder() + .withName(primary.getMetadata().getName()) + .withNamespace(primary.getMetadata().getNamespace()) + .build()); + statusPatchResource.setStatus(new ChangeNamespaceTestCustomResourceStatus()); var statusUpdates = primary.getStatus().getNumberOfStatusUpdates(); - primary.getStatus().setNumberOfStatusUpdates(statusUpdates + 1); - return UpdateControl.patchStatus(primary); + statusPatchResource.getStatus().setNumberOfStatusUpdates(statusUpdates + 1); + return UpdateControl.patchStatus(statusPatchResource); } private void increaseNumberOfResourceExecutions(ChangeNamespaceTestCustomResource primary) { diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchLockingReconciler.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchLockingReconciler.java index 9cafaa26ec..46f0e63331 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchLockingReconciler.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchLockingReconciler.java @@ -21,6 +21,7 @@ public UpdateControl reconcile( throws InterruptedException { numberOfExecutions.addAndGet(1); Thread.sleep(WAIT_TIME); + if (resource.getStatus() == null) { resource.setStatus(new StatusPatchLockingCustomResourceStatus()); } diff --git a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchNotLockingIT.java b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchNotLockingForNonSSAIT.java similarity index 95% rename from operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchNotLockingIT.java rename to operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchNotLockingForNonSSAIT.java index 24ce2d1047..2363a86392 100644 --- a/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchNotLockingIT.java +++ b/operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/statuspatchnonlocking/StatusPatchNotLockingForNonSSAIT.java @@ -14,13 +14,14 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.awaitility.Awaitility.await; -class StatusPatchNotLockingIT { +class StatusPatchNotLockingForNonSSAIT { public static final String TEST_RESOURCE_NAME = "test"; @RegisterExtension LocallyRunOperatorExtension operator = LocallyRunOperatorExtension.builder().withReconciler(StatusPatchLockingReconciler.class) + .withConfigurationService(o -> o.withUseSSAToPatchPrimaryResource(false)) .build(); @Test From bae8da37fe271beaaea2d561784988d80daac3dd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 12:50:08 +0100 Subject: [PATCH 5/7] chore(deps): bump com.diffplug.spotless:spotless-maven-plugin (#2693) Bumps [com.diffplug.spotless:spotless-maven-plugin](https://github.com/diffplug/spotless) from 2.43.0 to 2.44.3. - [Release notes](https://github.com/diffplug/spotless/releases) - [Changelog](https://github.com/diffplug/spotless/blob/main/CHANGES.md) - [Commits](https://github.com/diffplug/spotless/compare/lib/2.43.0...maven/2.44.3) --- updated-dependencies: - dependency-name: com.diffplug.spotless:spotless-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- operator-framework-bom/pom.xml | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/operator-framework-bom/pom.xml b/operator-framework-bom/pom.xml index 9874f8ce76..779a9feac4 100644 --- a/operator-framework-bom/pom.xml +++ b/operator-framework-bom/pom.xml @@ -45,7 +45,7 @@ 3.2.7 3.3.1 3.11.2 - 2.43.0 + 2.44.3 diff --git a/pom.xml b/pom.xml index 25d6bb558b..c2611e448e 100644 --- a/pom.xml +++ b/pom.xml @@ -91,7 +91,7 @@ 3.1.3 9.0.1 3.4.4 - 2.43.0 + 2.44.3 From 795f83573f15cafe4ec321c5ec69bf765beb6139 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:52:42 +0100 Subject: [PATCH 6/7] chore(deps): bump org.awaitility:awaitility from 4.2.2 to 4.3.0 (#2701) --- pom.xml | 2 +- sample-operators/tomcat-operator/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c2611e448e..aacd726f55 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ 0.21.0 1.13.0 3.27.3 - 4.2.2 + 4.3.0 2.7.3 1.14.4 3.2.0 diff --git a/sample-operators/tomcat-operator/pom.xml b/sample-operators/tomcat-operator/pom.xml index dac3246700..e369188763 100644 --- a/sample-operators/tomcat-operator/pom.xml +++ b/sample-operators/tomcat-operator/pom.xml @@ -67,7 +67,7 @@ org.awaitility awaitility - 4.2.2 + 4.3.0 test From 42f7432a8e7b80d157c89d2f62ed861244f796b1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:53:10 +0100 Subject: [PATCH 7/7] chore(deps): bump org.junit:junit-bom from 5.11.4 to 5.12.0 (#2700) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index aacd726f55..8dde4ba60f 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ https://sonarcloud.io jdk - 5.11.4 + 5.12.0 7.1.0 2.0.12 2.24.3