Skip to content
Snippets Groups Projects
Commit 9c7602f3 authored by Sherman Yang's avatar Sherman Yang
Browse files

Merge branch 'aks' into 'master'

Port latest Delfi updates to OSDU

See merge request !2
parents 7dac622a a120b6e5
No related branches found
No related tags found
1 merge request!2Port latest Delfi updates to OSDU
Pipeline #11077 failed
Showing
with 182 additions and 204 deletions
......@@ -25,7 +25,7 @@ mvn clean install
```
- Run application with command
```bash
java -Dclient-id=${aad_client_id} -jar provider/crs-converter-azure/crs-converter-aks/target/crs-converter-aks-1.0.0.jar
java -jar provider/crs-converter-azure/crs-converter-aks/target/crs-converter-aks-1.0.0.jar
```
### Debug CRS Conversion Service locally
......@@ -83,8 +83,6 @@ requires the following environment variables:
| Variable | Contents |
|----------|----------|
| ENTITLEMENT_URL | Required |
| ESRI_DATA_PATH | Required, e.g. /C/osdu-delfi/crs-conversion-service/ |
| client-id | Required, Azure AAD client id |
## GCP
......
......@@ -62,7 +62,10 @@
<artifactId>jwks-rsa</artifactId>
<version>0.11.0</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<!-- lombok dependencies -->
<dependency>
<groupId>org.projectlombok</groupId>
......@@ -96,6 +99,11 @@
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
......
......@@ -11,13 +11,12 @@ import javax.validation.constraints.NotEmpty;
@Data
@ApiModel(description = Constants.SWAGGER_GEO_JSON_CONVERT_REQUEST_DESCR)
public class ConvertGeoJsonRequest {
@ApiModelProperty(value = Constants.SWAGGER_GEO_JSON_FEATURE_COLLECTION, required = true,
example = Constants.SWAGGER_GEO_JSON_FEATURE_COLLECTION_EXAMPLE)
@ApiModelProperty(value = Constants.SWAGGER_GEO_JSON_FEATURE_COLLECTION, required = true)
private GeoJsonFeatureCollection featureCollection;
@NotEmpty
@ApiModelProperty(value = Constants.SWAGGER_TARGET_CRS, required = true, dataType = "String",
example = Constants.SWAGGER_TARGET_CRS_EXAMPLE)
example = Constants.SWAGGER_TARGET_CRS_GEO_EXAMPLE)
private String toCRS;
@ApiModelProperty(value = Constants.SWAGGER_TARGET_Z_UNIT, required = true, dataType = "String",
......
......@@ -18,11 +18,12 @@ public class ConvertPointsRequest {
@NotEmpty
@ApiModelProperty(value = Constants.SWAGGER_TARGET_CRS, required = true, dataType = "String",
example = Constants.SWAGGER_TARGET_CRS_EXAMPLE)
example = Constants.SWAGGER_CONVERT_TARGET_CRS_EXAMPLE)
private String toCRS;
@Valid
@NotEmpty
@ApiModelProperty(value = Constants.SWAGGER_LIST_OF_POINTS_TO_BE_CONVERTED, required = true)
@ApiModelProperty(value = Constants.SWAGGER_LIST_OF_POINTS_TO_BE_CONVERTED, required = true,
example = Constants.SWAGGER_LIST_OF_POINTS_TO_BE_CONVERTED_EXAMPLE)
private List<Point> points;
}
......@@ -28,7 +28,7 @@ public class ConvertTrajectoryRequest {
@NotEmpty
@ApiModelProperty(
value = Constants.SWAGGER_TRJ_REQ_CRS, required = true, dataType = "String",
example = Constants.SWAGGER_TARGET_CRS_EXAMPLE)
example = Constants.SWAGGER_TARGET_CRS_EX)
private String trajectoryCRS;
@JsonProperty("azimuthReference")
......@@ -38,17 +38,18 @@ public class ConvertTrajectoryRequest {
example = Constants.SWAGGER_TRJ_REQ_AZIMUTH_REF_EXAMPLE)
private String azimuthReference;
@NotEmpty
@JsonProperty("unitXY")
@ApiModelProperty(
value = Constants.SWAGGER_TRJ_REQ_UNIT_XY, dataType = "String",
example = Constants.SWAGGER_TRJ_REQ_UNIT_EXAMPLE)
example = Constants.SWAGGER_TRJ_REQ_UNIT_XY_EXAMPLE)
private String unitXY;
@JsonProperty("unitZ")
@NotEmpty
@ApiModelProperty(
value = Constants.SWAGGER_TRJ_REQ_UNIT_Z, required = true, dataType = "String",
example = Constants.SWAGGER_TRJ_REQ_UNIT_EXAMPLE)
example = Constants.SWAGGER_TRJ_REQ_UNIT_Z_EXAMPLE)
private String unitZ;
@JsonProperty("referencePoint")
......@@ -58,7 +59,8 @@ public class ConvertTrajectoryRequest {
@JsonProperty("inputStations")
@Valid
@NotEmpty
@ApiModelProperty(value = Constants.SWAGGER_TRJ_REQ_LIST_OF_INPUT_STATIONS, required = true)
@ApiModelProperty(value = Constants.SWAGGER_TRJ_REQ_LIST_OF_INPUT_STATIONS,
example = Constants.SWAGGER_TRJ_REQ_LIST_OF_INPUT_STATIONS_EX, required = true)
private List<TrajectoryStationIn> inputStations;
@JsonProperty("method")
......@@ -75,7 +77,8 @@ public class ConvertTrajectoryRequest {
private String inputKind;
@JsonProperty("interpolate")
@ApiModelProperty(value=Constants.SWAGGER_TRJ_REQ_INTERPOLATE, dataType = "Boolean")
@ApiModelProperty(value=Constants.SWAGGER_TRJ_REQ_INTERPOLATE,
example = Constants.SWAGGER_TRJ_REQ_INTERPOLATE_EX, dataType = "Boolean")
private boolean interpolate;
@Override
......
......@@ -50,7 +50,7 @@ public final class Constants {
public static final String SWAGGER_CONVERSION_RESPONSE = "Response of a CRS conversion/transformation operation";
public static final String SWAGGER_CONVERT_AUDIT = "The list of operations performed on the points as a list of strings";
public static final String SWAGGER_TARGET_Z_UNIT = "Optional: the target Z-unit for the z-axis scaling.";
public static final String SWAGGER_TARGET_Z_UNIT_EXAMPLE = "{\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"scaleOffset\":{\"offset\":0.0,\"scale\":1.0},\"symbol\":\"m\",\"type\":\"USO\"}";
public static final String SWAGGER_TARGET_Z_UNIT_EXAMPLE = "\"{\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"scaleOffset\":{\"offset\":0.0,\"scale\":1.0},\"symbol\":\"m\",\"type\":\"USO\"}\"";
public static final String SWAGGER_GEO_JSON_CONVERT_TITLE = "Convert a GeoJSON or AnyCrsGeoJson structure";
public static final String SWAGGER_GEO_JSON_CONVERT_NOTES = "Convert a GeoJSON or AnyCrsGeoJson structure";
......@@ -130,6 +130,7 @@ public final class Constants {
public static final String SWAGGER_TRJ_REQ_INPUT_KIND = "The kind of input; one of MD_Inclination_Azimuth (default), MD_X_Y_Z, MD_dX_dY_dZ, X_Y_Z, dX_dY_dZ. MD stands for measured depth; MD_X_Y_Z/X_Y_Z stand for absolute coordinates in the reference CRS, MD_dX_dY_dZ/dX_dY_dZ stand for deviations relative to the reference point.";
public static final String SWAGGER_TRJ_REQ_INPUT_KIND_EXAMPLE = "MD_Inclination_Azimuth";
public static final String SWAGGER_TRJ_REQ_INTERPOLATE = "Perform trajectory interpolation on demand; default is true.";
public static final String SWAGGER_TRJ_REQ_INTERPOLATE_EX = "True";
public static final String SWAGGER_TRJ_STN_IN_DESCRIPTION = "Input trajectory station record; context is provided by the container.";
public static final String SWAGGER_MD = "MD (measured depth) from vertical reference point in 'unitZ'.";
......
FROM openjdk:8-jdk-alpine
COPY provider/crs-converter-azure/crs-converter-aks/target/crs-converter-aks-1.0.0.jar /app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
# Pipeline Support Commands
```bash
AZURE_SERVICE="crs-conversion-service"
REPO_BRANCH="master"
TAG="latest"
PARTIAL=${REPO_BRANCH/\//-}
BRANCH=${PARTIAL/./-}
echo "--set image.branch=$BRANCH --set image.tag=$TAG"
# Install the Service
helm upgrade -i osdu-gitlab-$AZURE_SERVICE chart --set image.branch=$BRANCH --set image.tag=$TAG
pod=$(kubectl get pod |grep $AZURE_SERVICE | tail -1 | awk '{print $1}')
status=$(kubectl wait --for=condition=Ready pod/$pod --timeout=60s)
if [[ "$status" != *"met"* ]]; then echo "POD didn't start correctly" ; exit 1 ; fi
```
apiVersion: v2
name: crs-conversion-service
appVersion: "latest"
description: Helm Chart for installing crs-conversion-service service.
version: 0.1.0
type: application
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}
namespace: osdu
spec:
replicas: {{ .Values.global.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
aadpodidbinding: osdu-identity
spec:
volumes:
- name: azure-keyvault
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: azure-keyvault
- name: shared-data
emptyDir: {}
imagePullSecrets:
- name: {{ .Values.image.imagePullSecrets }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.app.repository }}:{{ .Values.app.tag }}"
imagePullPolicy: {{ .Values.app.pullPolicy }}
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /api/crs/converter/_ah/readiness_check
port: 8080
volumeMounts:
- name: azure-keyvault
mountPath: "/mnt/azure-keyvault"
readOnly: true
env:
- name: spring_application_name
value: crs-conversion-service
- name: server.servlet.contextPath
value: /api/crs/converter/
- name: server_port
value: "8080"
- name: ACCEPT_HTTP # TEMPORARY UNTIL HTTPS
value: "true"
- name: KEYVAULT_URI
valueFrom:
configMapKeyRef:
name: osdu-svc-properties
key: ENV_KEYVAULT
- name: AZURE_TENANT_ID
valueFrom:
configMapKeyRef:
name: osdu-svc-properties
key: ENV_TENANT_ID
- name: client-id
valueFrom:
secretKeyRef:
name: clientid
key: clientid
- name: AZURE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: clientpassword
key: clientpassword
- name: aad_client_id
valueFrom:
secretKeyRef:
name: appid
key: appid
- name: appinsights_key
valueFrom:
secretKeyRef:
name: appinsights
key: appinsights
- name: ENTITLEMENT_URL
value: http://entitlements-azure/entitlements/v1
- name: azure_istioauth_enabled
value: "true"
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
namespace: osdu
spec:
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 8080
selector:
app: {{ .Chart.Name }}
global:
replicaCount: 1
image:
imagePullSecrets: acr
app:
repository: community.opengroup.org:5555/osdu/platform/ref-and-helper/crs-conversion-app
branch: master
tag: latest
pullPolicy: Always
......@@ -8,18 +8,20 @@
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.9.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<spring-boot-version>2.2.9.RELEASE</spring-boot-version>
<springfox-version>2.9.2</springfox-version>
<powermock.version>2.0.6</powermock.version>
<slf4j.version>1.7.25</slf4j.version>
<docker.image.prefix>org.opengroup.osdu</docker.image.prefix>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<os-core-common.version>0.3.3</os-core-common.version>
<os-core-common.version>0.3.8</os-core-common.version>
<snakeyaml.version>1.26</snakeyaml.version>
</properties>
<licenses>
......@@ -65,18 +67,27 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>${snakeyaml.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
<version>${spring-boot-version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring-boot-version}</version>
<scope>test</scope>
</dependency>
......
FROM openjdk:8-jdk-alpine
# Path to the jar file. E.g. provider/crs-converter-azure/crs-converter-aks/target/crs-converter-aks-*.jar
ARG CRS_CONVERTER_JAR_PATH
ARG ENTITLEMENT_URL
ENV ENTITLEMENT_URL=$ENTITLEMENT_URL
EXPOSE 8080
COPY $CRS_CONVERTER_JAR_PATH ./crs-converter/crs-converter.jar
WORKDIR ./crs-converter
ENTRYPOINT ["java", "-jar", "crs-converter.jar"]
# 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 Kubernetes Helm chart for crs converter
name: crs-converter-aks
version: v2
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range $.Values.ingress.paths }}
http{{ if $.Values.ingress.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 "crs-converter-aks.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 "crs-converter-aks.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "crs-converter-aks.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[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 "crs-converter-aks.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 "crs-converter-aks.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 "crs-converter-aks.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 "crs-converter-aks.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: crs-converter-aks
namespace: {{ .Values.namespace }}
labels:
app: crs-converter-aks
version: v2
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: crs-converter-aks
version: v2
template:
metadata:
labels:
app: crs-converter-aks
version: v2
spec:
containers:
- name: crs-converter
image: "{{ .Values.image.converter.repository }}:{{ .Values.image.converter.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.http.targetPort }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: ENTITLEMENT_URL
value: "{{.Values.service.entitlement.url}}"
- name: client-id
value: "{{.Values.service.client.url}}"
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 }}
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "crs-converter-aks.fullname" . -}}
{{- $ingressPaths := .Values.ingress.paths -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
app.kubernetes.io/name: {{ include "crs-converter-aks.name" . }}
crs-converter-aks.sh/chart: {{ include "crs-converter-aks.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . | quote }}
http:
paths:
{{- range $ingressPaths }}
- path: {{ . }}
backend:
serviceName: {{ $fullName }}
servicePort: http
{{- end }}
{{- end }}
{{- end }}
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