From 4241a5a3032f3ad98d2c2ca05a2202f1ff6a10d9 Mon Sep 17 00:00:00 2001 From: Erik Merkle Date: Wed, 23 Oct 2024 18:18:30 -0500 Subject: [PATCH 1/3] Update Resteasy and Netty to pull in updated Jackson libraries --- management-api-server/doc/openapi.json | 37 +++---------------- management-api-server/pom.xml | 22 +++++------ .../mgmtapi/ManagementApplication.java | 6 +-- .../mgmtapi/resources/AuthResources.java | 12 +++--- .../resources/K8OperatorResources.java | 14 +++---- .../resources/KeyspaceOpsResources.java | 16 ++++---- .../mgmtapi/resources/LifecycleResources.java | 18 ++++----- .../mgmtapi/resources/MetadataResources.java | 10 ++--- .../mgmtapi/resources/NodeOpsResources.java | 20 +++++----- .../mgmtapi/resources/TableOpsResources.java | 16 ++++---- .../resources/common/BaseResources.java | 4 +- .../resources/v1/KeyspaceOpsResources.java | 12 +++--- .../resources/v1/NodeOpsResources.java | 14 +++---- .../resources/v1/TableOpsResources.java | 16 ++++---- .../resources/v2/RepairResourcesV2.java | 14 +++---- .../resources/v2/TokenResourcesV2.java | 12 +++--- .../com/datastax/mgmtapi/DSESpecificIT.java | 2 +- .../mgmtapi/K8OperatorResourcesTest.java | 2 +- .../mgmtapi/NettyHttpOverIPCTest.java | 8 ++-- .../resources/v2/RepairResourcesV2Test.java | 2 +- pom.xml | 2 +- 21 files changed, 116 insertions(+), 143 deletions(-) diff --git a/management-api-server/doc/openapi.json b/management-api-server/doc/openapi.json index f8641d5b..c03b7a69 100644 --- a/management-api-server/doc/openapi.json +++ b/management-api-server/doc/openapi.json @@ -564,10 +564,7 @@ "200" : { "content" : { "application/json" : { - "example" : { - "class" : "org.apache.cassandra.locator.SimpleStrategy", - "replication_factor" : "2" - }, + "example" : "{\"class\":\"org.apache.cassandra.locator.SimpleStrategy\",\"replication_factor\":\"2\"}", "schema" : { "type" : "string" } @@ -747,31 +744,7 @@ "200" : { "content" : { "application/json" : { - "example" : { - "entity" : false, - "variant" : { - "language" : null, - "mediaType" : { - "type" : "application", - "subtype" : "json", - "parameters" : { }, - "wildcardType" : false, - "wildcardSubtype" : false - }, - "encoding" : null, - "languageString" : null - }, - "annotations" : [ ], - "mediaType" : { - "type" : "application", - "subtype" : "json", - "parameters" : { }, - "wildcardType" : false, - "wildcardSubtype" : false - }, - "language" : null, - "encoding" : null - }, + "example" : "{\"entity\":false,\"variant\":{\"language\":null,\"mediaType\":{\"type\":\"application\",\"subtype\":\"json\",\"parameters\":{},\"wildcardType\":false,\"wildcardSubtype\":false},\"encoding\":null,\"languageString\":null},\"annotations\":[],\"mediaType\":{\"type\":\"application\",\"subtype\":\"json\",\"parameters\":{},\"wildcardType\":false,\"wildcardSubtype\":false},\"language\":null,\"encoding\":null}", "schema" : { "type" : "string" } @@ -1936,7 +1909,7 @@ "example" : "keyspace must be specified", "schema" : { "type" : "string", - "enum" : [ "OK", "Created", "Accepted", "No Content", "Reset Content", "Partial Content", "Moved Permanently", "Found", "See Other", "Not Modified", "Use Proxy", "Temporary Redirect", "Bad Request", "Unauthorized", "Payment Required", "Forbidden", "Not Found", "Method Not Allowed", "Not Acceptable", "Proxy Authentication Required", "Request Timeout", "Conflict", "Gone", "Length Required", "Precondition Failed", "Request Entity Too Large", "Request-URI Too Long", "Unsupported Media Type", "Requested Range Not Satisfiable", "Expectation Failed", "Precondition Required", "Too Many Requests", "Request Header Fields Too Large", "Internal Server Error", "Not Implemented", "Bad Gateway", "Service Unavailable", "Gateway Timeout", "HTTP Version Not Supported", "Network Authentication Required" ] + "enum" : [ "OK", "Created", "Accepted", "No Content", "Reset Content", "Partial Content", "Multiple Choices", "Moved Permanently", "Found", "See Other", "Not Modified", "Use Proxy", "Temporary Redirect", "Permanent Redirect", "Bad Request", "Unauthorized", "Payment Required", "Forbidden", "Not Found", "Method Not Allowed", "Not Acceptable", "Proxy Authentication Required", "Request Timeout", "Conflict", "Gone", "Length Required", "Precondition Failed", "Request Entity Too Large", "Request-URI Too Long", "Unsupported Media Type", "Requested Range Not Satisfiable", "Expectation Failed", "Precondition Required", "Too Many Requests", "Request Header Fields Too Large", "Unavailable For Legal Reasons", "Internal Server Error", "Not Implemented", "Bad Gateway", "Service Unavailable", "Gateway Timeout", "HTTP Version Not Supported", "Network Authentication Required" ] } } }, @@ -1948,7 +1921,7 @@ "example" : "internal error, we did not receive the expected repair ID from Cassandra.", "schema" : { "type" : "string", - "enum" : [ "OK", "Created", "Accepted", "No Content", "Reset Content", "Partial Content", "Moved Permanently", "Found", "See Other", "Not Modified", "Use Proxy", "Temporary Redirect", "Bad Request", "Unauthorized", "Payment Required", "Forbidden", "Not Found", "Method Not Allowed", "Not Acceptable", "Proxy Authentication Required", "Request Timeout", "Conflict", "Gone", "Length Required", "Precondition Failed", "Request Entity Too Large", "Request-URI Too Long", "Unsupported Media Type", "Requested Range Not Satisfiable", "Expectation Failed", "Precondition Required", "Too Many Requests", "Request Header Fields Too Large", "Internal Server Error", "Not Implemented", "Bad Gateway", "Service Unavailable", "Gateway Timeout", "HTTP Version Not Supported", "Network Authentication Required" ] + "enum" : [ "OK", "Created", "Accepted", "No Content", "Reset Content", "Partial Content", "Multiple Choices", "Moved Permanently", "Found", "See Other", "Not Modified", "Use Proxy", "Temporary Redirect", "Permanent Redirect", "Bad Request", "Unauthorized", "Payment Required", "Forbidden", "Not Found", "Method Not Allowed", "Not Acceptable", "Proxy Authentication Required", "Request Timeout", "Conflict", "Gone", "Length Required", "Precondition Failed", "Request Entity Too Large", "Request-URI Too Long", "Unsupported Media Type", "Requested Range Not Satisfiable", "Expectation Failed", "Precondition Required", "Too Many Requests", "Request Header Fields Too Large", "Unavailable For Legal Reasons", "Internal Server Error", "Not Implemented", "Bad Gateway", "Service Unavailable", "Gateway Timeout", "HTTP Version Not Supported", "Network Authentication Required" ] } } }, @@ -2182,7 +2155,7 @@ "type" : "array", "items" : { "type" : "string", - "enum" : [ "ASYNC_SSTABLE_TASKS", "FULL_QUERY_LOGGING", "REBUILD", "ASYNC_UPGRADE_SSTABLE_TASK", "ASYNC_COMPACTION_TASKS", "ASYNC_SCRUB_TASK", "ASYNC_MOVE_TASK", "ASYNC_GC_TASK", "RELOAD_INTERNODE_TRUSTSTORE", "ASYNC_FLUSH_TASK" ] + "enum" : [ "async_sstable_tasks", "full_query_logging", "rebuild", "async_upgrade_sstable_task", "async_compaction_task", "async_scrub_task", "async_move_task", "async_gc_task", "reload_internode_truststore", "async_flush_task" ] } }, "mgmt_version" : { diff --git a/management-api-server/pom.xml b/management-api-server/pom.xml index 57e7ba4a..b0c2616b 100644 --- a/management-api-server/pom.xml +++ b/management-api-server/pom.xml @@ -16,14 +16,14 @@ ${revision} datastax-mgmtapi-server - 2.1.1 30.1.1-jre 2.7.0 - 2.1.6 - 4.5.9.Final + 2.2.19 + 6.2.10.Final 4.0.3 3.17.2 - 3.1.0 + 6.1.0 + 2.17.0 @@ -47,9 +47,9 @@ ${logback.version} - javax.ws.rs - javax.ws.rs-api - ${rsapi.version} + commons-io + commons-io + ${commons.io.version} com.google.guava @@ -63,7 +63,7 @@ io.swagger.core.v3 - swagger-jaxrs2 + swagger-jaxrs2-jakarta ${jaxrs.version} @@ -87,8 +87,8 @@ ${driver.version} - javax.servlet - javax.servlet-api + jakarta.servlet + jakarta.servlet-api ${servelet.version} @@ -291,7 +291,7 @@ io.swagger.core.v3 - swagger-maven-plugin + swagger-maven-plugin-jakarta ${jaxrs.version} openapi diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/ManagementApplication.java b/management-api-server/src/main/java/com/datastax/mgmtapi/ManagementApplication.java index cf2d5634..2b8ac683 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/ManagementApplication.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/ManagementApplication.java @@ -17,13 +17,13 @@ import com.google.common.collect.ImmutableSet; import io.swagger.v3.jaxrs2.SwaggerSerializers; import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; +import jakarta.ws.rs.ApplicationPath; +import jakarta.ws.rs.core.Application; +import jakarta.ws.rs.core.Response; import java.io.File; import java.util.Collection; import java.util.Set; import java.util.concurrent.atomic.AtomicReference; -import javax.ws.rs.ApplicationPath; -import javax.ws.rs.core.Application; -import javax.ws.rs.core.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/AuthResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/AuthResources.java index ecf389c4..5281deae 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/AuthResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/AuthResources.java @@ -12,12 +12,12 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; @Path("/api/v0/ops/auth") diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/K8OperatorResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/K8OperatorResources.java index ec2dd1c9..c86986fe 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/K8OperatorResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/K8OperatorResources.java @@ -22,17 +22,17 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.IOException; import java.util.List; import java.util.Map; import java.util.Optional; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/KeyspaceOpsResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/KeyspaceOpsResources.java index 3e921020..72ebfe1c 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/KeyspaceOpsResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/KeyspaceOpsResources.java @@ -20,18 +20,18 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/LifecycleResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/LifecycleResources.java index 981c6bba..9b01a0cd 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/LifecycleResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/LifecycleResources.java @@ -28,6 +28,15 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.io.File; import java.io.IOException; import java.nio.file.Paths; @@ -38,15 +47,6 @@ import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/MetadataResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/MetadataResources.java index 784675f3..1ca039c6 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/MetadataResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/MetadataResources.java @@ -15,11 +15,11 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; @Path("/api/v0/metadata") public class MetadataResources extends BaseResources { diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/NodeOpsResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/NodeOpsResources.java index 31085430..3aa32fea 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/NodeOpsResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/NodeOpsResources.java @@ -23,18 +23,18 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.List; import java.util.Map; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; import org.slf4j.Logger; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/TableOpsResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/TableOpsResources.java index af9f554f..e87df695 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/TableOpsResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/TableOpsResources.java @@ -19,17 +19,17 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/common/BaseResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/common/BaseResources.java index 596fe407..bd5af575 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/common/BaseResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/common/BaseResources.java @@ -10,9 +10,9 @@ import com.datastax.oss.driver.api.core.NoNodeAvailableException; import com.datastax.oss.driver.api.core.cql.ResultSet; import com.datastax.oss.driver.api.core.cql.Row; +import jakarta.ws.rs.client.Entity; +import jakarta.ws.rs.core.Response; import java.util.concurrent.Callable; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.Response; import org.apache.http.ConnectionClosedException; import org.apache.http.HttpStatus; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/KeyspaceOpsResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/KeyspaceOpsResources.java index 9b68ca1f..ecaeaaaf 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/KeyspaceOpsResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/KeyspaceOpsResources.java @@ -14,14 +14,14 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/NodeOpsResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/NodeOpsResources.java index 0b1c70a8..dd65e255 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/NodeOpsResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/NodeOpsResources.java @@ -15,16 +15,16 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.Collections; import java.util.List; import java.util.Map; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; @Path("/api/v1/ops/node") public class NodeOpsResources extends BaseResources { diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/TableOpsResources.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/TableOpsResources.java index 54d34ca1..6e285d40 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/TableOpsResources.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v1/TableOpsResources.java @@ -24,18 +24,18 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import javax.ws.rs.Consumes; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpStatus; diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2.java index d260b9ba..c3a23117 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2.java @@ -19,15 +19,15 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.List; import java.util.stream.Collectors; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; @Path("/api/v2/repairs") public class RepairResourcesV2 extends BaseResources { diff --git a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/TokenResourcesV2.java b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/TokenResourcesV2.java index 8595ab25..cf0d3470 100644 --- a/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/TokenResourcesV2.java +++ b/management-api-server/src/main/java/com/datastax/mgmtapi/resources/v2/TokenResourcesV2.java @@ -15,16 +15,16 @@ import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; @Path("/api/v2/tokens") public class TokenResourcesV2 extends BaseResources { diff --git a/management-api-server/src/test/java/com/datastax/mgmtapi/DSESpecificIT.java b/management-api-server/src/test/java/com/datastax/mgmtapi/DSESpecificIT.java index 0aada519..09eb3263 100644 --- a/management-api-server/src/test/java/com/datastax/mgmtapi/DSESpecificIT.java +++ b/management-api-server/src/test/java/com/datastax/mgmtapi/DSESpecificIT.java @@ -32,6 +32,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.Uninterruptibles; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.InetSocketAddress; @@ -41,7 +42,6 @@ import java.util.Arrays; import java.util.List; import java.util.concurrent.TimeUnit; -import javax.ws.rs.core.MediaType; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpStatus; diff --git a/management-api-server/src/test/java/com/datastax/mgmtapi/K8OperatorResourcesTest.java b/management-api-server/src/test/java/com/datastax/mgmtapi/K8OperatorResourcesTest.java index 05ae3185..2a01bb7d 100644 --- a/management-api-server/src/test/java/com/datastax/mgmtapi/K8OperatorResourcesTest.java +++ b/management-api-server/src/test/java/com/datastax/mgmtapi/K8OperatorResourcesTest.java @@ -48,6 +48,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import jakarta.ws.rs.core.MediaType; import java.io.IOException; import java.net.URISyntaxException; import java.util.ArrayList; @@ -57,7 +58,6 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import javax.ws.rs.core.MediaType; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.HttpStatus; import org.jboss.resteasy.core.messagebody.WriterUtility; diff --git a/management-api-server/src/test/java/com/datastax/mgmtapi/NettyHttpOverIPCTest.java b/management-api-server/src/test/java/com/datastax/mgmtapi/NettyHttpOverIPCTest.java index aa97023c..19a6ba81 100644 --- a/management-api-server/src/test/java/com/datastax/mgmtapi/NettyHttpOverIPCTest.java +++ b/management-api-server/src/test/java/com/datastax/mgmtapi/NettyHttpOverIPCTest.java @@ -29,6 +29,10 @@ import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpVersion; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -37,10 +41,6 @@ import java.nio.file.Files; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; import org.jboss.resteasy.core.ResteasyDeploymentImpl; import org.jboss.resteasy.plugins.server.netty.NettyJaxrsServer; import org.jboss.resteasy.spi.ResteasyDeployment; diff --git a/management-api-server/src/test/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2Test.java b/management-api-server/src/test/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2Test.java index ec60601a..e4c8b38c 100644 --- a/management-api-server/src/test/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2Test.java +++ b/management-api-server/src/test/java/com/datastax/mgmtapi/resources/v2/RepairResourcesV2Test.java @@ -22,11 +22,11 @@ import com.datastax.mgmtapi.resources.v2.models.RingRange; import com.datastax.oss.driver.api.core.cql.ResultSet; import com.datastax.oss.driver.api.core.cql.Row; +import jakarta.ws.rs.core.Response; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import javax.ws.rs.core.Response; import org.junit.Test; public class RepairResourcesV2Test { diff --git a/pom.xml b/pom.xml index e613b8d4..a97f5ff0 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ build_version.sh 1.7.25 1.2.9 - 4.1.78.Final + 4.1.112.Final 3.5.13 0.16.0 From 5de20bc46b31b2b9a8cce60ccb9c65d6323cf5ab Mon Sep 17 00:00:00 2001 From: Erik Merkle Date: Thu, 24 Oct 2024 15:44:42 -0500 Subject: [PATCH 2/3] Update Docker imgaes to use JDK11 for Management API server process --- cassandra/Dockerfile-3.11 | 2 +- cassandra/Dockerfile-3.11.ubi8 | 2 +- cassandra/scripts/docker-entrypoint.sh | 20 ++++++++++++++++++-- dse/Dockerfile-dse6.8.jdk8 | 11 ++++++++++- dse/Dockerfile-dse6.8.ubi8 | 5 +++-- dse/files/entrypoint.sh | 19 +++++++++++++++++-- 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/cassandra/Dockerfile-3.11 b/cassandra/Dockerfile-3.11 index a65bfdbe..88907803 100644 --- a/cassandra/Dockerfile-3.11 +++ b/cassandra/Dockerfile-3.11 @@ -123,7 +123,7 @@ RUN set -eux; \ rm -fr /etc/apt/sources.list.d/*; \ rm -rf /var/lib/apt/lists/*; \ apt-get update; \ - apt-get install -y --no-install-recommends wget iproute2; \ + apt-get install -y --no-install-recommends openjdk-11-jdk wget iproute2; \ rm -rf /var/lib/apt/lists/* # backwards compat with upstream ENTRYPOINT diff --git a/cassandra/Dockerfile-3.11.ubi8 b/cassandra/Dockerfile-3.11.ubi8 index cd4d1358..663fdf77 100644 --- a/cassandra/Dockerfile-3.11.ubi8 +++ b/cassandra/Dockerfile-3.11.ubi8 @@ -181,7 +181,7 @@ RUN microdnf install --nodocs shadow-utils \ && useradd -m -d "$CASSANDRA_HOME" -r -g cassandra -G root --uid=999 cassandra \ && microdnf update && rm -rf /var/cache/yum \ # Install packages needed during install process - && microdnf install --nodocs java-1.8.0-openjdk-headless tzdata-java python2 python3 zlib findutils which hostname iproute procps util-linux glibc-langpack-en wget tar \ + && microdnf install --nodocs java-1.8.0-openjdk-headless java-11-openjdk-headless tzdata-java python2 python3 zlib findutils which hostname iproute procps util-linux glibc-langpack-en wget tar \ && microdnf clean all # Copy trimmed installation diff --git a/cassandra/scripts/docker-entrypoint.sh b/cassandra/scripts/docker-entrypoint.sh index 9957135d..8bb2b61f 100755 --- a/cassandra/scripts/docker-entrypoint.sh +++ b/cassandra/scripts/docker-entrypoint.sh @@ -195,8 +195,24 @@ if [ "$1" = 'mgmtapi' ]; then # use default of 128m heap if env variable not set : "${MGMT_API_HEAP_SIZE:=128m}" - echo "Running" java ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS - java ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS + + # locate Java 11 for running the server + if [ "$JAVA11_JAVA" = "" ]; then + # use default Java if it reports version 11 + DEFAULT_JAVA_VERSION=$(java -version 2>&1|awk -F '"' '/version/ {print $2}') + echo "Default Java version: ${DEFAULT_JAVA_VERSION}" + if [[ $DEFAULT_JAVA_VERSION == 11* ]]; then + # Java version seems to be 11 + JAVA11_JAVA=java + else + # find java 11 + JAVA11_HOME=$(find /usr/lib/jvm -type d -name "*java-11*") + echo "Found JAVA11 HOME: ${JAVA11_HOME}" + JAVA11_JAVA=${JAVA11_HOME}/bin/java + fi + fi + echo "Running" ${JAVA11_JAVA} ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS + ${JAVA11_JAVA} ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS fi exec "$@" diff --git a/dse/Dockerfile-dse6.8.jdk8 b/dse/Dockerfile-dse6.8.jdk8 index 45791f24..e5de5e64 100644 --- a/dse/Dockerfile-dse6.8.jdk8 +++ b/dse/Dockerfile-dse6.8.jdk8 @@ -138,6 +138,7 @@ RUN mkdir -m 775 ${CDC_AGENT_PATH} && \ chmod -R g+w ${CDC_AGENT_PATH} FROM datastax/${DS_BASE_DEBIAN}:${BASETAG} AS dse +ARG TARGETARCH ARG DSE_VERSION ENV DSE_VERSION=${DSE_VERSION} @@ -156,7 +157,15 @@ ENV MGMT_AGENT_JAR="${MAAC_PATH}/datastax-mgmtapi-agent.jar" RUN set -x \ # Add DSE user && groupadd -r dse --gid=999 \ - && useradd -m -d "$DSE_HOME" -r -g dse -G root --uid=999 dse + && useradd -m -d "$DSE_HOME" -r -g dse -G root --uid=999 dse \ +# Add JDK11 for Management API server + && rm -fr /etc/apt/sources.list.d/* \ + && rm -rf /var/lib/apt/lists/* \ + && apt-get update \ + && apt-get install -y --no-install-recommends openjdk-11-jdk \ + && rm -rf /var/lib/apt/lists/* \ +# JDK8 should be the default for DSE + && update-java-alternatives -s /usr/lib/jvm/java-1.8.0-openjdk-${TARGETARCH} COPY --chown=dse:root dse/files / diff --git a/dse/Dockerfile-dse6.8.ubi8 b/dse/Dockerfile-dse6.8.ubi8 index 05e03a0d..0f353413 100644 --- a/dse/Dockerfile-dse6.8.ubi8 +++ b/dse/Dockerfile-dse6.8.ubi8 @@ -58,6 +58,7 @@ RUN mkdir -m 775 $MAAC_PATH \ # Using UBI8 with Python 2 support, eventually we may switch to Python 3 FROM registry.access.redhat.com/ubi${UBI_MAJOR}/ubi-minimal:${UBI_BASETAG} AS dse +ARG TARGETARCH ARG DSE_VERSION ENV DSE_VERSION=${DSE_VERSION} @@ -75,8 +76,8 @@ ENV HOME=$DSE_HOME ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' # Install runtime dependencies and updates -RUN microdnf update && rm -rf /var/cache/yum && \ - microdnf install --nodocs -y java-1.8.0-openjdk-headless java-1.8.0-openjdk-devel python2 zlib libaio which findutils hostname iproute shadow-utils procps util-linux glibc-langpack-en wget tar && microdnf clean all +RUN microdnf update && rm -rf /var/cache/yum \ + && microdnf install --nodocs -y java-1.8.0-openjdk-headless java-1.8.0-openjdk-devel java-11-openjdk-headless python2 zlib libaio which findutils hostname iproute shadow-utils procps util-linux glibc-langpack-en wget tar && microdnf clean all WORKDIR $HOME diff --git a/dse/files/entrypoint.sh b/dse/files/entrypoint.sh index 346e22f5..9d8dc00e 100755 --- a/dse/files/entrypoint.sh +++ b/dse/files/entrypoint.sh @@ -182,8 +182,23 @@ if [ "$USE_MGMT_API" = "true" ] && [ -d "$MAAC_PATH" ] ; then # use default of 128m heap if env variable not set : "${MGMT_API_HEAP_SIZE:=128m}" - echo "Running" java ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS - java ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS + # locate Java 11 for running the server + if [ "$JAVA11_JAVA" = "" ]; then + # use default Java if it reports version 11 + DEFAULT_JAVA_VERSION=$(java -version 2>&1|awk -F '"' '/version/ {print $2}') + echo "Default Java version: ${DEFAULT_JAVA_VERSION}" + if [[ $DEFAULT_JAVA_VERSION == 11* ]]; then + # Java version seems to be 11 + JAVA11_JAVA=java + else + # find java 11 + JAVA11_HOME=$(find /usr/lib/jvm -type d -name "*java-11*") + echo "Found JAVA11 HOME: ${JAVA11_HOME}" + JAVA11_JAVA=${JAVA11_HOME}/bin/java + fi + fi + echo "Running" ${JAVA11_JAVA} ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS + ${JAVA11_JAVA} ${MGMT_API_JAVA_OPTS} -Xms${MGMT_API_HEAP_SIZE} -Xmx${MGMT_API_HEAP_SIZE} -jar "$MGMT_API_JAR" $MGMT_API_ARGS else echo "Running $@" exec "$@" From 199dde2b9a22e3fe3a2fe72a321e9e263fcced34 Mon Sep 17 00:00:00 2001 From: Erik Merkle Date: Thu, 24 Oct 2024 16:10:17 -0500 Subject: [PATCH 3/3] Update CHANGELOG and add JDK11 note to README --- CHANGELOG.md | 1 + README.md | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76e60e1a..bf7a2422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Changelog for Management API, new PRs should update the `main / unreleased` sect ``` ## unreleased +* [CHANGE] [#556](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/556) Update Management API dependencies to address CVEs * [FEATURE] [#551](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/551) Add Cassandra 5.0.2 to the build matrix * [ENHANCEMENT] [#552](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/552) Improve "liveness" probe implementation * [BUGFIX] [#553](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/553) Fix CassandraTaskExports metric filtering to make it work with 5.0.x Major compactions diff --git a/README.md b/README.md index 31946f4c..fd163b99 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,13 @@ Cassandra 5.0 images are only RedHat UBI8 based. - All DSE 6.9.x RedHat UBI 8 based images come with only JDK 11 - HCD images are not built within this repo. Only the Agent for HCD ois maintained within this repo +### Java versions in DOcker images + +As of v0.1.88, all images produced from this repo will have Java 11 installed as the +Management API server code must now run with Java 11. For images where the Cassandra/DSE +version runs with Java 8 (see above), Both Java 8 and Java 11 will be available, with +Java 8 being the default and Java 8 used to run the Cassandra/DSE process. + ### Docker coordinates for Cassandra OSS images #### Ubuntu based images (OSS)