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

Add MAS env properties for annotation #30

Merged
merged 2 commits into from
Nov 15, 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
8 changes: 4 additions & 4 deletions .github/workflows/.trivyignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Date: June 16, 2023
# Issue: snappy-java high issue, https://www.cvedetails.com/cve/CVE-2023-34453/
# Solution: Spring needs to update its version
CVE-2023-34455
# Date: November 14, 2023
# Issue: openssl: Incorrect cipher key and IV length processing https://avd.aquasec.com/nvd/cve-2023-5363
# Solution: Docker image needs an update
CVE-2023-5363
8 changes: 5 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.0</version>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>eu.dissco.core</groupId>
Expand All @@ -19,6 +19,7 @@
<apachecommons.version>4.3</apachecommons.version>
<k8s-client-java.version>18.0.0</k8s-client-java.version>
<mockito-inline.version>5.2.0</mockito-inline.version>
<snappy-java.version>1.1.10.5</snappy-java.version>
<snakeyaml.version>2.0</snakeyaml.version>
<json-patch.version>1.13</json-patch.version>
<sonar.organization>dissco</sonar.organization>
Expand Down Expand Up @@ -116,8 +117,9 @@
<version>${json-patch.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>${snappy-java.version}</version>
</dependency>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ private Map<String, Object> getDeploymentTemplateProperties(
map.put("image", masRecord.mas().getContainerImage());
map.put("imageTag", masRecord.mas().getContainerTag());
map.put("name", name);
map.put("id", masRecord.id());
map.put("kafkaHost", properties.getKafkaHost());
map.put("topicName", masRecord.mas().getTopicName());
return map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ public class HandleComponent {
public String postHandle(JsonNode request)
throws PidAuthenticationException, PidCreationException {
var requestBody = BodyInserters.fromValue(List.of(request));
log.debug("Sending call to Handle API: {}", request.toPrettyString());
var response = sendRequest(HttpMethod.POST, requestBody, "batch");
var responseJson = validateResponse(response);
log.debug("Received response from Handle API: {}", responseJson.toPrettyString());
return parseResponse(responseJson);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private String getToken(JsonNode tokenNode) throws PidAuthenticationException {
if (tokenNode != null && tokenNode.get("access_token") != null) {
return tokenNode.get("access_token").asText();
}
log.debug("Unexpected response from keycloak server. Unable to parse access_token");
log.warn("Unexpected response from keycloak server. Unable to parse access_token: {}", tokenNode);
throw new PidAuthenticationException(
"Unable to authenticate processing service with Keycloak. An error has occurred parsing keycloak response");
}
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/templates/mas-template.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
"image": "${image}:${imageTag}",
"imagePullPolicy": "Always",
"env": [
{
"name": "MAS_NAME",
"value": "${name}"
},
{
"name": "MAS_ID",
"value": "${id}"
},
{
"name": "KAFKA_CONSUMER_HOST",
"value": "${kafkaHost}"
Expand Down
Loading