From e2c59bd35ec48d9c37da790389536e9455a7b219 Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Fri, 16 Jul 2021 13:34:11 -0400 Subject: [PATCH 1/5] Update dependencies --- .../checkstyle/customized_google_checks.xml | 2 +- integration-tests/pom.xml | 7 +- operator-build-maven-plugin/pom.xml | 6 +- .../operator/helpers/CrdHelper.java | 10 ++- .../helpers/IntrospectionStatusTest.java | 85 +++++++++---------- pom.xml | 39 ++++----- 6 files changed, 68 insertions(+), 81 deletions(-) diff --git a/build-tools/checkstyle/customized_google_checks.xml b/build-tools/checkstyle/customized_google_checks.xml index 098a487c15a..e2184091e28 100644 --- a/build-tools/checkstyle/customized_google_checks.xml +++ b/build-tools/checkstyle/customized_google_checks.xml @@ -292,7 +292,7 @@ value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> - + diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index b8a1070f3b5..ee9786f013c 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -59,7 +59,7 @@ net.sourceforge.htmlunit htmlunit - 2.47.1 + 2.51.0 test @@ -139,11 +139,6 @@ junit-jupiter-engine ${junit.jupiter.version} - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.surefire.version} - diff --git a/operator-build-maven-plugin/pom.xml b/operator-build-maven-plugin/pom.xml index 9b774488d5f..dee094d1f56 100644 --- a/operator-build-maven-plugin/pom.xml +++ b/operator-build-maven-plugin/pom.xml @@ -23,12 +23,12 @@ org.apache.maven maven-plugin-api - 3.6.3 + 3.8.1 org.apache.maven.plugin-tools maven-plugin-annotations - 3.6.0 + 3.6.1 org.junit.jupiter @@ -43,7 +43,7 @@ org.ow2.asm asm - 9.1 + 9.2 test diff --git a/operator/src/main/java/oracle/kubernetes/operator/helpers/CrdHelper.java b/operator/src/main/java/oracle/kubernetes/operator/helpers/CrdHelper.java index f5c3e281103..f741b9b84a8 100644 --- a/operator/src/main/java/oracle/kubernetes/operator/helpers/CrdHelper.java +++ b/operator/src/main/java/oracle/kubernetes/operator/helpers/CrdHelper.java @@ -45,6 +45,7 @@ import oracle.kubernetes.operator.work.Step; import oracle.kubernetes.weblogic.domain.model.DomainSpec; import oracle.kubernetes.weblogic.domain.model.DomainStatus; +import org.yaml.snakeyaml.constructor.SafeConstructor; import static oracle.kubernetes.weblogic.domain.model.CrdSchemaGenerator.createCrdSchemaGenerator; @@ -205,7 +206,14 @@ static String getVersionFromCrdSchemaFileName(String name) { } static V1CustomResourceValidation getValidationFromCrdSchemaFile(String fileContents) { - return Yaml.getSnakeYaml().loadAs(new StringReader(fileContents), V1CustomResourceValidation.class); + return getSnakeYaml(V1CustomResourceValidation.class) + .loadAs(new StringReader(fileContents), V1CustomResourceValidation.class); + } + + private static org.yaml.snakeyaml.Yaml getSnakeYaml(Class type) { + return type != null ? new org.yaml.snakeyaml.Yaml(new Yaml.CustomConstructor(type), + new Yaml.CustomRepresenter()) : + new org.yaml.snakeyaml.Yaml(new SafeConstructor(), new Yaml.CustomRepresenter()); } static V1CustomResourceSubresources createSubresources() { diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java index 8184296c0fa..df22575964e 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java @@ -13,13 +13,14 @@ import com.meterware.simplestub.Memento; import com.meterware.simplestub.StaticStubSupport; import io.kubernetes.client.openapi.models.V1ContainerState; -import io.kubernetes.client.openapi.models.V1ContainerStateBuilder; +import io.kubernetes.client.openapi.models.V1ContainerStateTerminated; +import io.kubernetes.client.openapi.models.V1ContainerStateWaiting; +import io.kubernetes.client.openapi.models.V1ContainerStatus; import io.kubernetes.client.openapi.models.V1ObjectMeta; import io.kubernetes.client.openapi.models.V1Pod; import io.kubernetes.client.openapi.models.V1PodCondition; -import io.kubernetes.client.openapi.models.V1PodConditionBuilder; import io.kubernetes.client.openapi.models.V1PodSpec; -import io.kubernetes.client.openapi.models.V1PodStatusBuilder; +import io.kubernetes.client.openapi.models.V1PodStatus; import oracle.kubernetes.operator.DomainProcessorDelegateStub; import oracle.kubernetes.operator.DomainProcessorImpl; import oracle.kubernetes.operator.DomainProcessorTestSetup; @@ -209,16 +210,13 @@ public void whenNewIntrospectorJobPodStatusReasonNullAfterImagePullFailure_patch } private V1Pod createIntrospectorJobPod(V1ContainerState waitingState) { - return createIntrospectorJobPod(UID) - .status( - new V1PodStatusBuilder() - .addNewContainerStatus() - .withImage(IMAGE_NAME) - .withName(toJobIntrospectorName(UID)) - .withReady(false) - .withState(waitingState) - .endContainerStatus() - .build()); + return createIntrospectorJobPod(UID).status( + new V1PodStatus().addContainerStatusesItem( + new V1ContainerStatus() + .image(IMAGE_NAME) + .name(toJobIntrospectorName(UID)) + .ready(false) + .state(waitingState))); } @SuppressWarnings("SameParameterValue") @@ -237,62 +235,55 @@ private V1Pod createIntrospectorJobPod(String domainUid) { private V1Pod createIntrospectorJobPodWithConditions(V1PodCondition condition) { return createIntrospectorJobPod(UID) .status( - new V1PodStatusBuilder() - .withConditions(condition) - .build()); + new V1PodStatus() + .addConditionsItem(condition)); } @SuppressWarnings("SameParameterValue") private V1Pod createIntrospectorJobPodWithPhase(String phase, String reason) { return createIntrospectorJobPod(UID) .status( - new V1PodStatusBuilder() - .withPhase(phase) - .withReason(reason) - .withMessage(MESSAGE) - .build()); + new V1PodStatus() + .phase(phase) + .reason(reason) + .message(MESSAGE)); } private V1Pod createIntrospectorJobPodWithPhaseReasonMessage( String phase, String reason, String message, V1ContainerState conState) { return createIntrospectorJobPod(UID) .status( - new V1PodStatusBuilder() - .withPhase(phase) - .withReason(reason) - .withMessage(message) - .addNewContainerStatus() - .withImage(IMAGE_NAME) - .withName(toJobIntrospectorName(UID)) - .withReady(false) - .withState(conState) - .endContainerStatus() - .build()); + new V1PodStatus() + .phase(phase) + .reason(reason) + .message(message) + .addContainerStatusesItem( + new V1ContainerStatus() + .image(IMAGE_NAME) + .name(toJobIntrospectorName(UID)) + .ready(false) + .state(conState))); } private V1ContainerState createTerminatedState(String reason, String message) { - return new V1ContainerStateBuilder() - .withNewTerminated().withReason(reason) - .withMessage(message) - .endTerminated() - .build(); + return new V1ContainerState() + .terminated(new V1ContainerStateTerminated() + .reason(reason) + .message(message)); } private V1ContainerState createWaitingState(String reason, String message) { - return new V1ContainerStateBuilder() - .withNewWaiting() - .withReason(reason) - .withMessage(message) - .endWaiting() - .build(); + return new V1ContainerState() + .waiting(new V1ContainerStateWaiting() + .reason(reason) + .message(message)); } @SuppressWarnings("SameParameterValue") private V1PodCondition createPodConditions(String reason, String message) { - return new V1PodConditionBuilder() - .withReason(reason) - .withMessage(message) - .build(); + return new V1PodCondition() + .reason(reason) + .message(message); } diff --git a/pom.xml b/pom.xml index 98cac0cb5a9..75451f3cb9d 100644 --- a/pom.xml +++ b/pom.xml @@ -170,12 +170,6 @@ ${maven-surefire-plugin-version} - - org.apache.maven.plugins - surefire-logger-api - ${surefire-logger-api-version} - - org.apache.maven.plugins maven-dependency-plugin @@ -589,45 +583,44 @@ 3.2.0 3.2.0 3.9.1 - 2.22.2 - 2.22.2 + 3.0.0-M5 3.1.2 3.0.0-M1 3.2.0 - 3.0.0-M3 + 3.0.0-M5 3.1.2 3.0.0 4.2.0 - 4.2.1 - 8.41 - 0.1 + 4.3.0 + 8.44 + 0.3.1 3.0.0 1.6 2.0.0.0 1.3.0 - 2.0.0 + 2.0.1 2.0.1 1.0.39 - 1.0.49 + 1.0.57 1.3 1.15 1.7.3 0.1.0 - 2.5.0 + 2.6.0 3.2.0 1.0.0 - 3.19.0 - 2.8.0 - 4.0.3 - 12.0.0 - 5.7.1 + 3.20.2 + 2.11.0 + 4.1.0 + 13.0.0 + 5.7.2 5.7.1 1.7.0 1.3.2 UTF-8 - 3.0.1 - 2.12.1 - 2.11.4 + 3.0.2 + 2.12.4 + 2.12.4 6.1.5 ${project.basedir}/src-generated-swagger ${root-generated-swagger}/main/java From 6526cf66f479a961978a319e68070c043bff989c Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Fri, 16 Jul 2021 15:49:57 -0400 Subject: [PATCH 2/5] Filter Jetbrains libraries --- operator/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operator/pom.xml b/operator/pom.xml index 1b21380e6b1..494bb5ab716 100644 --- a/operator/pom.xml +++ b/operator/pom.xml @@ -108,7 +108,7 @@ runtime ${project.build.directory}/lib - io.prometheus,com.google.protobuf + io.prometheus,com.google.protobuf,org.jetbrains.kotlin,org.jetbrains.annotations From a94e70ef5d2e652dec8a0599c650dfdf0969d29b Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Fri, 16 Jul 2021 16:25:11 -0400 Subject: [PATCH 3/5] Restore fluent --- operator/pom.xml | 5 ++ .../helpers/IntrospectionStatusTest.java | 85 ++++++++++--------- pom.xml | 5 ++ 3 files changed, 57 insertions(+), 38 deletions(-) diff --git a/operator/pom.xml b/operator/pom.xml index 494bb5ab716..25a44cf9a35 100644 --- a/operator/pom.xml +++ b/operator/pom.xml @@ -329,6 +329,11 @@ client-java + + io.kubernetes + client-java-api-fluent + + com.appscode.voyager diff --git a/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java b/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java index df22575964e..8184296c0fa 100644 --- a/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java +++ b/operator/src/test/java/oracle/kubernetes/operator/helpers/IntrospectionStatusTest.java @@ -13,14 +13,13 @@ import com.meterware.simplestub.Memento; import com.meterware.simplestub.StaticStubSupport; import io.kubernetes.client.openapi.models.V1ContainerState; -import io.kubernetes.client.openapi.models.V1ContainerStateTerminated; -import io.kubernetes.client.openapi.models.V1ContainerStateWaiting; -import io.kubernetes.client.openapi.models.V1ContainerStatus; +import io.kubernetes.client.openapi.models.V1ContainerStateBuilder; import io.kubernetes.client.openapi.models.V1ObjectMeta; import io.kubernetes.client.openapi.models.V1Pod; import io.kubernetes.client.openapi.models.V1PodCondition; +import io.kubernetes.client.openapi.models.V1PodConditionBuilder; import io.kubernetes.client.openapi.models.V1PodSpec; -import io.kubernetes.client.openapi.models.V1PodStatus; +import io.kubernetes.client.openapi.models.V1PodStatusBuilder; import oracle.kubernetes.operator.DomainProcessorDelegateStub; import oracle.kubernetes.operator.DomainProcessorImpl; import oracle.kubernetes.operator.DomainProcessorTestSetup; @@ -210,13 +209,16 @@ public void whenNewIntrospectorJobPodStatusReasonNullAfterImagePullFailure_patch } private V1Pod createIntrospectorJobPod(V1ContainerState waitingState) { - return createIntrospectorJobPod(UID).status( - new V1PodStatus().addContainerStatusesItem( - new V1ContainerStatus() - .image(IMAGE_NAME) - .name(toJobIntrospectorName(UID)) - .ready(false) - .state(waitingState))); + return createIntrospectorJobPod(UID) + .status( + new V1PodStatusBuilder() + .addNewContainerStatus() + .withImage(IMAGE_NAME) + .withName(toJobIntrospectorName(UID)) + .withReady(false) + .withState(waitingState) + .endContainerStatus() + .build()); } @SuppressWarnings("SameParameterValue") @@ -235,55 +237,62 @@ private V1Pod createIntrospectorJobPod(String domainUid) { private V1Pod createIntrospectorJobPodWithConditions(V1PodCondition condition) { return createIntrospectorJobPod(UID) .status( - new V1PodStatus() - .addConditionsItem(condition)); + new V1PodStatusBuilder() + .withConditions(condition) + .build()); } @SuppressWarnings("SameParameterValue") private V1Pod createIntrospectorJobPodWithPhase(String phase, String reason) { return createIntrospectorJobPod(UID) .status( - new V1PodStatus() - .phase(phase) - .reason(reason) - .message(MESSAGE)); + new V1PodStatusBuilder() + .withPhase(phase) + .withReason(reason) + .withMessage(MESSAGE) + .build()); } private V1Pod createIntrospectorJobPodWithPhaseReasonMessage( String phase, String reason, String message, V1ContainerState conState) { return createIntrospectorJobPod(UID) .status( - new V1PodStatus() - .phase(phase) - .reason(reason) - .message(message) - .addContainerStatusesItem( - new V1ContainerStatus() - .image(IMAGE_NAME) - .name(toJobIntrospectorName(UID)) - .ready(false) - .state(conState))); + new V1PodStatusBuilder() + .withPhase(phase) + .withReason(reason) + .withMessage(message) + .addNewContainerStatus() + .withImage(IMAGE_NAME) + .withName(toJobIntrospectorName(UID)) + .withReady(false) + .withState(conState) + .endContainerStatus() + .build()); } private V1ContainerState createTerminatedState(String reason, String message) { - return new V1ContainerState() - .terminated(new V1ContainerStateTerminated() - .reason(reason) - .message(message)); + return new V1ContainerStateBuilder() + .withNewTerminated().withReason(reason) + .withMessage(message) + .endTerminated() + .build(); } private V1ContainerState createWaitingState(String reason, String message) { - return new V1ContainerState() - .waiting(new V1ContainerStateWaiting() - .reason(reason) - .message(message)); + return new V1ContainerStateBuilder() + .withNewWaiting() + .withReason(reason) + .withMessage(message) + .endWaiting() + .build(); } @SuppressWarnings("SameParameterValue") private V1PodCondition createPodConditions(String reason, String message) { - return new V1PodCondition() - .reason(reason) - .message(message); + return new V1PodConditionBuilder() + .withReason(reason) + .withMessage(message) + .build(); } diff --git a/pom.xml b/pom.xml index 75451f3cb9d..e0c289b5462 100644 --- a/pom.xml +++ b/pom.xml @@ -435,6 +435,11 @@ client-java-extended ${client-java-version} + + io.kubernetes + client-java-api-fluent + ${client-java-version} + org.hamcrest hamcrest-junit From 1a041733350a98aebc22b9f47a1013be2a1da1ab Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Sun, 18 Jul 2021 21:37:21 -0400 Subject: [PATCH 4/5] Restore kotlin --- operator/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/operator/pom.xml b/operator/pom.xml index 25a44cf9a35..5c9ea402267 100644 --- a/operator/pom.xml +++ b/operator/pom.xml @@ -108,7 +108,7 @@ runtime ${project.build.directory}/lib - io.prometheus,com.google.protobuf,org.jetbrains.kotlin,org.jetbrains.annotations + io.prometheus,com.google.protobuf From 1e9c63f22d65383479e3ce92c9d71a7b04a7ef80 Mon Sep 17 00:00:00 2001 From: Ryan Eberhard Date: Mon, 19 Jul 2021 14:22:36 -0400 Subject: [PATCH 5/5] Use --add-opens --- integration-tests/pom.xml | 5 +---- kubernetes/pom.xml | 2 +- operator/pom.xml | 5 +++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index cdb27cfe5c0..23b0b46cf44 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -70,12 +70,9 @@ org.apache.maven.plugins maven-failsafe-plugin - - --illegal-access=permit - UTF-8 - --illegal-access=permit + --add-opens java.base/java.time=ALL-UNNAMED ${failsafeArgLine} false diff --git a/kubernetes/pom.xml b/kubernetes/pom.xml index 4120eab0111..140d8d1fdd4 100644 --- a/kubernetes/pom.xml +++ b/kubernetes/pom.xml @@ -120,7 +120,7 @@ **/*AT.java - --illegal-access=permit + --add-opens java.base/java.time=ALL-UNNAMED diff --git a/operator/pom.xml b/operator/pom.xml index 5c9ea402267..562f4c114f5 100644 --- a/operator/pom.xml +++ b/operator/pom.xml @@ -92,7 +92,7 @@ **/*Test.java - --illegal-access=permit + --add-opens java.base/java.time=ALL-UNNAMED @@ -235,7 +235,8 @@ java - --illegal-access=permit + --add-opens + java.base/java.time=ALL-UNNAMED -classpath