Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration branch: OpenAPI Client generation #353

Merged
merged 16 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
cassandra-version: ['3.11', '4.0', '4.1', '3.11_ubi', '4.0_ubi', '4.1_ubi']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'NonDestructiveOpsResourcesV2IT']
include:
- cassandra-version: '3.11'
run311tests: true
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
fail-fast: false
matrix:
platform-version: ['jdk8', 'ubi']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'DSESpecificIT']
itTest : ['LifecycleIT', 'KeepAliveIT', 'NonDestructiveOpsIT', 'DestructiveOpsIT', 'DSESpecificIT', 'NonDestructiveOpsResourcesV2IT']
include:
- platform-version: 'jdk8'
runDSEtests: true
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Changelog for Management API, new PRs should update the `main / unreleased` sect
* [FEATURE] [#349](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/349) Metrics endpoint should allow querying a subset
* [FEATURE] [#395](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/395) Add Cassandra version 3.11.16
* [FEATURE] [#380](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/380) Add DSE 6.8.38
* [FEATURE] [#326](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/326) Provide topology endpoints in OpenAPI client
* [FEATURE] [#345](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/345) Implement host related methods
* [FEATURE] [#361](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/361) Add new listTables operation with more detailed response
* [FEATURE] [#342](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/342) New mechanism to allow status tracking of repairs via repair ID. Both v1 and v2 endpoints now return a repair ID for this purpose.
* [FEATURE] [#405](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/405) New v2 Repairs endpoint which takes more parameters, new endpoint to force terminate all repairs.
* [FEATURE] [#374](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/374) New endpoint to provide a token range to endpoint mapping.
* [FEATURE] [#372](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/372) Add IS_LOCAL field to /metadata/endpoints response.
* [BUGFIX] [#339](https://github.com/k8ssandra/management-api-for-apache-cassandra/issues/339) OpenAPI client publish does not also publish other artifacts


Expand Down
42 changes: 41 additions & 1 deletion dse-68/Dockerfile.ubi8
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,46 @@ ARG UBI_BASETAG=latest

FROM datastax/dse-mgmtapi-6_8:${DSE_VERSION} AS dse-server-base

FROM --platform=$BUILDPLATFORM maven:3.8.7-eclipse-temurin-11 as mgmtapi-setup

WORKDIR /

ENV MAAC_PATH /opt/management-api
ENV DSE_HOME /opt/dse

COPY pom.xml /tmp/pom.xml
COPY management-api-agent-common/pom.xml /tmp/management-api-agent-common/pom.xml
COPY management-api-agent-3.x/pom.xml /tmp/management-api-agent-3.x/pom.xml
COPY management-api-agent-4.x/pom.xml /tmp/management-api-agent-4.x/pom.xml
COPY management-api-agent-4.1.x/pom.xml /tmp/management-api-agent-4.1.x/pom.xml
COPY management-api-agent-dse-6.8/pom.xml tmp/management-api-agent-dse-6.8/pom.xml
COPY management-api-common/pom.xml /tmp/management-api-common/pom.xml
COPY management-api-server/pom.xml /tmp/management-api-server/pom.xml
COPY settings.xml settings.xml /root/.m2/
# this duplicates work done in the next steps, but this should provide
# a solid cache layer that only gets reset on pom.xml changes
RUN cd /tmp && mvn -q -ff -T 1C install -DskipOpenApi -P dse && rm -rf target

COPY management-api-agent-common /tmp/management-api-agent-common
COPY management-api-agent-3.x /tmp/management-api-agent-3.x
COPY management-api-agent-4.x /tmp/management-api-agent-4.x
COPY management-api-agent-4.1.x /tmp/management-api-agent-4.1.x
COPY management-api-agent-dse-6.8 /tmp/management-api-agent-dse-6.8
COPY management-api-common /tmp/management-api-common
COPY management-api-server /tmp/management-api-server
RUN mkdir -m 775 $MAAC_PATH \
&& cd /tmp \
&& mvn -q -ff package -DskipTests -DskipOpenApi -P dse \
&& find /tmp -type f -name "datastax-*.jar" -exec mv -t $MAAC_PATH -i '{}' + \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-3* \
&& rm $MAAC_PATH/datastax-mgmtapi-agent-4* \
&& rm $MAAC_PATH/datastax-mgmtapi-*common* \
&& cd ${MAAC_PATH} \
&& ln -s datastax-mgmtapi-agent-dse-6.8-0.1.0-SNAPSHOT.jar datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar \
&& ln -s datastax-mgmtapi-agent-0.1.0-SNAPSHOT.jar datastax-mgmtapi-agent.jar \
&& ln -s datastax-mgmtapi-server-0.1.0-SNAPSHOT.jar datastax-mgmtapi-server.jar && \
chmod -R g+w ${MAAC_PATH}

#############################################################

# Using UBI8 with Python 2 support, eventually we may switch to Python 3
Expand Down Expand Up @@ -64,7 +104,7 @@ RUN chmod 0555 /entrypoint.sh /overwritable-conf-files /licenses /base-checks.sh
# Use OSS Management API
ENV CASSANDRA_CONF ${DSE_HOME}/resources/cassandra/conf
ENV MAAC_PATH /opt/management-api
COPY --chown=dse:root --from=dse-server-base $MAAC_PATH $MAAC_PATH
COPY --chown=dse:root --from=mgmtapi-setup $MAAC_PATH $MAAC_PATH
# Add CDC Agent
ENV CDC_AGENT_PATH=/opt/cdc_agent
COPY --chown=dse:root --from=dse-server-base $CDC_AGENT_PATH $CDC_AGENT_PATH
Expand Down
13 changes: 13 additions & 0 deletions management-api-agent-3.x/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,19 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.k8ssandra</groupId>
<artifactId>datastax-mgmtapi-agent-common</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ObjectSerializer3x(Class<T> clazz, Type genericType) {
field -> field.getName(),
field ->
new FieldSerializer(
GenericSerializer3x.getType(field.getType()), field))));
GenericSerializer3x.getType(field.getGenericType()), field))));
// currently not recursive; multiple ways to do it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,12 @@ public List<Map<String, String>> getEndpointStates() {
states.put(s.getKey().name(), value);
}

states.put("ENDPOINT_IP", entry.getKey().getHostAddress());
InetAddress endpoint = entry.getKey();
states.put("ENDPOINT_IP", endpoint.getHostAddress());
states.put("IS_ALIVE", Boolean.toString(entry.getValue().isAlive()));
states.put("PARTITIONER", partitioner.getClass().getName());
states.put("CLUSTER_NAME", getStorageService().getClusterName());
states.put("IS_LOCAL", Boolean.toString(endpoint.equals(FBUtilities.getBroadcastAddress())));

result.add(states);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright DataStax, Inc.
*
* Please see the included license file for details.
*/
package com.datastax.mgmtapi.rpc;

import static org.assertj.core.api.Assertions.assertThat;

public class ObjectSerializer3xTest extends ObjectSerializerTestBase<ObjectSerializer3x<Example>> {

@Override
protected ObjectSerializer3x<Example> createExampleSerializer() {
return new ObjectSerializer3x<>(Example.class);
}

@Override
protected String getCqlType(ObjectSerializer3x<Example> serializer, String fieldName) {
assertThat(serializer.serializers).containsKey(fieldName);
return serializer.serializers.get(fieldName).type.toString();
}
}
13 changes: 13 additions & 0 deletions management-api-agent-4.1.x/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.k8ssandra</groupId>
<artifactId>datastax-mgmtapi-agent-common</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ObjectSerializer41x(Class<T> clazz, Type genericType) {
field -> field.getName(),
field ->
new FieldSerializer(
GenericSerializer41x.getType(field.getType()), field))));
GenericSerializer41x.getType(field.getGenericType()), field))));
// currently not recursive; multiple ways to do it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public List<Map<String, String>> getEndpointStates() {
states.put("ENDPOINT_IP", endpoint.getHostAddress(false));
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
states.put("PARTITIONER", partitioner.getClass().getName());
states.put("CLUSTER_NAME", getStorageService().getClusterName());
states.put(
"IS_LOCAL", Boolean.toString(endpoint.equals(FBUtilities.getBroadcastAddressAndPort())));
result.add(states);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright DataStax, Inc.
*
* Please see the included license file for details.
*/
package com.datastax.mgmtapi.rpc;

import static org.assertj.core.api.Assertions.assertThat;

public class ObjectSerializer41xTest
extends ObjectSerializerTestBase<ObjectSerializer41x<Example>> {

@Override
protected ObjectSerializer41x<Example> createExampleSerializer() {
return new ObjectSerializer41x<>(Example.class);
}

@Override
protected String getCqlType(ObjectSerializer41x<Example> serializer, String fieldName) {
assertThat(serializer.serializers).containsKey(fieldName);
return serializer.serializers.get(fieldName).type.toString();
}
}
13 changes: 13 additions & 0 deletions management-api-agent-4.x/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.k8ssandra</groupId>
<artifactId>datastax-mgmtapi-agent-common</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ObjectSerializer4x(Class<T> clazz, Type genericType) {
field -> field.getName(),
field ->
new FieldSerializer(
GenericSerializer4x.getType(field.getType()), field))));
GenericSerializer4x.getType(field.getGenericType()), field))));
// currently not recursive; multiple ways to do it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public List<Map<String, String>> getEndpointStates() {
states.put("ENDPOINT_IP", endpoint.address.getHostAddress());
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
states.put("PARTITIONER", partitioner.getClass().getName());
states.put("CLUSTER_NAME", getStorageService().getClusterName());
states.put(
"IS_LOCAL", Boolean.toString(endpoint.equals(FBUtilities.getBroadcastAddressAndPort())));
result.add(states);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright DataStax, Inc.
*
* Please see the included license file for details.
*/
package com.datastax.mgmtapi.rpc;

import static org.assertj.core.api.Assertions.assertThat;

public class ObjectSerializer4xTest extends ObjectSerializerTestBase<ObjectSerializer4x<Example>> {

@Override
protected ObjectSerializer4x<Example> createExampleSerializer() {
return new ObjectSerializer4x<>(Example.class);
}

@Override
protected String getCqlType(ObjectSerializer4x<Example> serializer, String fieldName) {
assertThat(serializer.serializers).containsKey(fieldName);
return serializer.serializers.get(fieldName).type.toString();
}
}
13 changes: 13 additions & 0 deletions management-api-agent-5.0.x/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.k8ssandra</groupId>
<artifactId>datastax-mgmtapi-agent-common</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public ObjectSerializer50x(Class<T> clazz, Type genericType) {
field -> field.getName(),
field ->
new FieldSerializer(
GenericSerializer50x.getType(field.getType()), field))));
GenericSerializer50x.getType(field.getGenericType()), field))));
// currently not recursive; multiple ways to do it
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ public List<Map<String, String>> getEndpointStates() {
states.put("ENDPOINT_IP", endpoint.getHostAddress(false));
states.put("IS_ALIVE", Boolean.toString(state.isAlive()));
states.put("PARTITIONER", partitioner.getClass().getName());
states.put("CLUSTER_NAME", getStorageService().getClusterName());
states.put(
"IS_LOCAL", Boolean.toString(endpoint.equals(FBUtilities.getBroadcastAddressAndPort())));
result.add(states);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright DataStax, Inc.
*
* Please see the included license file for details.
*/
package com.datastax.mgmtapi.rpc;

import static org.assertj.core.api.Assertions.assertThat;

public class ObjectSerializer50xTest
extends ObjectSerializerTestBase<ObjectSerializer50x<Example>> {

@Override
protected ObjectSerializer50x<Example> createExampleSerializer() {
return new ObjectSerializer50x<>(Example.class);
}

@Override
protected String getCqlType(ObjectSerializer50x<Example> serializer, String fieldName) {
assertThat(serializer.serializers).containsKey(fieldName);
return serializer.serializers.get(fieldName).type.toString();
}
}
17 changes: 17 additions & 0 deletions management-api-agent-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down Expand Up @@ -183,6 +188,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Loading
Loading