Skip to content
Snippets Groups Projects
Commit baa9666d authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

Merge branch 'gc-cim' into 'master'

GC CIm

See merge request !390
parents 3a076185 9f334cc2
No related branches found
No related tags found
1 merge request!390GC CIm
Pipeline #290818 failed
Showing
with 23 additions and 474 deletions
......@@ -240,7 +240,6 @@ BSD-2-Clause
The following software have components provided under the terms of this license:
- Apache Log4j Core (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core)
- Hamcrest (from http://hamcrest.org/JavaHamcrest/)
- Hamcrest Core (from http://hamcrest.org/, http://hamcrest.org/JavaHamcrest/, https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- Jodd Util (from https://util.jodd.org)
......@@ -380,6 +379,7 @@ The following software have components provided under the terms of this license:
- JUnit Vintage Engine (from http://junit.org/junit5/, https://junit.org/junit5/)
- Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta Dependency Injection (from https://github.com/eclipse-ee4j/injection-api)
- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms)
- Jakarta Servlet (from https://projects.eclipse.org/projects/ee4j.servlet)
- Jakarta Validation API (from https://beanvalidation.org)
......@@ -404,6 +404,7 @@ The following software have components provided under the terms of this license:
- Angus Activation Registries (from https://repo1.maven.org/maven2/org/eclipse/angus/angus-activation)
- Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta Dependency Injection (from https://github.com/eclipse-ee4j/injection-api)
- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms)
- Jakarta Servlet (from https://projects.eclipse.org/projects/ee4j.servlet)
- Jakarta Validation API (from https://beanvalidation.org)
......@@ -429,7 +430,6 @@ ISC
========================================================================
The following software have components provided under the terms of this license:
- Java Native Access Platform (from https://github.com/java-native-access/jna)
- Lucene Sandbox (from https://lucene.apache.org/, https://repo1.maven.org/maven2/org/apache/lucene/lucene-sandbox)
- Spring Security - Core (from http://spring.io/spring-security, https://repo1.maven.org/maven2/org/springframework/security/spring-security-core, https://spring.io/projects/spring-security, https://spring.io/spring-security)
......@@ -452,6 +452,7 @@ LGPL-2.1-or-later
The following software have components provided under the terms of this license:
- Java Native Access (from https://github.com/java-native-access/jna, https://github.com/twall/jna)
- Java Native Access Platform (from https://github.com/java-native-access/jna)
- Javassist (from http://www.javassist.org/, https://www.javassist.org/)
========================================================================
......@@ -582,7 +583,6 @@ public-domain
========================================================================
The following software have components provided under the terms of this license:
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- JBoss Logging 3 (from http://www.jboss.org)
- JSON in Java (from https://github.com/douglascrockford/JSON-java)
......
{
"java.configuration.updateBuildConfiguration": "automatic"
}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: os-unit-service
labels:
app: os-unit-service
spec:
ports:
- name: http
port: 80
targetPort: 8080
selector:
app: os-unit-service
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: os-unit-service
spec:
replicas: 1
template:
metadata:
labels:
app: os-unit-service
version: v1
spec:
containers:
- name: os-unit-service
envFrom:
- configMapRef:
name: os-service-config
image: gcr.io/opendes/os-unit-app
imagePullPolicy: Always
volumeMounts:
- name: shared-data
mountPath: /mnt/unit_catalogs
ports:
- containerPort: 8080
initContainers:
- name: "init-unit-catalog"
image: "{{ .Values.catalogs.repository }}:{{ .Values.catalogs.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: shared-data
mountPath: /mnt/unit_catalogs
......@@ -18,66 +18,16 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.7.25</slf4j.version>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<jackson-databind.version>2.14.0</jackson-databind.version>
<spring-security-core.version>6.0.7</spring-security-core.version>
</properties>
<dependencies>
<dependency>
<groupId>org.opengroup.osdu.unit-service</groupId>
<artifactId>unit-core</artifactId>
<artifactId>unit-core-plus</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback.contrib</groupId>
<artifactId>logback-json-classic</artifactId>
<version>0.1.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback.contrib</groupId>
<artifactId>logback-jackson</artifactId>
<version>0.1.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>
<build>
......@@ -89,6 +39,11 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<mainClass>
org.opengroup.osdu.unitservice.UomGkeApplication
</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
......
/*
Copyright 2020 Google LLC
Copyright 2020 EPAM Systems, Inc
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.unitservice;
import org.opengroup.osdu.unitservice.model.CatalogImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import java.io.FileReader;
@Configuration
@PropertySource("classpath:swagger.properties")
public class UnitCatalogGkeConfiguration {
@Bean
public CatalogImpl catalogImpl(@Value("${osdu.unit.catalog.filename}") String location) throws Exception {
try (FileReader reader = new FileReader(location)) {
return CatalogImpl.createCatalog(reader);
}
}
}
/*
Copyright 2020-2024 Google LLC
Copyright 2020-2024 EPAM Systems, Inc
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.unitservice.security;
import org.opengroup.osdu.unitservice.middleware.AuthenticationRequestFilter;
import org.opengroup.osdu.unitservice.middleware.AuthenticationService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
public class SecurityConfiguration {
private final AuthenticationRequestFilter authFilter;
private static final String[] AUTH_WHITELIST = {
"/",
"/v2/api-docs",
"/v3/api-docs",
"/swagger",
"/swagger-resources/**",
"/swagger-ui.html",
"/v3/info",
"**/v3/info",
"/v3/_ah/**",
"/api/unit/v3/info",
"/webjars/**",
"/_ah/**",
"/actuator/**",
"/error",
"/favicon.ico",
"/csrf",
"/error",
"/favicon.ico",
"/api/unit/actuator/health",
"**/swagger-ui/**/",
"**/api-docs/**",
"/unit",
"/health/**"
};
public SecurityConfiguration(AuthenticationService authenticationService) {
authFilter = new AuthenticationRequestFilter(authenticationService);
}
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests(
authorizeRequests ->
authorizeRequests
.requestMatchers(AUTH_WHITELIST)
.permitAll()
.anyRequest()
.authenticated())
.sessionManagement(
sessionManagement ->
sessionManagement.sessionCreationPolicy(SessionCreationPolicy.NEVER))
.addFilterBefore(authFilter, UsernamePasswordAuthenticationFilter.class)
.csrf(csrf -> csrf.disable());
return http.build();
}
@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
return web -> web.ignoring().requestMatchers(AUTH_WHITELIST);
}
}
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: os-unit-service
version: 0.1.0
1. Get the application URL by running these commands:
{{- if .Values.virtualservice.enabled }}
{{- range $host := .Values.virtualservice.hosts }}
{{- range $.Values.virtualservice.paths }}
http{{ if $.Values.virtualservice.tls }}s{{ end }}://{{ $host }}{{ . }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "os-unit-service.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "os-unit-service.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "os-unit-service.fullname" . }} -o jsonpath='{.status.loadBalancer.virtualservice[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "os-unit-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "os-unit-service.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "os-unit-service.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "os-unit-service.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: "os-unit-service"
labels:
app: "os-unit-service"
version: v2
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: "os-unit-service"
version: v2
template:
metadata:
labels:
app: "os-unit-service"
version: v2
spec:
volumes:
- name: shared-data
emptyDir: {}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.repository }}os-unit-app:{{ .Values.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
volumeMounts:
- name: shared-data
mountPath: /mnt/unit_catalogs
ports:
- name: http
containerPort: {{ .Values.service.http.targetPort }}
- name: https
containerPort: {{ .Values.service.https.targetPort }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
envFrom:
- configMapRef:
name: os-service-config
initContainers:
- name: "init-unit-catalog"
image: "{{ .Values.repository }}unit-catalogs:{{ .Values.tag }}"
imagePullPolicy: {{ .Values.image.catalogs.pullPolicy }}
volumeMounts:
- name: shared-data
mountPath: /mnt/unit_catalogs
imagePullSecrets:
- name: {{ .Values.image.imagePullSecrets }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: "os-unit-service"
labels:
app: "os-unit-service"
name: "os-unit-service"
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.http.port }}
targetPort: {{ .Values.service.http.targetPort }}
name: http
- port: {{ .Values.service.https.port }}
targetPort: {{ .Values.service.https.targetPort }}
name: https
selector:
app: "os-unit-service"
\ No newline at end of file
{{- if .Values.virtualservice.enabled -}}
{{- $fullName := include "os-unit-service.fullname" . -}}
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "os-unit-service.name" . }}
helm.sh/chart: {{ include "os-unit-service.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
hosts:
- "*"
gateways:
- os-osdu-gateway
http:
- match:
- uri:
prefix: {{ .Values.virtualservice.prefix }}
route:
- destination:
port:
number: {{ .Values.virtualservice.port }}
host: {{ $fullName }}
{{- end }}
# Default values for unit-gke.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
repository: xyz
image:
pullPolicy: Always
imagePullSecrets: gcr
catalogs:
pullPolicy: Always
imagePullSecrets: gcr
nameOverride: ""
fullnameOverride: ""
service:
type: ClusterIP
http:
port: 80
targetPort: 8080
https:
port: 443
targetPort: 8443
virtualservice:
enabled: true
port: 80
prefix: /api/unit
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
......@@ -4,7 +4,7 @@ ARG PORT
ENV PORT $PORT
# Copy the jar to the production image from the builder stage.
COPY unit-core-plus/target/unit-core-plus-*.jar unit.jar
COPY unit-core-plus/target/unit-core-plus-*-spring-boot.jar unit.jar
COPY data/unit_catalog_v2.json /mnt/unit_catalogs/unit_catalog_v2.json
# Add a non-root user
......
......@@ -79,19 +79,23 @@
</dependencies>
<build>
<!-- for hot reload of the web application-->
<outputDirectory>
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
</outputDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<mainClass>
org.opengroup.osdu.unitservice.UomApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>spring-boot</classifier>
<mainClass>
org.opengroup.osdu.unitservice.UomApplication
</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
......@@ -100,7 +104,6 @@
<redirectTestOutputToFile>true</redirectTestOutputToFile>
</configuration>
</plugin>
</plugins>
</build>
......
......@@ -17,10 +17,8 @@
package org.opengroup.osdu.unitservice.security;
import org.apache.tomcat.util.buf.EncodedSolidusHandling;
import org.opengroup.osdu.unitservice.middleware.AuthenticationRequestFilter;
import org.opengroup.osdu.unitservice.middleware.AuthenticationService;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
......
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