Skip to content
Snippets Groups Projects
Commit 7cdeb94c authored by Spencer Sutton's avatar Spencer Sutton
Browse files

Merge

parents 76f4e283 86f8e557
No related branches found
No related tags found
1 merge request!163Fixing bug with Legal Job Run Process, some AWS Updates
Pipeline #72358 failed
Showing
with 253 additions and 83 deletions
...@@ -15,7 +15,7 @@ variables: ...@@ -15,7 +15,7 @@ variables:
OSDU_GCP_SERVICE: legal OSDU_GCP_SERVICE: legal
OSDU_GCP_VENDOR: gcp OSDU_GCP_VENDOR: gcp
OSDU_GCP_HELM_CONFIG_SERVICE_VARS: "--set data.project_id=$OSDU_GCP_PROJECT --set data.authorize_api=$OSDU_GCP_AUTHORIZE_API --set data.google_audiences=$GOOGLE_AUDIENCE --set data.redis_group_host=$REDIS_GROUP_HOST --set data.redis_storage_host=$REDIS_STORAGE_HOST --set data.partition_api=$OSDU_GCP_PARTITION_API --set data.log_level=INFO --set enable_full_bucket_name=$ENABLE_FULL_BUCKET_NAME" OSDU_GCP_HELM_CONFIG_SERVICE_VARS: "--set data.project_id=$OSDU_GCP_PROJECT --set data.authorize_api=$OSDU_GCP_AUTHORIZE_API --set data.google_audiences=$GOOGLE_AUDIENCE --set data.partition_api=$OSDU_GCP_PARTITION_API --set data.log_level=INFO --set enable_full_bucket_name=$ENABLE_FULL_BUCKET_NAME"
OSDU_GCP_HELM_DEPLOYMENT_SERVICE_VARS: "--set data.image=$CI_REGISTRY_IMAGE/osdu-gcp:$CI_COMMIT_SHORT_SHA --set data.serviceAccountName=workload-identity-legal --set data.limits_cpu=1.5 --set data.limits_memory=512M" OSDU_GCP_HELM_DEPLOYMENT_SERVICE_VARS: "--set data.image=$CI_REGISTRY_IMAGE/osdu-gcp:$CI_COMMIT_SHORT_SHA --set data.serviceAccountName=workload-identity-legal --set data.limits_cpu=1.5 --set data.limits_memory=512M"
OSDU_GCP_HELM_CONFIG_SERVICE: legal-config OSDU_GCP_HELM_CONFIG_SERVICE: legal-config
OSDU_GCP_HELM_DEPLOYMENT_SERVICE: legal-deploy OSDU_GCP_HELM_DEPLOYMENT_SERVICE: legal-deploy
......
This diff is collapsed.
...@@ -3,6 +3,8 @@ global: ...@@ -3,6 +3,8 @@ global:
# Service(s) Replica Count # Service(s) Replica Count
replicaCount: 2 replicaCount: 2
maxReplicaCount: 20
minReplicaCount: 4
nodepool: services nodepool: services
isAutoscalingEnabled: false isAutoscalingEnabled: false
...@@ -14,3 +16,14 @@ image: ...@@ -14,3 +16,14 @@ image:
repository: #{container-registry}#.azurecr.io repository: #{container-registry}#.azurecr.io
branch: #{ENVIRONMENT_NAME}# branch: #{ENVIRONMENT_NAME}#
tag: #{Build.SourceVersion}# tag: #{Build.SourceVersion}#
istioDnsHost: #{ISTIO_DNS_HOST}#
env: #{ENVIRONMENT_NAME}#
featureFlag:
resourceLimits:
enabledEnvs:
- demo
hpa:
enabledEnvs: []
...@@ -18,7 +18,10 @@ metadata: ...@@ -18,7 +18,10 @@ metadata:
name: {{ .Release.Name }} name: {{ .Release.Name }}
namespace: osdu namespace: osdu
spec: spec:
{{- if has .Values.env .Values.featureFlag.hpa.enabledEnvs }}
{{- else }}
replicas: {{ .Values.global.replicaCount }} replicas: {{ .Values.global.replicaCount }}
{{- end }}
selector: selector:
matchLabels: matchLabels:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
...@@ -48,8 +51,14 @@ spec: ...@@ -48,8 +51,14 @@ spec:
resources: resources:
requests: requests:
cpu: "100m" cpu: "100m"
{{- if has .Values.env .Values.featureFlag.resourceLimits.enabledEnvs }}
memory: "1500Mi"
{{- end }}
limits: limits:
cpu: "300m" cpu: "500m"
{{- if has .Values.env .Values.featureFlag.resourceLimits.enabledEnvs }}
memory: "3000Mi"
{{- end }}
readinessProbe: readinessProbe:
httpGet: httpGet:
path: /actuator/health path: /actuator/health
......
# Copyright © Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- if has .Values.env .Values.featureFlag.hpa.enabledEnvs }}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Chart.Name }}
namespace: osdu
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Chart.Name }}
minReplicas: {{ .Values.global.minReplicaCount }}
maxReplicas: {{ .Values.global.maxReplicaCount }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
behavior:
scaleDown:
stabilizationWindowSeconds: 150
policies:
- type: Pods
value: 2
periodSeconds: 30
scaleUp:
stabilizationWindowSeconds: 10
selectPolicy: Max
policies:
- type: Pods
value: 6
periodSeconds: 10
- type: Percent
value: 50
periodSeconds: 10
{{- end }}
\ No newline at end of file
...@@ -23,5 +23,6 @@ spec: ...@@ -23,5 +23,6 @@ spec:
- protocol: TCP - protocol: TCP
port: 80 port: 80
targetPort: 80 targetPort: 80
name: http
selector: selector:
app: {{ .Chart.Name }} app: {{ .Chart.Name }}
---
# Source: /devops/azure/chart/templates/virtual-service.yaml
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{ .Chart.Name }}
namespace: osdu
spec:
hosts:
- "{{ .Values.istioDnsHost }}"
gateways:
- istio-gateway
http:
- match:
- uri:
prefix: "/api/{{ .Chart.Name }}/v1"
route:
- destination:
host: {{ .Chart.Name }}
port:
number: 80
corsPolicy:
maxAge: "60m"
allowCredentials: true
allowHeaders:
- Authorization
- Data-Partition-Id
- Correlation-Id
- Content-Type
allowMethods:
- POST
- GET
- PUT
- DELETE
allowOrigins:
- prefix: "*"
\ No newline at end of file
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
global: global:
replicaCount: 1 replicaCount: 1
maxReplicaCount: 1
minReplicaCount: 1
nodepool: services nodepool: services
isAutoscalingEnabled: false isAutoscalingEnabled: false
...@@ -21,3 +23,14 @@ image: ...@@ -21,3 +23,14 @@ image:
repository: community.opengroup.org:5555/osdu/platform/security-and-compliance/legal repository: community.opengroup.org:5555/osdu/platform/security-and-compliance/legal
branch: master branch: master
tag: latest tag: latest
istioDnsHost: ""
env: demo
featureFlag:
resourceLimits:
enabledEnvs:
- demo
hpa:
enabledEnvs: []
...@@ -12,6 +12,4 @@ data: ...@@ -12,6 +12,4 @@ data:
ENABLE_FULL_BUCKET_NAME: "{{ .Values.data.enable_full_bucket_name }}" ENABLE_FULL_BUCKET_NAME: "{{ .Values.data.enable_full_bucket_name }}"
PROJECT_ID: "{{ .Values.data.project_id }}" PROJECT_ID: "{{ .Values.data.project_id }}"
GOOGLE_AUDIENCES: "{{ .Values.data.google_audiences }}" GOOGLE_AUDIENCES: "{{ .Values.data.google_audiences }}"
REDIS_GROUP_HOST: "{{ .Values.data.redis_group_host }}"
REDIS_STORAGE_HOST: "{{ .Values.data.redis_storage_host }}"
ACCEPT_HTTP: "{{ .Values.data.accept_http }}" ACCEPT_HTTP: "{{ .Values.data.accept_http }}"
...@@ -9,8 +9,6 @@ data: ...@@ -9,8 +9,6 @@ data:
enable_full_bucket_name: "true" enable_full_bucket_name: "true"
project_id: "" project_id: ""
google_audiences: "" google_audiences: ""
redis_group_host: ""
redis_storage_host: ""
accept_http: "true" accept_http: "true"
conf: conf:
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
<parent> <parent>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<artifactId>legal-service</artifactId> <artifactId>legal-service</artifactId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
</parent> </parent>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<artifactId>legal-core</artifactId> <artifactId>legal-core</artifactId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>legal-core</name> <name>legal-core</name>
<description>Legal service core</description> <description>Legal service core</description>
......
...@@ -20,6 +20,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -20,6 +20,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException;
import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ArrayNode;
import com.google.gson.Gson; import com.google.gson.Gson;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javassist.NotFoundException; import javassist.NotFoundException;
...@@ -27,6 +29,9 @@ import javax.inject.Inject; ...@@ -27,6 +29,9 @@ import javax.inject.Inject;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import javax.validation.ValidationException; import javax.validation.ValidationException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.model.http.AppException;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
...@@ -106,6 +111,17 @@ public class GlobalExceptionMapper extends ResponseEntityExceptionHandler { ...@@ -106,6 +111,17 @@ public class GlobalExceptionMapper extends ResponseEntityExceptionHandler {
return this.getErrorResponse(new AppException(HttpStatus.BAD_REQUEST.value(), "Validation error.", result.toString())); return this.getErrorResponse(new AppException(HttpStatus.BAD_REQUEST.value(), "Validation error.", result.toString()));
} }
@ExceptionHandler(IOException.class)
public ResponseEntity<Object> handleIOException(IOException e) {
if (StringUtils.containsIgnoreCase(ExceptionUtils.getRootCauseMessage(e), "Broken pipe")) {
this.logger.warning("Client closed the connection while request still being processed");
return null;
} else {
return this.getErrorResponse(
new AppException(HttpStatus.SERVICE_UNAVAILABLE.value(), "Unknown error", e.getMessage(), e));
}
}
@ExceptionHandler(Exception.class) @ExceptionHandler(Exception.class)
protected ResponseEntity<Object> handleGeneralException(Exception e) { protected ResponseEntity<Object> handleGeneralException(Exception e) {
return this.getErrorResponse( return this.getErrorResponse(
......
package org.opengroup.osdu.legal.middleware; package org.opengroup.osdu.legal.middleware;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.powermock.api.mockito.PowerMockito.mock; import static org.powermock.api.mockito.PowerMockito.mock;
import javassist.NotFoundException; import javassist.NotFoundException;
...@@ -19,6 +20,8 @@ import org.mockito.junit.MockitoJUnitRunner; ...@@ -19,6 +20,8 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.context.request.WebRequest; import org.springframework.web.context.request.WebRequest;
import java.io.IOException;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public class GlobalExceptionMapperTests { public class GlobalExceptionMapperTests {
@Mock @Mock
...@@ -88,5 +91,22 @@ public class GlobalExceptionMapperTests { ...@@ -88,5 +91,22 @@ public class GlobalExceptionMapperTests {
//assertEquals("An unknown error has occurred.", response.getBody().getMessage()); //assertEquals("An unknown error has occurred.", response.getBody().getMessage());
} }
@Test
public void should_returnNullResponse_when_BrokenPipeIOExceptionIsCaptured() {
IOException ioException = new IOException("Broken pipe");
ResponseEntity response = sut.handleIOException(ioException);
assertNull(response);
}
@Test
public void should_returnServiceUnavailable_when_IOExceptionIsCaptured() {
IOException ioException = new IOException("Not broken yet");
ResponseEntity response = sut.handleIOException(ioException);
assertEquals(org.apache.http.HttpStatus.SC_SERVICE_UNAVAILABLE, response.getStatusCodeValue());
}
} }
\ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<docker.image.prefix>opendes</docker.image.prefix> <docker.image.prefix>opendes</docker.image.prefix>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<os-core-common.version>0.11.0-SNAPSHOT</os-core-common.version> <os-core-common.version>0.11.0</os-core-common.version>
<snakeyaml.version>1.26</snakeyaml.version> <snakeyaml.version>1.26</snakeyaml.version>
</properties> </properties>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<artifactId>legal-service</artifactId> <artifactId>legal-service</artifactId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>legal-service</name> <name>legal-service</name>
<description>Legal service</description> <description>Legal service</description>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<parent> <parent>
<artifactId>legal-service</artifactId> <artifactId>legal-service</artifactId>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<properties> <properties>
<aws.version>1.11.1018</aws.version> <aws.version>1.11.1018</aws.version>
<deployment.environment>dev</deployment.environment> <deployment.environment>dev</deployment.environment>
<version.number>0.11.0-SNAPSHOT</version.number> <version.number>0.12.0-SNAPSHOT</version.number>
</properties> </properties>
<dependencies> <dependencies>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<parent> <parent>
<artifactId>legal-service</artifactId> <artifactId>legal-service</artifactId>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
<azure.appservice.plan /> <azure.appservice.plan />
<azure.appservice.appname /> <azure.appservice.appname />
<azure.appservice.subscription /> <azure.appservice.subscription />
<osdu.corelibazure.version>0.10.0</osdu.corelibazure.version> <osdu.corelibazure.version>0.11.0</osdu.corelibazure.version>
<osdu.legal-core.version>0.11.0-SNAPSHOT</osdu.legal-core.version> <osdu.legal-core.version>0.12.0-SNAPSHOT</osdu.legal-core.version>
<javax.inject.version>1</javax.inject.version> <javax.inject.version>1</javax.inject.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version> <javax.servlet-api.version>4.0.1</javax.servlet-api.version>
<woodstox-core.version>5.3.0</woodstox-core.version> <woodstox-core.version>5.3.0</woodstox-core.version>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<parent> <parent>
<artifactId>legal-service</artifactId> <artifactId>legal-service</artifactId>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
<dependency> <dependency>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<artifactId>legal-core</artifactId> <artifactId>legal-core</artifactId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
<parent> <parent>
<artifactId>legal-service</artifactId> <artifactId>legal-service</artifactId>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<artifactId>legal-gcp</artifactId> <artifactId>legal-gcp</artifactId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>legal-gcp</name> <name>legal-gcp</name>
<description>Legal service Google App Engine flex</description> <description>Legal service Google App Engine flex</description>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<dependency> <dependency>
<groupId>org.opengroup.osdu.legal</groupId> <groupId>org.opengroup.osdu.legal</groupId>
<artifactId>legal-core</artifactId> <artifactId>legal-core</artifactId>
<version>0.11.0-SNAPSHOT</version> <version>0.12.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.opengroup.osdu</groupId> <groupId>org.opengroup.osdu</groupId>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>org.opengroup.osdu</groupId> <groupId>org.opengroup.osdu</groupId>
<artifactId>core-lib-gcp</artifactId> <artifactId>core-lib-gcp</artifactId>
<version>0.10.0</version> <version>0.11.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
......
...@@ -11,4 +11,4 @@ REDIS_STORAGE_HOST=10.0.16.12 ...@@ -11,4 +11,4 @@ REDIS_STORAGE_HOST=10.0.16.12
REDIS_GROUP_PORT=6379 REDIS_GROUP_PORT=6379
REDIS_STORAGE_PORT=6379 REDIS_STORAGE_PORT=6379
DEFAULT_DATA_COUNTRY=US DEFAULT_DATA_COUNTRY=US
\ No newline at end of file
...@@ -11,4 +11,11 @@ JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupanc ...@@ -11,4 +11,11 @@ JAVA_GC_OPTS=-XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupanc
enable.full.bucket.name=false enable.full.bucket.name=false
google.audiences=123.apps.googleusercontent.com google.audiences=123.apps.googleusercontent.com
partition.api=http://localhost:8081/api/partition/v1
ENTITLEMENTS_HOST=http://entitlements
ENTITLEMENTS_PATH=/api/entitlements/v2
AUTHORIZE_API=${ENTITLEMENTS_HOST}${ENTITLEMENTS_PATH}
PARTITION_HOST=http://partition
PARTITION_PATH=/api/partition/v1
PARTITION_API=${PARTITION_HOST}${PARTITION_PATH}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment