Commit 92965cde authored by Stephen Nimmo's avatar Stephen Nimmo
Browse files

updated documentation and parser-worker-template.yaml

parent 86e072bc
Pipeline #74156 passed with stage
in 1 minute and 17 seconds
......@@ -109,8 +109,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>9</source>
<target>9</target>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
......
package org.opengroup.osdu.streaming.service;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.apis.AppsV1Api;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.V1Container;
import io.kubernetes.client.openapi.models.V1ContainerBuilder;
import io.kubernetes.client.openapi.models.V1Deployment;
import io.kubernetes.client.openapi.models.V1DeploymentBuilder;
import io.kubernetes.client.util.Config;
import io.kubernetes.client.openapi.models.*;
import org.opengroup.osdu.streaming.exception.StreamAdminException;
import org.opengroup.osdu.streaming.model.StreamRecord;
import org.springframework.beans.factory.annotation.Value;
......@@ -17,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.web.context.annotation.RequestScope;
import java.util.Map;
import java.util.Optional;
@Service
@RequestScope
......@@ -37,6 +32,9 @@ public class DeploymentAdminServiceImpl implements DeploymentAdminService {
@Override
public StreamRecord createStream(StreamRecord streamRecord) {
String deploymentName = this.getDeploymentName(streamRecord);
if (this.findExistingDeployment(namespace, deploymentName).isPresent()){
throw new StreamAdminException("Unable to create ");
}
V1Deployment deployment = new V1DeploymentBuilder()
.withNewMetadata()
.withName(String.format("%s-%s", deploymentName, this.deploymentSuffix))
......@@ -92,4 +90,13 @@ public class DeploymentAdminServiceImpl implements DeploymentAdminService {
}
private Optional<V1Deployment> findExistingDeployment(String namespace, String name) {
try {
V1DeploymentList v1DeploymentList = appsV1Api.listNamespacedDeployment(namespace, null, null, null, null, null, null, null, null, null);
return v1DeploymentList.getItems().stream().filter(v1Deployment -> v1Deployment.getMetadata().getName().equals(name)).findFirst();
} catch (ApiException e) {
throw new StreamAdminException(e);
}
}
}
package org.opengroup.osdu.streaming.service;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.Configuration;
import io.kubernetes.client.openapi.apis.AppsV1Api;
import io.kubernetes.client.openapi.models.V1ContainerBuilder;
import io.kubernetes.client.openapi.models.V1Deployment;
import io.kubernetes.client.openapi.models.V1DeploymentBuilder;
import io.kubernetes.client.util.Config;
import org.opengroup.osdu.streaming.exception.StreamAdminException;
import java.io.IOException;
import java.util.Map;
public class KubeApiTest {
public static void main(String[] args) throws IOException, ApiException {
ApiClient apiClient = Config.defaultClient();
apiClient.setDebugging(true);
Configuration.setDefaultApiClient(apiClient);
AppsV1Api appsV1Api = new AppsV1Api();
String namespace = "default";
String deploymentName = "test";
V1Deployment deployment = new V1DeploymentBuilder()
.withNewMetadata()
.withName(deploymentName)
.withNamespace(namespace)
.endMetadata()
.withNewSpec()
.withReplicas(0)
.withNewSelector()
.withMatchLabels(Map.of("run", deploymentName))
.endSelector()
.withNewTemplate()
.withNewMetadata()
.withLabels(Map.of("run", deploymentName))
.endMetadata()
.withNewSpec()
.withContainers(new V1ContainerBuilder()
.withName("busybox")
.withImage("busybox")
.build())
.endSpec()
.endTemplate()
.endSpec()
.build();
V1Deployment namespacedDeployment = appsV1Api.createNamespacedDeployment(namespace, deployment, null, null, null);
//namespacedDeployment.getMetadata().setName("test2");
System.out.println(namespacedDeployment.getKind());
}
}
<mxfile host="Electron" modified="2021-10-26T16:00:30.581Z" agent="5.0 (Macintosh; Intel Mac OS X 11_6_0) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.9.6 Chrome/89.0.4389.128 Electron/12.0.16 Safari/537.36" etag="dUcy4P2hAROj8zG6LcfW" version="14.9.6" type="device" pages="2"><diagram id="oPQlikl0BSEGqThpAdY3" name="Page-1">7Vvfc9o4EP5reEz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zN/7O5wtxvFmcf1Ykib4BZcJx+zR3vLnjugN34uPDWLY7y2Q42hlCxakNqg0X/JZZY99aM05Z2gjUAELzpGkMQEoW6IaNKAWbZtgaRHPUhISsZbgIiGhbf3GqI2sd9Pu144zxMLJD+yPriEkZbA1pRChs9kzewvFmCkDvpDifMWHAK3E583gvPBOrEf/pX2bnfji9Er1dseVjUqopKCb1aUvbXt4QkVm8IKWZna/eliAqyCRlplDf8aabiGt2kZDAeDdIG7RFOhaoDVBccyFmIEChLkFi0JSSNCrSjZ8IHkqUBVvjbKY3TGmO/fpkzRpMvRTLcxmeFzHzMVrsm2I0y++09gFcBlWzkOUMYqbVFvNsFbdkgiW4b9VNzRZ/aG3RHlGqQGIZGlal6y6gYBvxiKa4raYscs2UJCZz8eO7+S9pAhxn/axOdQXpsInowG1DWtn2IR12heiwhROjuEtYFZSOIATEd1Fbp00k65hzMAQt8PvDtN7aLY9kGprospzrlU038m8jfxhZbZ7vuebbUpE43VVZwCh7WUat0wqtzNvNz0zqCX1EYCBTAbsnzrM7N1Ehu6+ee5gXigmi+U3z5U7eZa+1bphOeohBytTrXCivb6WMWxg67liYffoKhdAIM5BrHmYKOwqy9OJgVUCVoUpLzwwbm5P6oCsQHFG85Mm97gTX4OEAXHvRLT7fBdghx1uiiGfYEpu4fH8445qsrwk+jXwFkGps+Re8kTwYjKcTDx4Ou2bbQLEdQuZ9nkO+o87LF2Po+EiGVoEnp+jHzijK8gRSRv9JxNJ/SiZyGUCMNx0c9FIRaTbwt8yXp9Kls8uU32LLV7tOZyJL9XNPhhLsAEHDWi8Ot3/EATI+gHdnq3PSwttumaf6pHBcb138HYN+zCktbnNdNWB05+thMDqS8G5XDSg/vP/PZbeUH3XZrZS3ddmddHPZRbX+UaHw7f004y3+Ag==</diagram></mxfile>
\ No newline at end of file
<mxfile host="Electron" modified="2021-10-26T19:13:48.005Z" agent="5.0 (Macintosh; Intel Mac OS X 11_6_0) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/14.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ipm95RJduYteDHaTrt6goWICsUqboZ/AhhBd4Ydh0zixnB0JBLz7aPTyn5NoemORHbLOFf0LNRrmlG73WtU5OaF9GXGzISX4WNXLE16OJojakoALLulq4jcR/ZQGVcd9a3u7FD3oNAnM09O61A6vyptLryXzDTeDpIdd6Wa8Utp1nPfPf3S7C/NNpo9CfaoWTptvrqWYw++XfvTfwE=</diagram></mxfile>
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment