diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ebe5dc853da1d76fc6b4f37ed0747b2a28db91f0..fd2f9b7c07fa09cc2624f1a47b56dcc43dfff7f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,6 +24,7 @@ variables: OSDU_GCP_DATA_GROUP: osdu OSDU_GCP_ENV_VARS: AUTHORIZE_API=$OSDU_GCP_ENTITLEMENTS_URL,GOOGLE_CLOUD_PROJECT=$OSDU_GCP_PROJECT,REDIS_SEARCH_HOST=$REDIS_SEARCH_HOST,REDIS_GROUP_HOST=$REDIS_GROUP_HOST,SECURITY_HTTPS_CERTIFICATE_TRUST=$OSDU_SECURITY_HTTPS_CERTIFICATE_TRUST,INDEXER_HOST=$OSDU_GCP_INDEXER_HOST,STORAGE_QUERY_RECORD_HOST=$OSDU_GCP_STORAGE_QUERY_RECORD_HOST,STORAGE_SCHEMA_HOST=$OSDU_GCP_STORAGE_SCHEMA_HOST,STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST=$OSDU_GCP_STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST,STORAGE_HOSTNAME=$OSDU_GCP_STORAGE_HOSTNAME,STORAGE_RECORDS_BATCH_SIZE=$OSDU_GCP_STORAGE_RECORDS_BATCH_SIZE,INDEXER_QUEUE_HOST=$OSDU_GCP_INDEXER_QUEUE_HOST,LEGALTAG_API=$OSDU_GCP_LEGALTAG_API,CRS_API=$OSDU_GCP_CRS_API,DATA_GROUP=$OSDU_GCP_DATA_GROUP,GOOGLE_AUDIENCES=$GOOGLE_AUDIENCE,PARTITION_API=$OSDU_GCP_PARTITION_API,INDEXER_QUE_SERVICE_MAIL=$OSDU_GCP_QUEUE_SA_EMAIL,SCHEMA_HOST=$OSDU_GCP_SCHEMA_URL/api/schema-service/v1/schema --vpc-connector=$OSDU_GCP_VPC_CONNECTOR OSDU_GCP_TEST_SUBDIR: testing/$OSDU_GCP_SERVICE-test-$OSDU_GCP_VENDOR + OSDU_GCP_HELM_PACKAGE_CHARTS: "devops/gcp/deploy devops/gcp/configmap" IBM_BUILD_SUBDIR: provider/indexer-ibm IBM_INT_TEST_SUBDIR: testing/indexer-test-ibm diff --git a/NOTICE b/NOTICE index 4c408c6e65feaa0b7ffa2b5a434e33d58a3b25d1..d0a95b33e9dc9e4e97b7cd16655ae00c940966e1 100644 --- a/NOTICE +++ b/NOTICE @@ -11,7 +11,6 @@ The following software have components provided under the terms of this license: - Cobertura code coverage (from http://cobertura.sourceforge.net) - Plexus :: Default Container (from ) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) -- StAX (from http://stax.codehaus.org/) - oro (from ) ======================================================================== @@ -210,10 +209,11 @@ The following software have components provided under the terms of this license: - Asynchronous Http Client Netty Utils (from ) - AutoValue (from ) - AutoValue Annotations (from ) -- Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) -- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) +- Azure Spring Boot Starter for Azure AD Spring Security Integration (from https://github.com/Azure/azure-sdk-for-java) - BSON (from http://bsonspec.org) - Bean Validation API (from http://beanvalidation.org) +- Brave Instrumentation: Http Adapters (from ) +- Brave instrumentation for Reactor Netty HTTP (from https://github.com/reactor/reactor-netty) - Byte Buddy (without dependencies) (from ) - Byte Buddy Java agent (from ) - ClassMate (from http://github.com/cowtowncoder/java-classmate) @@ -224,6 +224,7 @@ The following software have components provided under the terms of this license: - Commons IO (from http://commons.apache.org/io/) - Commons Lang (from http://commons.apache.org/lang/) - Converter: Jackson (from ) +- Core functionality for the Reactor Netty library (from https://github.com/reactor/reactor-netty) - Data Mapper for Jackson (from http://jackson.codehaus.org) - Doxia :: APT Module (from ) - Doxia :: Core (from ) @@ -237,6 +238,7 @@ The following software have components provided under the terms of this license: - Elastic JNA Distribution (from https://github.com/java-native-access/jna) - Elasticsearch: 5.0.0-alpha5 (from https://github.com/elastic/elasticsearch) - Elasticsearch: 5.0.0-alpha5 (from https://github.com/elastic/elasticsearch) +- Expression Language 3.0 (from http://uel.java.net) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) - GSON extensions to the Google HTTP Client Library for Java. (from ) - Google APIs Client Library for Java (from ) @@ -266,6 +268,7 @@ The following software have components provided under the terms of this license: - Guava: Google Core Libraries for Java (from https://github.com/google/guava.git) - HPPC Collections (from http://labs.carrotsearch.com) - HPPC Collections (from http://labs.carrotsearch.com) +- HTTP functionality for the Reactor Netty library (from https://github.com/reactor/reactor-netty) - Hibernate Validator Engine (from ) - IBM COS Java SDK for Amazon S3 (from https://github.com/ibm/ibm-cos-sdk-java) - IBM COS Java SDK for COS KMS (from https://github.com/ibm/ibm-cos-sdk-java) @@ -375,7 +378,6 @@ The following software have components provided under the terms of this license: - Maven Repository Metadata Model (from ) - Maven Settings (from ) - Metrics Core (from https://github.com/dropwizard/metrics) -- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -391,17 +393,29 @@ The following software have components provided under the terms of this license: - MongoDB Java Driver Core (from http://www.mongodb.org) - Netty Reactive Streams HTTP support (from ) - Netty Reactive Streams Implementation (from ) +- Netty Reactive Streams Implementation (from ) +- Netty/Buffer (from http://netty.io/) - Netty/Buffer (from http://netty.io/) - Netty/Codec (from ) +- Netty/Codec (from ) +- Netty/Codec/DNS (from ) +- Netty/Codec/HTTP (from ) - Netty/Codec/HTTP (from ) - Netty/Codec/HTTP2 (from ) +- Netty/Codec/HTTP2 (from ) - Netty/Codec/Socks (from ) - Netty/Common (from ) +- Netty/Common (from ) +- Netty/Handler (from ) - Netty/Handler (from ) - Netty/Handler/Proxy (from ) - Netty/Resolver (from ) +- Netty/Resolver (from ) +- Netty/Resolver/DNS (from ) - Netty/TomcatNative [BoringSSL - Static] (from ) - Netty/Transport (from http://netty.io/) +- Netty/Transport (from http://netty.io/) +- Netty/Transport/Native/Unix/Common (from ) - Netty/Transport/Native/Unix/Common (from ) - Nimbus Content Type (from https://bitbucket.org/connect2id/nimbus-content-type) - Nimbus JOSE+JWT (from https://bitbucket.org/connect2id/nimbus-jose-jwt) @@ -412,6 +426,7 @@ The following software have components provided under the terms of this license: - Non-Blocking Reactive Foundation for the JVM (from https://github.com/reactor/reactor) - OAuth 2.0 SDK with OpenID Connect extensions (from https://bitbucket.org/connect2id/oauth-2.0-sdk-with-openid-connect-extensions) - OAuth 2.0 SDK with OpenID Connect extensions (from https://bitbucket.org/connect2id/oauth-2.0-sdk-with-openid-connect-extensions) +- OAuth 2.0 SDK with OpenID Connect extensions (from https://bitbucket.org/connect2id/oauth-2.0-sdk-with-openid-connect-extensions) - OAuth2 for Spring Security (from ) - Objenesis (from http://objenesis.org) - OkHttp (from ) @@ -420,6 +435,8 @@ The following software have components provided under the terms of this license: - OkHttp URLConnection (from ) - OkHttp URLConnection (from ) - Okio (from ) +- Okio (from ) +- OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java) @@ -438,7 +455,6 @@ The following software have components provided under the terms of this license: - Reactive Streams Netty driver (from https://github.com/reactor/reactor-netty) - Retrofit (from ) - Servlet Specification 2.5 API (from ) -- Simple XML (from http://simple.sourceforge.net) - SnakeYAML (from http://www.snakeyaml.org) - Spatial4J (from http://www.locationtech.org/projects/locationtech.spatial4j) - Spring AMQP Core (from https://projects.spring.io/spring-amqp) @@ -457,6 +473,7 @@ The following software have components provided under the terms of this license: - Spring Boot Json Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-json) - Spring Boot Log4J2 Starter (from http://projects.spring.io/spring-boot/) - Spring Boot Logging Starter (from http://projects.spring.io/spring-boot/) +- Spring Boot Reactor Netty Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-reactor-netty) - Spring Boot Security Starter (from http://projects.spring.io/spring-boot/) - Spring Boot Starter (from http://projects.spring.io/spring-boot/) - Spring Boot Test (from http://projects.spring.io/spring-boot/) @@ -465,6 +482,7 @@ The following software have components provided under the terms of this license: - Spring Boot Tomcat Starter (from http://projects.spring.io/spring-boot/) - Spring Boot Validation Starter (from http://projects.spring.io/spring-boot/) - Spring Boot Web Starter (from http://projects.spring.io/spring-boot/) +- Spring Boot WebFlux Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-webflux) - Spring Commons Logging Bridge (from https://github.com/spring-projects/spring-framework) - Spring Context (from https://github.com/spring-projects/spring-framework) - Spring Core (from https://github.com/spring-projects/spring-framework) @@ -484,15 +502,20 @@ The following software have components provided under the terms of this license: - Spring Transaction (from https://github.com/spring-projects/spring-framework) - Spring Web (from https://github.com/spring-projects/spring-framework) - Spring Web MVC (from https://github.com/spring-projects/spring-framework) -- StAX (from http://stax.codehaus.org/) -- StAX API (from http://stax.codehaus.org/) +- Spring WebFlux (from https://github.com/spring-projects/spring-framework) - T-Digest (from https://github.com/tdunning/t-digest) +- Vavr (from http://vavr.io) +- Vavr Match (from http://vavr.io) - Woodstox (from https://github.com/FasterXML/woodstox) - Xerces2-j (from https://xerces.apache.org/xerces2-j/) +- Zipkin Reporter Brave (from https://repo1.maven.org/maven2/io/zipkin/reporter2/zipkin-reporter-brave) +- Zipkin Reporter: Core (from ) +- Zipkin v2 (from ) - aalto-xml (from ) - aggs-matrix-stats (from https://github.com/elastic/elasticsearch) - aggs-matrix-stats (from https://github.com/elastic/elasticsearch) - aws-ssm-java-caching-client (from https://github.com/awslabs/aws-ssm-java-caching-client) +- brave (from ) - cli (from https://github.com/elastic/elasticsearch) - cli (from https://github.com/elastic/elasticsearch) - com.google.api.grpc:grpc-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis) @@ -501,6 +524,7 @@ The following software have components provided under the terms of this license: - com.google.api.grpc:proto-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis) - com.google.api.grpc:proto-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis) - com.google.api.grpc:proto-google-common-protos (from https://github.com/googleapis/googleapis) +- com.google.api.grpc:proto-google-common-protos (from https://github.com/googleapis/googleapis) - com.google.api.grpc:proto-google-iam-v1 (from https://github.com/googleapis/googleapis) - commons-collections (from ) - compiler (from http://github.com/spullara/mustache.java) @@ -516,10 +540,15 @@ The following software have components provided under the terms of this license: - io.grpc:grpc-context (from https://github.com/grpc/grpc-java) - io.grpc:grpc-context (from https://github.com/grpc/grpc-java) - io.grpc:grpc-core (from https://github.com/grpc/grpc-java) +- io.grpc:grpc-core (from https://github.com/grpc/grpc-java) - io.grpc:grpc-grpclb (from https://github.com/grpc/grpc-java) - io.grpc:grpc-netty-shaded (from https://github.com/grpc/grpc-java) +- io.grpc:grpc-netty-shaded (from https://github.com/grpc/grpc-java) +- io.grpc:grpc-protobuf (from https://github.com/grpc/grpc-java) - io.grpc:grpc-protobuf (from https://github.com/grpc/grpc-java) - io.grpc:grpc-protobuf-lite (from https://github.com/grpc/grpc-java) +- io.grpc:grpc-protobuf-lite (from https://github.com/grpc/grpc-java) +- io.grpc:grpc-stub (from https://github.com/grpc/grpc-java) - io.grpc:grpc-stub (from https://github.com/grpc/grpc-java) - ion-java (from https://github.com/amznlabs/ion-java/) - ion-java (from https://github.com/amznlabs/ion-java/) @@ -547,6 +576,8 @@ The following software have components provided under the terms of this license: - mapper-extras (from https://github.com/elastic/elasticsearch) - micrometer-core (from https://github.com/micrometer-metrics/micrometer) - micrometer-registry-azure-monitor (from https://github.com/micrometer-metrics/micrometer) +- nio-multipart-parser (from ) +- nio-stream-storage (from https://github.com/synchronoss/nio-stream-storage) - org.xmlunit:xmlunit-core (from http://www.xmlunit.org/) - oro (from ) - parent-join (from https://github.com/elastic/elasticsearch) @@ -561,6 +592,8 @@ The following software have components provided under the terms of this license: - proton-j (from ) - rank-eval (from https://github.com/elastic/elasticsearch) - rank-eval (from https://github.com/elastic/elasticsearch) +- resilience4j (from https://github.com/resilience4j/resilience4j) +- resilience4j (from https://github.com/resilience4j/resilience4j) - rest (from https://github.com/elastic/elasticsearch) - rest (from https://github.com/elastic/elasticsearch) - rest-high-level (from https://github.com/elastic/elasticsearch) @@ -610,7 +643,6 @@ The following software have components provided under the terms of this license: - Lucene Core (from ) - Plexus :: Default Container (from ) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) -- StAX (from http://stax.codehaus.org/) - Stax2 API (from http://github.com/FasterXML/stax2-api) - jersey-ext-bean-validation (from ) - jersey-spring4 (from ) @@ -649,15 +681,15 @@ The following software have components provided under the terms of this license: - Lucene Core (from ) - Lucene Suggest (from ) - Lucene Suggest (from ) -- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) - Mockito (from http://www.mockito.org) -- NanoHttpd-Core (from ) +- Netty/Codec/HTTP (from ) - Netty/Codec/HTTP (from ) - Plexus Common Utilities (from http://plexus.codehaus.org/plexus-utils) - Protocol Buffer Java API (from https://developers.google.com/protocol-buffers/) +- Protocol Buffer Java API (from https://developers.google.com/protocol-buffers/) - Protocol Buffers [Util] (from ) - Reflections (from http://github.com/ronmamo/reflections) - SnakeYAML (from http://www.snakeyaml.org) @@ -689,7 +721,6 @@ CC-BY-4.0 ======================================================================== The following software have components provided under the terms of this license: -- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -737,6 +768,7 @@ CDDL-1.1 ======================================================================== The following software have components provided under the terms of this license: +- Expression Language 3.0 (from http://uel.java.net) - Java Architecture For XML Binding (from ) - Java Servlet API (from http://servlet-spec.java.net) - JavaBeans Activation Framework (from ) @@ -765,7 +797,6 @@ The following software have components provided under the terms of this license: - Logback Contrib :: JSON :: Core (from ) - Logback Contrib :: Jackson (from ) - Logback Core Module (from ) -- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -783,6 +814,7 @@ The following software have components provided under the terms of this license: - Cobertura Limited Runtime (from http://cobertura.sourceforge.net) - Cobertura code coverage (from http://cobertura.sourceforge.net) - Commons Lang (from http://commons.apache.org/lang/) +- Expression Language 3.0 (from http://uel.java.net) - HK2 API module (from git://java.net/hk2~git/hk2-api) - HK2 Implementation Utilities (from ) - HK2 Spring Bridge (from ) @@ -830,6 +862,7 @@ The following software have components provided under the terms of this license: - Checker Qual (from https://checkerframework.org) - Cobertura code coverage (from http://cobertura.sourceforge.net) +- Expression Language 3.0 (from http://uel.java.net) - HK2 Implementation Utilities (from ) - Java Architecture For XML Binding (from ) - Java Servlet API (from http://servlet-spec.java.net) @@ -889,7 +922,6 @@ The following software have components provided under the terms of this license: - Logback Contrib :: JSON :: Core (from ) - Logback Contrib :: Jackson (from ) - Logback Core Module (from ) -- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -920,12 +952,10 @@ The following software have components provided under the terms of this license: - AWS Java SDK for AWS Lambda (from https://aws.amazon.com/sdkforjava) - Animal Sniffer Annotations (from ) -- Azure AD Spring Security Integration Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) - Azure Java Client Authentication Library for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Azure Java Client Runtime for ARM (from https://github.com/Azure/autorest-clientruntime-for-java) - Azure Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) -- Azure Metrics Spring Boot Starter (from https://github.com/Microsoft/azure-spring-boot) -- Azure Spring Boot AutoConfigure (from https://github.com/Microsoft/azure-spring-boot) +- Azure Spring Boot AutoConfigure (from https://github.com/Azure/azure-sdk-for-java) - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html) - Checker Qual (from https://checkerframework.org) @@ -961,6 +991,8 @@ The following software have components provided under the terms of this license: - Mockito (from http://mockito.org) - Mockito (from http://www.mockito.org) - Netty/Codec/HTTP (from ) +- Netty/Codec/HTTP (from ) +- Netty/Common (from ) - Netty/Common (from ) - Plexus :: Default Container (from ) - Plexus Default Interactivity Handler (from ) @@ -993,8 +1025,16 @@ The following software have components provided under the terms of this license: - Javassist (from http://www.javassist.org/) - Javassist (from http://www.javassist.org/) +- OkHttp (from ) - RabbitMQ Java Client (from http://www.rabbitmq.com) +======================================================================== +MS-RL +======================================================================== +The following software have components provided under the terms of this license: + +- Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) + ======================================================================== PHP-3.01 ======================================================================== @@ -1075,7 +1115,6 @@ The following software have components provided under the terms of this license: - Spring Security JWT Library (from http://github.com/spring-projects/spring-security-oauth) - Spring Security JWT Library (from http://github.com/spring-projects/spring-security-oauth) - Spring Web (from https://github.com/spring-projects/spring-framework) -- StAX API (from http://stax.codehaus.org/) - azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/) - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) - reactive-streams (from http://www.reactive-streams.org/) diff --git a/devops/gcp/configmap/Chart.yaml b/devops/gcp/configmap/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c500f6dd586a566a8f55be1c428d40da77b506e1 --- /dev/null +++ b/devops/gcp/configmap/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gcp-indexer-configmap +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/devops/gcp/configmap/templates/indexer-variables.yml b/devops/gcp/configmap/templates/indexer-variables.yml new file mode 100644 index 0000000000000000000000000000000000000000..9925de5e5c4bee6655c4739cc3d494a4417a64fd --- /dev/null +++ b/devops/gcp/configmap/templates/indexer-variables.yml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: "{{ .Values.conf.app_name }}" + name: "{{ .Values.conf.configmap }}" + namespace: "{{ .Release.Namespace }}" +data: + LOG_LEVEL: "{{ .Values.data.log_level }}" + SCHEMA_HOST: "{{ .Values.data.schema_host }}" + AUTHORIZE_API: "{{ .Values.data.authorize_api }}" + GOOGLE_CLOUD_PROJECT: "{{ .Values.data.google_cloud_project }}" + REDIS_SEARCH_HOST: "{{ .Values.data.redis_search_host }}" + REDIS_GROUP_HOST: "{{ .Values.data.redis_group_host }}" + SECURITY_HTTPS_CERTIFICATE_TRUST: "{{ .Values.data.security_https_certificate_trust }}" + INDEXER_HOST: "{{ .Values.data.indexer_host }}" + STORAGE_QUERY_RECORD_HOST: "{{ .Values.data.storage_query_record_host }}" + STORAGE_SCHEMA_HOST: "{{ .Values.data.storage_schema_host }}" + STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST: "{{ .Values.data.storage_query_record_for_conversion_host }}" + STORAGE_HOSTNAME: "{{ .Values.data.storage_hostname }}" + STORAGE_RECORDS_BATCH_SIZE: "{{ .Values.data.storage_records_batch_size }}" + INDEXER_QUEUE_HOST: "{{ .Values.data.indexer_queue_host }}" + LEGALTAG_API: "{{ .Values.data.legaltag_api }}" + CRS_API: "{{ .Values.data.crs_api }}" + PARTITION_API: "{{ .Values.data.partition_api }}" + GOOGLE_AUDIENCES: "{{ .Values.data.google_audiences }}" + INDEXER_QUE_SERVICE_MAIL: "{{ .Values.data.indexer_que_service_mail }}" diff --git a/devops/gcp/configmap/values.yaml b/devops/gcp/configmap/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5708b9046abd95fb5d8007696dc243f13489c991 --- /dev/null +++ b/devops/gcp/configmap/values.yaml @@ -0,0 +1,28 @@ +# Default values for indexer-configmap. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +data: + log_level: "" + schema_host: "" + authorize_api: "" + google_cloud_project: "" + redis_search_host: "" + redis_group_host: "" + security_https_certificate_trust: "true" + indexer_host: "" + storage_query_record_host: "" + storage_schema_host: "" + storage_query_record_for_conversion_host: "" + storage_hostname: "" + storage_records_batch_size: "20" + indexer_queue_host: "" + legaltag_api: "" + crs_api: "" + partition_api: "" + google_audiences: "" + indexer_que_service_mail: "" + +conf: + configmap: "indexer-config" + app_name: "indexer" diff --git a/devops/gcp/deploy/Chart.yaml b/devops/gcp/deploy/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c734669619861963d0ae8e80968babc7dbfbbbf --- /dev/null +++ b/devops/gcp/deploy/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gcp-indexer-deploy +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" diff --git a/devops/gcp/deploy/templates/indexer-deploy.yml b/devops/gcp/deploy/templates/indexer-deploy.yml new file mode 100644 index 0000000000000000000000000000000000000000..c85dbf030fce67577620768211a427c61de97055 --- /dev/null +++ b/devops/gcp/deploy/templates/indexer-deploy.yml @@ -0,0 +1,36 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: "{{ .Values.conf.app_name }}" + name: "{{ .Values.conf.app_name }}" + namespace: "{{ .Release.Namespace }}" +spec: + selector: + matchLabels: + app: "{{ .Values.conf.app_name }}" + replicas: 1 + template: + metadata: + labels: + app: "{{ .Values.conf.app_name }}" + spec: + containers: + - name: "{{ .Values.conf.app_name }}" + image: "{{ .Values.data.image }}" + envFrom: + - configMapRef: + name: "{{ .Values.conf.configmap }}" + securityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + ports: + - containerPort: 8080 + resources: + requests: + cpu: "{{ .Values.data.requests_cpu }}" + memory: "{{ .Values.data.requests_memory }}" + limits: + cpu: "{{ .Values.data.limits_cpu }}" + memory: "{{ .Values.data.limits_memory }}" + serviceAccountName: "{{ .Values.data.serviceAccountName }}" diff --git a/devops/gcp/deploy/templates/indexer-service.yml b/devops/gcp/deploy/templates/indexer-service.yml new file mode 100644 index 0000000000000000000000000000000000000000..d92e1b6fb4b7890067aaf4d6b46c8310162d4d6e --- /dev/null +++ b/devops/gcp/deploy/templates/indexer-service.yml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: "{{ .Values.conf.app_name }}" + annotations: + cloud.google.com/neg: '{"ingress": true}' + namespace: "{{ .Release.Namespace }}" + labels: + app: "{{ .Values.conf.app_name }}" + service: "{{ .Values.conf.app_name }}" +spec: + ports: + - protocol: TCP + port: 80 + targetPort: 8080 + name: http + selector: + app: "{{ .Values.conf.app_name }}" diff --git a/devops/gcp/deploy/templates/indexer-virtual-service.yml b/devops/gcp/deploy/templates/indexer-virtual-service.yml new file mode 100644 index 0000000000000000000000000000000000000000..92b3de4c4511eca444b36efa02bebcc320f4a38f --- /dev/null +++ b/devops/gcp/deploy/templates/indexer-virtual-service.yml @@ -0,0 +1,19 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: "{{ .Values.conf.app_name }}" + namespace: "{{ .Release.Namespace }}" +spec: + hosts: + - "*" + gateways: + - service-gateway + http: + - match: + - uri: + prefix: "/api/indexer/v2" + route: + - destination: + port: + number: 80 + host: "{{ .Values.conf.app_name }}.{{ .Release.Namespace }}.svc.cluster.local" diff --git a/devops/gcp/deploy/values.yaml b/devops/gcp/deploy/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d7627dae6d7ba8ba245e2be3399e9eda98f1f1c2 --- /dev/null +++ b/devops/gcp/deploy/values.yaml @@ -0,0 +1,15 @@ +# Default values for indexer-deploy. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +data: + requests_cpu: "0.25" + requests_memory: "128M" + limits_cpu: "1" + limits_memory: "1G" + serviceAccountName: "" + image: "" + +conf: + configmap: "indexer-config" + app_name: "indexer" diff --git a/indexer-core/pom.xml b/indexer-core/pom.xml index 6a506916315115f5e405e38bd3cd126c2017721d..94aa6f13d7c3c3c7f9c755f5585eea1306ed5481 100644 --- a/indexer-core/pom.xml +++ b/indexer-core/pom.xml @@ -4,19 +4,19 @@ <parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <artifactId>indexer-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <name>indexer-core</name> <description>Indexer Service Core</description> <packaging>jar</packaging> <properties> <commons-beanutils.version>1.9.4</commons-beanutils.version> - <osdu.oscorecommon.version>0.9.0-SNAPSHOT</osdu.oscorecommon.version> + <osdu.oscorecommon.version>0.9.0</osdu.oscorecommon.version> </properties> <dependencies> diff --git a/pom.xml b/pom.xml index 6265945bd14bac470785a373998e3e37ade3b30a..6cb939bafbe005a3fafe98a932c1a130fd3a9199 100644 --- a/pom.xml +++ b/pom.xml @@ -12,14 +12,14 @@ <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> <packaging>pom</packaging> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <description>Indexer Service</description> <properties> <java.version>1.8</java.version> <springfox-version>2.7.0</springfox-version> <spring-cloud.version>Greenwich.SR2</spring-cloud.version> - <os-core-common.version>0.9.0-SNAPSHOT</os-core-common.version> + <os-core-common.version>0.9.0</os-core-common.version> <snakeyaml.version>1.26</snakeyaml.version> <hibernate-validator.version>6.1.5.Final</hibernate-validator.version> <jackson.version>2.11.4</jackson.version> diff --git a/provider/indexer-aws/pom.xml b/provider/indexer-aws/pom.xml index 1c576b02acfcd913008f0fbb34b60d1b99767b19..4602ae9bedca6c11ac7efcf9d316bbfe59a64d80 100644 --- a/provider/indexer-aws/pom.xml +++ b/provider/indexer-aws/pom.xml @@ -18,7 +18,7 @@ <parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -26,12 +26,11 @@ <artifactId>indexer-aws</artifactId> <description>Storage service on AWS</description> <packaging>jar</packaging> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <properties> <aws.version>1.11.637</aws.version> <deployment.environment>dev</deployment.environment> - <version.number>1.0.6-SNAPSHOT</version.number> </properties> <dependencies> @@ -43,7 +42,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.opengroup.osdu.core.aws</groupId> diff --git a/provider/indexer-azure/pom.xml b/provider/indexer-azure/pom.xml index 764fabd09e41e39c7aa40402da08f2e7102b1d97..527ee87a6191a5aaa13c87b1d6fd960f0bcc3b70 100644 --- a/provider/indexer-azure/pom.xml +++ b/provider/indexer-azure/pom.xml @@ -21,12 +21,12 @@ <parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>indexer-azure</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <name>indexer-azure</name> <description>Indexer Service Azure</description> <packaging>jar</packaging> @@ -39,15 +39,20 @@ <azure.appservice.subscription /> <log4j.version>2.11.2</log4j.version> <nimbus-jose-jwt.version>8.2</nimbus-jose-jwt.version> - <indexer-core.version>0.9.0-SNAPSHOT</indexer-core.version> + <indexer-core.version>0.10.0-SNAPSHOT</indexer-core.version> <spring-security-jwt.version>1.1.1.RELEASE</spring-security-jwt.version> - <osdu.corelibazure.version>0.6.2</osdu.corelibazure.version> + <osdu.corelibazure.version>0.9.0</osdu.corelibazure.version> <reactor-netty.version>0.9.12.RELEASE</reactor-netty.version> <java-jwt.version>3.8.1</java-jwt.version> <powermock.version>2.0.2</powermock.version> <mockito.version>3.0.0</mockito.version> <cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version> <spring-security-oauth2.version>2.3.6.RELEASE</spring-security-oauth2.version> + <spring-boot.version>2.1.18.RELEASE</spring-boot.version> + <reactor-netty.version>1.0.7</reactor-netty.version> + <reactor-core.version>3.4.6</reactor-core.version> + <jackson-dataformat-xml.version>2.11.4</jackson-dataformat-xml.version> + <oauth2-oidc-sdk.version>6.5</oauth2-oidc-sdk.version> </properties> <dependencyManagement> @@ -58,6 +63,13 @@ <artifactId>reactor-netty</artifactId> <version>${reactor-netty.version}</version> </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> <!-- Inherit managed dependencies from core-lib-azure --> <dependency> <groupId>org.opengroup.osdu</groupId> @@ -119,8 +131,8 @@ </dependency> <dependency> - <groupId>com.microsoft.azure</groupId> - <artifactId>azure-active-directory-spring-boot-starter</artifactId> + <groupId>com.azure.spring</groupId> + <artifactId>azure-spring-boot-starter-active-directory</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> @@ -203,6 +215,18 @@ <artifactId>elasticsearch-rest-high-level-client</artifactId> </dependency> + <!-- Resilience4j Dependencies--> + <dependency> + <groupId>io.github.resilience4j</groupId> + <artifactId>resilience4j-retry</artifactId> + <version>1.7.0</version> + </dependency> + <dependency> + <groupId>io.github.resilience4j</groupId> + <artifactId>resilience4j-core</artifactId> + <version>1.7.0</version> + </dependency> + <!-- Test Dependencies --> <dependency> <groupId>org.springframework.boot</groupId> @@ -252,6 +276,26 @@ <version>${cobertura-maven-plugin.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>io.projectreactor.netty</groupId> + <artifactId>reactor-netty</artifactId> + <version>${reactor-netty.version}</version> + </dependency> + <dependency> + <groupId>io.projectreactor</groupId> + <artifactId>reactor-core</artifactId> + <version>${reactor-core.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.dataformat</groupId> + <artifactId>jackson-dataformat-xml</artifactId> + <version>${jackson-dataformat-xml.version}</version> + </dependency> + <dependency> + <groupId>com.nimbusds</groupId> + <artifactId>oauth2-oidc-sdk</artifactId> + <version>${oauth2-oidc-sdk.version}</version> + </dependency> </dependencies> diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/publish/PublisherImpl.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/publish/PublisherImpl.java index 7c5d2f854b68c25ea71a6e56a6f91e062491f2e6..dfa173eb1eb44d3f29530b1a733307800e83626f 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/publish/PublisherImpl.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/publish/PublisherImpl.java @@ -73,7 +73,7 @@ public class PublisherImpl implements IPublisher { message.setContentType("application/json"); try { - logger.info("Indexer publishes message " + headers.getCorrelationId()); + logger.debug("Indexer publishes message " + headers.getCorrelationId()); topicClientFactory.getClient(headers.getPartitionId(), serviceBusTopic).send(message); } catch (Exception e) diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/security/AADSecurityConfig.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/security/AADSecurityConfig.java index c38c67d0e5deb97771fe9828b081bb9a1fa14197..ff1bd512a2b333947365187500254b98f3209087 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/security/AADSecurityConfig.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/security/AADSecurityConfig.java @@ -14,7 +14,7 @@ package org.opengroup.osdu.indexer.azure.security; -import com.microsoft.azure.spring.autoconfigure.aad.AADAppRoleStatelessAuthenticationFilter; +import com.azure.spring.autoconfigure.aad.AADAppRoleStatelessAuthenticationFilter; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java new file mode 100644 index 0000000000000000000000000000000000000000..47d906c9ad7e83e29b112ea8339117877503a430 --- /dev/null +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java @@ -0,0 +1,81 @@ +// 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. + +package org.opengroup.osdu.indexer.azure.service; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import io.github.resilience4j.retry.RetryConfig; +import lombok.Data; +import lombok.extern.java.Log; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; +import org.opengroup.osdu.core.common.model.http.HttpResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.time.Duration; + +/** + * This class handles retry configuration logic for calls made to <prefix>/storage/v2/query/records:batch + * to resolve intermittent CosmosDb Not found issue + */ + +@Log +@Component +@Data +@ConfigurationProperties(prefix = "azure.storage.client.retry") +public class RetryPolicy { + + @Autowired + private JaxRsDpsLog logger; + + private int attempts = 3; + private int waitDuration = 1000; + private final String RECORD_NOT_FOUND = "notFound"; + + /** + * @return RetryConfig with 3 attempts and 1 sec wait time + */ + public RetryConfig retryConfig() { + return RetryConfig.<HttpResponse>custom() + .maxAttempts(attempts) + .waitDuration(Duration.ofMillis(waitDuration)) + .retryOnResult(response -> isRetryRequired(response)) + .build(); + } + + /** + * Unfound records get listed under a JsonArray "notFound" in the http json response + * @param response + * @return if there are elements in "notFound" returns true, else false + */ + private boolean isRetryRequired(HttpResponse response) { + if (response == null || response.getBody().isEmpty()) { + return false; + } + JsonObject jsonObject = new JsonParser().parse(response.getBody()).getAsJsonObject(); + JsonElement notFoundElement = (JsonArray) jsonObject.get(RECORD_NOT_FOUND); + if (notFoundElement == null || + !notFoundElement.isJsonArray() || + notFoundElement.getAsJsonArray().size() == 0 || + notFoundElement.getAsJsonArray().isJsonNull()) { + return false; + } + log.info("Retry is set true"); + return true; + } +} diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..d56b888fafaf747bd51f97658e7bfd255a0f31e9 --- /dev/null +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImpl.java @@ -0,0 +1,95 @@ +// 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. + +package org.opengroup.osdu.indexer.azure.service; + +import io.github.resilience4j.retry.Retry; +import io.github.resilience4j.retry.RetryConfig; +import io.github.resilience4j.retry.RetryRegistry; +import org.opengroup.osdu.core.common.http.FetchServiceHttpRequest; +import org.opengroup.osdu.core.common.http.IUrlFetchService; +import org.opengroup.osdu.core.common.http.UrlFetchServiceImpl; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; +import org.opengroup.osdu.core.common.model.http.HttpResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Service; +import org.springframework.web.context.annotation.RequestScope; + +import java.net.URISyntaxException; +import java.util.function.Supplier; + +/** + * This class has same function as that of UrlFetchService except in the case of + * <prefix>/storage/v2/query/records:batch call for which it enables retry + */ + +@Service +@RequestScope +@Primary +public class UrlFetchServiceAzureImpl implements IUrlFetchService { + + public static final String STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST_URL = "storage/v2/query/records:batch"; + + @Autowired + private RetryPolicy policy; + + @Autowired + private UrlFetchServiceImpl urlFetchService; + + @Autowired + private JaxRsDpsLog logger; + /** + * this method invokes retryFunction only for <prefix>/storage/v2/query/records:batch + * calls otherwise invokes UrlFetchService.sendRequest(FetchServiceHttpRequest request) + * + * @param httpRequest + * @return + * @throws URISyntaxException + */ + @Override + public HttpResponse sendRequest(FetchServiceHttpRequest httpRequest) throws URISyntaxException { + HttpResponse output; + if (httpRequest.getUrl().contains(STORAGE_QUERY_RECORD_FOR_CONVERSION_HOST_URL)) { + output = this.retryFunction(httpRequest); + if (output != null) { + return output; + } + } + return this.urlFetchService.sendRequest(httpRequest); + } + + /** + * decorates UrlFetchService.sendRequest(FetchServiceHttpRequest request) + * with retry configurations in RetryPolicy + * + * @param request + * @return null if URISyntaxException is caught else returns HttpResponse + */ + private HttpResponse retryFunction(FetchServiceHttpRequest request) { + RetryConfig config = this.policy.retryConfig(); + RetryRegistry registry = RetryRegistry.of(config); + Retry retry = registry.retry("retryPolicy", config); + + Supplier<HttpResponse> urlFetchServiceSupplier = () -> { + try { + return this.urlFetchService.sendRequest(request); + } catch (URISyntaxException e) { + logger.error("HttpResponse is null due to URISyntaxException. " + e.getReason()); + return null; + } + }; + return (urlFetchServiceSupplier == null) ? null : Retry.decorateSupplier(retry, urlFetchServiceSupplier).get(); + } +} diff --git a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java index 4428beb160c4d352ebc24b5cf6fff74d9db5d799..947e060ba6171c9b96f0f47fe871e60f1d061e6d 100644 --- a/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java +++ b/provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/util/IndexerQueueTaskBuilderAzure.java @@ -151,7 +151,7 @@ public class IndexerQueueTaskBuilderAzure extends IndexerQueueTaskBuilder { message.setContentType("application/json"); try { - logger.info("Indexer publishes message to Service Bus " + headers.getCorrelationId()); + logger.debug("Indexer publishes message to Service Bus " + headers.getCorrelationId()); topicClientFactory.getClient(headers.getPartitionId(), serviceBusReindexTopicName).send(message); } catch (Exception e) { logger.error(e.getMessage(), e); diff --git a/provider/indexer-azure/src/main/resources/application.properties b/provider/indexer-azure/src/main/resources/application.properties index 897271df395ef070a6f4971f6cfa824d36436e28..59231e1ae9e1df6c0312d6e6334749cf4f179280 100644 --- a/provider/indexer-azure/src/main/resources/application.properties +++ b/provider/indexer-azure/src/main/resources/application.properties @@ -79,6 +79,7 @@ DEPLOYMENT_ENVIRONMENT=CLOUD logging.transaction.enabled=true logging.slf4jlogger.enabled=true logging.mdccontext.enabled=true +logging.ignore.servlet.paths=/swagger-ui.html # core-lib-azure configuration tenantFactoryImpl.required=true diff --git a/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/RetryPolicyTest.java b/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/RetryPolicyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..70a7fcb9e0e7bdbb2da003a5953645e8cf91cfc3 --- /dev/null +++ b/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/RetryPolicyTest.java @@ -0,0 +1,163 @@ +// 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. + +package org.opengroup.osdu.indexer.azure.service; + +import io.github.resilience4j.retry.RetryConfig; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.opengroup.osdu.core.common.http.FetchServiceHttpRequest; +import org.opengroup.osdu.core.common.http.UrlFetchServiceImpl; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; +import org.opengroup.osdu.core.common.model.http.HttpResponse; + +import java.util.function.Predicate; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +@RunWith(MockitoJUnitRunner.class) +public class RetryPolicyTest { + + private static final String JSON_RESPONSE_WITH_NOT_FOUND = "{\n" + + " \"records\": [\n" + + " {\n" + + " \"data\": {\n" + + " \"Spuddate\": \"atspud\",\n" + + " \"UWI\": \"atuwi\",\n" + + " \"latitude\": \"latitude\",\n" + + " \"longitude\": \"longitude\"\n" + + " },\n" + + " \"meta\": null,\n" + + " \"id\": \"demo\",\n" + + " \"version\": demo,\n" + + " \"kind\": \"demo\",\n" + + " \"acl\": {\n" + + " \"viewers\": [\n" + + " \"demo\"\n" + + " ],\n" + + " \"owners\": [\n" + + " \"demo\"\n" + + " ]\n" + + " },\n" + + " \"legal\": {\n" + + " \"legaltags\": [\n" + + " \"opendes-test-tag\"\n" + + " ],\n" + + " \"otherRelevantDataCountries\": [\n" + + " \"BR\"\n" + + " ],\n" + + " \"status\": \"compliant\"\n" + + " },\n" + + " \"createUser\": \"demo\",\n" + + " \"createTime\": \"demo\"\n" + + " }\n" + + " ],\n" + + " \"notFound\": [\n" + + " \"demo\"\n" + + " ],\n" + + " \"conversionStatuses\": []\n" + + "}"; + + private static final String JSON_RESPONSE1_WITHOUT_NOT_FOUND = "{\n" + + " \"records\": [\n" + + " {\n" + + " \"data\": {\n" + + " \"Spuddate\": \"atspud\",\n" + + " \"UWI\": \"atuwi\",\n" + + " \"latitude\": \"latitude\",\n" + + " \"longitude\": \"longitude\"\n" + + " },\n" + + " \"meta\": null,\n" + + " \"id\": \"demo\",\n" + + " \"version\": demo,\n" + + " \"kind\": \"demo\",\n" + + " \"acl\": {\n" + + " \"viewers\": [\n" + + " \"demo\"\n" + + " ],\n" + + " \"owners\": [\n" + + " \"demo\"\n" + + " ]\n" + + " },\n" + + " \"legal\": {\n" + + " \"legaltags\": [\n" + + " \"opendes-test-tag\"\n" + + " ],\n" + + " \"otherRelevantDataCountries\": [\n" + + " \"BR\"\n" + + " ],\n" + + " \"status\": \"compliant\"\n" + + " },\n" + + " \"createUser\": \"demo\",\n" + + " \"createTime\": \"demo\"\n" + + " }\n" + + " ],\n" + + " \"notFound\": [],\n" + + " \"conversionStatuses\": []\n" + + "}"; + + private static final String JSON_RESPONSE2_WITHOUT_NOT_FOUND = "{\n" + + " \"records\" :[],\n" + + " \"conversionStatuses\":[]\n" + + "}"; + + @Mock + private UrlFetchServiceImpl urlFetchService; + @Mock + private FetchServiceHttpRequest httpRequest; + @InjectMocks + private HttpResponse response; + @InjectMocks + private RetryPolicy retryPolicy; + @Mock + private JaxRsDpsLog logger; + + + @Test + public void retry_should_be_true_for_jsonResponseWithNotFound() { + RetryConfig config = this.retryPolicy.retryConfig(); + Predicate<HttpResponse> retry = config.getResultPredicate(); + response.setBody(JSON_RESPONSE_WITH_NOT_FOUND); + assert retry != null; + boolean value = retry.test(response); + + assertTrue(value); + } + + @Test + public void retry_should_be_false_for_jsonResponse1WithOut_NotFound() { + RetryConfig config = this.retryPolicy.retryConfig(); + Predicate<HttpResponse> retry = config.getResultPredicate(); + response.setBody(JSON_RESPONSE1_WITHOUT_NOT_FOUND); + boolean value = retry.test(response); + + assertFalse(value); + } + + @Test + public void retry_should_be_false_for_jsonResponse2WithOut_NotFound() { + RetryConfig config = this.retryPolicy.retryConfig(); + Predicate<HttpResponse> retry = config.getResultPredicate(); + response.setBody(JSON_RESPONSE2_WITHOUT_NOT_FOUND); + boolean value = retry.test(response); + + assertFalse(value); + } + +} diff --git a/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImplTest.java b/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImplTest.java new file mode 100644 index 0000000000000000000000000000000000000000..916c5b8bc987621937eb80d955fb80c4e7dab5f2 --- /dev/null +++ b/provider/indexer-azure/src/test/java/org/opengroup/osdu/indexer/azure/service/UrlFetchServiceAzureImplTest.java @@ -0,0 +1,139 @@ +// 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. + +package org.opengroup.osdu.indexer.azure.service; + +import io.github.resilience4j.retry.RetryConfig; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.opengroup.osdu.core.common.http.FetchServiceHttpRequest; +import org.opengroup.osdu.core.common.http.UrlFetchServiceImpl; +import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; +import org.opengroup.osdu.core.common.model.http.HttpResponse; + +import java.time.Duration; + +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.atMost; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.when; + + +@RunWith(MockitoJUnitRunner.class) +public class UrlFetchServiceAzureImplTest { + + @Mock + private JaxRsDpsLog logger; + @Mock + private UrlFetchServiceImpl urlFetchService; + @InjectMocks + private FetchServiceHttpRequest httpRequest; + @InjectMocks + private HttpResponse response; + @Mock + private RetryPolicy retryPolicy; + @InjectMocks + private UrlFetchServiceAzureImpl urlFetchServiceAzure; + + private static final String JSON1 = "{\n" + + " \"records\": [\n" + + " {\n" + + " \"data\": {\n" + + " \"Spuddate\": \"atspud\",\n" + + " \"UWI\": \"atuwi\",\n" + + " \"latitude\": \"latitude\",\n" + + " \"longitude\": \"longitude\"\n" + + " },\n" + + " \"meta\": null,\n" + + " \"id\": \"demo\",\n" + + " \"version\": demo,\n" + + " \"kind\": \"demo\",\n" + + " \"acl\": {\n" + + " \"viewers\": [\n" + + " \"demo\"\n" + + " ],\n" + + " \"owners\": [\n" + + " \"demo\"\n" + + " ]\n" + + " },\n" + + " \"legal\": {\n" + + " \"legaltags\": [\n" + + " \"opendes-test-tag\"\n" + + " ],\n" + + " \"otherRelevantDataCountries\": [\n" + + " \"BR\"\n" + + " ],\n" + + " \"status\": \"compliant\"\n" + + " },\n" + + " \"createUser\": \"demo\",\n" + + " \"createTime\": \"demo\"\n" + + " }\n" + + " ],\n" + + " \"notFound\": [\n" + + " \"demo\"\n" + + " ],\n" + + " \"conversionStatuses\": []\n" + + "}"; + + private static final String JSON2 = "{\n" + + " \"records\" :[],\n" + + " \"conversionStatuses\":[]\n" + + "}"; + + private static final String url = "https://demo/api/storage/v2/query/records:batch"; + private static final String url2 = "https://demo/api/storage/v2/schemas"; + + @Before + public void setUp() { + when(this.retryPolicy.retryConfig()).thenReturn(new RetryPolicy().retryConfig()); + } + + @Test + public void shouldRetry_ForJSON1_when_storageQueryRecordCallIsMade() throws Exception { + response.setBody(JSON1); + httpRequest.setUrl(url); + + when(urlFetchServiceAzure.sendRequest(httpRequest)).thenReturn(response); + + urlFetchServiceAzure.sendRequest(httpRequest); + verify(urlFetchService, atMost(4)).sendRequest(httpRequest); + } + + @Test + public void shouldNotRetry_ForJSON2_when_storageQueryRecordCallIsMade() throws Exception { + response.setBody(JSON2); + httpRequest.setUrl(url); + + when(urlFetchServiceAzure.sendRequest(httpRequest)).thenReturn(response); + + urlFetchServiceAzure.sendRequest(httpRequest); + verify(urlFetchService, atMost(2)).sendRequest(httpRequest); + } + + + @Test + public void retryFunction_shouldNotBeCalled() throws Exception { + httpRequest.setUrl(url2); + + when(urlFetchService.sendRequest(httpRequest)).thenReturn(response); + + urlFetchServiceAzure.sendRequest(httpRequest); + verify(urlFetchService, times(1)).sendRequest(httpRequest); + } + +} diff --git a/provider/indexer-gcp/pom.xml b/provider/indexer-gcp/pom.xml index c77d9f8e35b0afb47bbadb9cbb2c73d6ba6bf820..3777b89133e2f85a6ef41ab8a991f93b8f35876e 100644 --- a/provider/indexer-gcp/pom.xml +++ b/provider/indexer-gcp/pom.xml @@ -5,12 +5,12 @@ <parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>indexer-gcp</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <name>indexer-gcp</name> <description>Indexer Service GCP App Engine</description> <packaging>jar</packaging> @@ -19,13 +19,13 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>core-lib-gcp</artifactId> - <version>0.15.0-SNAPSHOT</version> + <version>0.9.0</version> </dependency> <dependency> diff --git a/provider/indexer-ibm/pom.xml b/provider/indexer-ibm/pom.xml index 15a818c39d86a80de1099c158e3310c26e456118..4da0811c54dcdcbd8dee467802452e48e7bc56e4 100644 --- a/provider/indexer-ibm/pom.xml +++ b/provider/indexer-ibm/pom.xml @@ -21,7 +21,7 @@ <parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> @@ -53,7 +53,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <dependency> diff --git a/provider/indexer-reference/pom.xml b/provider/indexer-reference/pom.xml index 745a8c4fd3531ea7eb2bc5b64e71582ac57667f9..b1cf1243eedff75bba1f34662720559e476b26f0 100644 --- a/provider/indexer-reference/pom.xml +++ b/provider/indexer-reference/pom.xml @@ -22,12 +22,12 @@ <parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-service</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <artifactId>indexer-reference</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <name>indexer-reference</name> <description>Indexer Service GCP Anthos</description> <packaging>jar</packaging> @@ -36,7 +36,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <dependency> diff --git a/testing/indexer-test-aws/pom.xml b/testing/indexer-test-aws/pom.xml index a2686385de571c4f159e8d9c7494b6bcf829a734..3b30e04e49c219b315f3f291f8f1c4a153215765 100644 --- a/testing/indexer-test-aws/pom.xml +++ b/testing/indexer-test-aws/pom.xml @@ -21,13 +21,13 @@ <parent> <groupId>org.opengroup.osdu</groupId> <artifactId>indexer-test</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-aws</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> @@ -42,7 +42,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <!-- AWS specific packages --> diff --git a/testing/indexer-test-azure/pom.xml b/testing/indexer-test-azure/pom.xml index 961263fefb4798ab2c3305c0957a21dc70f88455..69b19fdf0ed9ab49bc14c7e1bdad2ac96a83763f 100644 --- a/testing/indexer-test-azure/pom.xml +++ b/testing/indexer-test-azure/pom.xml @@ -21,13 +21,13 @@ <parent> <groupId>org.opengroup.osdu</groupId> <artifactId>indexer-test</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-azure</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> @@ -45,7 +45,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <!-- Azure dependencies --> diff --git a/testing/indexer-test-core/pom.xml b/testing/indexer-test-core/pom.xml index cdcc8eb5752f007ec5757910352043c0fadd5ff8..365aa1f09e4d65f87aa0a097fe56769d393a2621 100644 --- a/testing/indexer-test-core/pom.xml +++ b/testing/indexer-test-core/pom.xml @@ -5,13 +5,13 @@ <parent> <groupId>org.opengroup.osdu</groupId> <artifactId>indexer-test</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <properties> <maven.compiler.target>1.8</maven.compiler.target> diff --git a/testing/indexer-test-gcp/pom.xml b/testing/indexer-test-gcp/pom.xml index e25538ed89f404b93bd6f2cee8bae8992475e726..2d94432a53ce3b8317865e30a90a55815aa943c7 100644 --- a/testing/indexer-test-gcp/pom.xml +++ b/testing/indexer-test-gcp/pom.xml @@ -6,13 +6,13 @@ <parent> <groupId>org.opengroup.osdu</groupId> <artifactId>indexer-test</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-gcp</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> @@ -37,7 +37,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <!-- Cucumber --> diff --git a/testing/indexer-test-ibm/pom.xml b/testing/indexer-test-ibm/pom.xml index 599761e657c782bab128ac69dd0f3945eaaacaf0..5fe05406e7e282d498ac755f731354a8d0cb7495 100644 --- a/testing/indexer-test-ibm/pom.xml +++ b/testing/indexer-test-ibm/pom.xml @@ -6,13 +6,13 @@ <parent> <groupId>org.opengroup.osdu</groupId> <artifactId>indexer-test</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-ibm</artifactId> - <version>0.0.2</version> + <version>0.10.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> @@ -38,7 +38,7 @@ <dependency> <groupId>org.opengroup.osdu.indexer</groupId> <artifactId>indexer-test-core</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> </dependency> <dependency> diff --git a/testing/pom.xml b/testing/pom.xml index 7ad59c09a01617bbcc5dcf2c747e467e8f68ecfd..e33b2a83643bab6e01eed2ccd6852fe69f15c484 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -18,7 +18,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.opengroup.osdu</groupId> <artifactId>indexer-test</artifactId> - <version>0.9.0-SNAPSHOT</version> + <version>0.10.0-SNAPSHOT</version> <description>Indexer Service Integration Test Root Project</description> <properties> <spring.version>5.1.19.RELEASE</spring.version> @@ -36,6 +36,9 @@ <modules> <module>indexer-test-core</module> <module>indexer-test-gcp</module> + <module>indexer-test-aws</module> + <module>indexer-test-azure</module> + <module>indexer-test-ibm</module> </modules> <repositories>