diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39aafc0074c87b622211d2e9f4e12bcb4cbb66ff..71fe930d41fae6045d67387b73e66646205f68fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,8 @@ variables: IBM_BUILD_SUBDIR: provider/crs-converter-ibm/crs-converter-ocp IBM_INT_TEST_PY_SUBDIR: testing/crs_converter_test_ibm IBM_INT_TEST_PY_FILE: run_test.py + IBM_HELM_CONFIG_PATH: devops/ibm/ibm-crs-conversion-config + IBM_HELM_DEPLOY_PATH: devops/ibm/ibm-crs-conversion-deploy include: - project: "osdu/platform/ci-cd-pipelines" diff --git a/devops/ibm/ibm-crs-conversion-config/.helmignore b/devops/ibm/ibm-crs-conversion-config/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..0e8a0eb36f4ca2c939201c0d54b5d82a1ea34778 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-config/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/devops/ibm/ibm-crs-conversion-config/Chart.yaml b/devops/ibm/ibm-crs-conversion-config/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2f414bab3d03a70d5e7171d809f60274c4e59158 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-config/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ibm-crs-conversion-config +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/ibm/ibm-crs-conversion-config/templates/_helpers.tpl b/devops/ibm/ibm-crs-conversion-config/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..a22fe81f0e6249f7a047babe38d24e3ec39937d5 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-config/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ibm-crs-conversion-config.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 "ibm-crs-conversion-config.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 "ibm-crs-conversion-config.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ibm-crs-conversion-config.labels" -}} +helm.sh/chart: {{ include "ibm-crs-conversion-config.chart" . }} +{{ include "ibm-crs-conversion-config.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ibm-crs-conversion-config.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ibm-crs-conversion-config.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ibm-crs-conversion-config.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ibm-crs-conversion-config.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/devops/ibm/ibm-crs-conversion-config/templates/configmap.yaml b/devops/ibm/ibm-crs-conversion-config/templates/configmap.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9a7e42aa3f0c7b4ad746eb4512875618a691d2b6 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-config/templates/configmap.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ .Values.conf.configmap }}" +data: +#log-and-common + LOG_LEVEL: "{{ .Values.data.logLevel }}" + LOG_PREFIX: "{{ .Values.data.logPrefix }}" + logging.level.org.opengroup.osdu: "{{ .Values.data.loggingLevelOsdu }}" + logging.level.org.springframework.web: "{{ .Values.data.loggingLevelSpring }}" + JAVA_APP_JAR: "{{ .Values.data.javaAppJar }}" + server.servlet.context-path: "{{ .Values.data.contextPath }}" + server.port: "{{ .Values.data.serverPort }}" + spring.main.allow-bean-definition-overriding: "{{ .Values.data.beanDefOverriding }}" + +#Authorization + osdu.entitlement.url: "http://{{ .Release.Name }}-ibm-entitlement-deploy:8080/api/entitlements/v2" + SIS_DATA: /home/jboss/data/SIS_DATA diff --git a/devops/ibm/ibm-crs-conversion-config/values.yaml b/devops/ibm/ibm-crs-conversion-config/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e1629a46d51a57f541a7b0343515d7009fdec23a --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-config/values.yaml @@ -0,0 +1,17 @@ +data: +# common + javaAppJar: "/deployments/*-spring-boot.jar" + serverPort: 8080 + contextPath: "/api/crs/converter" + +# log + logPrefix: schema + loggingLevelOsdu: debug + loggingLevelSpring: debug + +# ibm + beanDefOverriding: true + healthCheckUri: "/api/crs/converter/v2/info" + +conf: + configmap: "crs-conversion-config" diff --git a/devops/ibm/ibm-crs-conversion-deploy/.helmignore b/devops/ibm/ibm-crs-conversion-deploy/.helmignore new file mode 100644 index 0000000000000000000000000000000000000000..0e8a0eb36f4ca2c939201c0d54b5d82a1ea34778 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/.helmignore @@ -0,0 +1,23 @@ +# 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 +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/devops/ibm/ibm-crs-conversion-deploy/Chart.yaml b/devops/ibm/ibm-crs-conversion-deploy/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..dedf255f9760c7c95d96c4a9dc490af6660f6b4e --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: ibm-crs-conversion-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/ibm/ibm-crs-conversion-deploy/files/crs-conversion_post.sh b/devops/ibm/ibm-crs-conversion-deploy/files/crs-conversion_post.sh new file mode 100644 index 0000000000000000000000000000000000000000..b35b012b21ff86cb4aad749504af4d40ec60b00b --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/files/crs-conversion_post.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +CRS_CONVERSION_URL=http://${RELEASE_NAME}-ibm-crs-conversion-deploy:8080/api/crs/converter/v2/info +echo ${CRS_CONVERSION_URL} +while [[ "$(curl -s -k -L -o /dev/null -w ''%{http_code}'' http://${RELEASE_NAME}-ibm-crs-conversion-deploy:8080/api/crs/converter/v2/info)" != "200" ]]; do sleep 5; done +echo "CRS Conversion is ready" +echo ${RELEASE_NAMESPACE} +echo ${RELEASE_NAME} +crs_conversion_pod_name=$(oc get pods -o=name -n ${RELEASE_NAMESPACE} | grep 'crs-conversion-deploy' | sed "s/^.\{4\}//") +echo $crs_conversion_pod_name +oc rsync /data/crs-conversion-service/apachesis_setup $crs_conversion_pod_name:/home/jboss/data/ -n ${RELEASE_NAMESPACE} + diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/NOTES.txt b/devops/ibm/ibm-crs-conversion-deploy/templates/NOTES.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7cd9579f63b8149f32e5decd3c7d70b74035fcb --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/NOTES.txt @@ -0,0 +1,22 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} + {{- 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 "ibm-crs-conversion-deploy.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 --namespace {{ .Release.Namespace }} svc -w {{ include "ibm-crs-conversion-deploy.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "ibm-crs-conversion-deploy.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + 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 "ibm-crs-conversion-deploy.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT +{{- end }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/_helpers.tpl b/devops/ibm/ibm-crs-conversion-deploy/templates/_helpers.tpl new file mode 100644 index 0000000000000000000000000000000000000000..7b1007b866e0ab37ba3ce9712982f7e0caaaaf1b --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "ibm-crs-conversion-deploy.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 "ibm-crs-conversion-deploy.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 "ibm-crs-conversion-deploy.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ibm-crs-conversion-deploy.labels" -}} +helm.sh/chart: {{ include "ibm-crs-conversion-deploy.chart" . }} +{{ include "ibm-crs-conversion-deploy.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ibm-crs-conversion-deploy.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ibm-crs-conversion-deploy.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ibm-crs-conversion-deploy.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ibm-crs-conversion-deploy.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/configmap.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/configmap.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d7c54fbfaca396ab00be0b53a9f47496a84135d4 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/configmap.yaml @@ -0,0 +1,10 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} +data: + crs-conversion_post.sh: | + {{- tpl (.Files.Get "files/crs-conversion_post.sh" ) . | nindent 4 }} \ No newline at end of file diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/deployment.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/deployment.yaml new file mode 100644 index 0000000000000000000000000000000000000000..288083a6f1dccc0c33dee1d9e776635a9754160f --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/deployment.yaml @@ -0,0 +1,81 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "ibm-crs-conversion-deploy.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{ include "ibm-crs-conversion-deploy.selectorLabels" . | nindent 8 }} + sidecar.istio.io/inject: "{{ .Values.sidecarIstioInjected }}" + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + - name: sis-data + persistentVolumeClaim: + claimName: sis-data + initContainers: + - resources: {} + terminationMessagePath: /dev/termination-log + name: init-myservice + command: + - sh + - '-c' + - 'id; chown 185:185 /home/jboss/data;' + securityContext: {} + imagePullPolicy: Always + volumeMounts: + - name: sis-data + mountPath: /home/jboss/data + terminationMessagePolicy: File + image: busybox:stable + terminationMessagePath: /dev/termination-log + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + envFrom: + - configMapRef: + name: crs-conversion-config + volumeMounts: + - name: sis-data + mountPath: /home/jboss/data + ports: + - name: http + containerPort: 8080 + protocol: TCP + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/hpa.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/hpa.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7ffce34add91266a4c4ab33ac01b1d22f38a644f --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/hpa.yaml @@ -0,0 +1,28 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2beta1 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/ingress.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/ingress.yaml new file mode 100644 index 0000000000000000000000000000000000000000..28f91993a2f93bcad0b19dd25bf80b552a876f5a --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "ibm-crs-conversion-deploy.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/istio-authzpolicy.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/istio-authzpolicy.yaml new file mode 100644 index 0000000000000000000000000000000000000000..651dcd894e7da5f3052a8ca09899756575b892d4 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/istio-authzpolicy.yaml @@ -0,0 +1,22 @@ +apiVersion: security.istio.io/v1beta1 +kind: AuthorizationPolicy +metadata: + name: {{ .Values.conf.appName }}-authz-policy +spec: + selector: + matchLabels: + {{- include "ibm-crs-conversion-deploy.selectorLabels" . | nindent 6 }} + action: DENY + rules: + - from: + - source: + notRequestPrincipals: + - '*' + to: + - operation: + notPaths: + - '*/v2/api-docs' + - /api/crs/converter/v2/info + - /api/crs/converter/v3/info + - /api/crs/converter/_ah/liveness_check + - /api/crs/converter/_ah/readiness_check \ No newline at end of file diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/istio-virtualservice.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/istio-virtualservice.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f35821df773452185a92bb78e388ae12caad676c --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/istio-virtualservice.yaml @@ -0,0 +1,39 @@ +apiVersion: networking.istio.io/v1beta1 +kind: VirtualService +metadata: + name: {{ .Values.conf.appName }}-vs +spec: + gateways: + - osdu-gateway + hosts: + {{- if .Values.conf.domain }} + - {{ printf "osdu.%s" .Values.conf.domain | quote }} + {{- else if .Values.conf.loadbalancerIP}} + - {{ (index (lookup "v1" "Service" "istio-ingress" "istio-ingress").status.loadBalancer.ingress 0).ip }} + {{- else if .Values.conf.loadbalancerHN}} + - {{ (index (lookup "v1" "Service" "istio-ingress" "istio-ingress").status.loadBalancer.ingress 0).hostname }} + {{- else }} + - "*" + {{- end }} + http: + - corsPolicy: + allowCredentials: true + allowHeaders: + - Authorization + - Data-Partition-Id + - Correlation-Id + - Content-Type + allowMethods: + - POST + - GET + allowOrigins: + - prefix: '*' + maxAge: 60m + match: + - uri: + prefix: /api/crs/converter/ + route: + - destination: + host: {{ .Release.Name }}-ibm-crs-conversion-deploy + port: + number: 8080 diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/job.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/job.yaml new file mode 100644 index 0000000000000000000000000000000000000000..306472766c77808921065c2713fb21fc864149d5 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/job.yaml @@ -0,0 +1,43 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: crs-setup-job + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }}-setup-job + namespace: {{ .Release.Namespace }} +spec: + template: + spec: + activeDeadlineSeconds: 600 + containers: + - image: {{ .Values.jobimage.repository }}:{{ .Values.jobimage.tag }} + env: + - name: RELEASE_NAME + value: {{ .Release.Name }} + - name: RELEASE_NAMESPACE + value: {{ .Release.Namespace }} + command: ['sh', '-c', './scripts/crs-conversion_post.sh'] + imagePullPolicy: Always + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + volumeMounts: + - mountPath: "/scripts" + name: projected-scripts + readOnly: true + dnsPolicy: ClusterFirst + restartPolicy: OnFailure + serviceAccount: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + serviceAccountName: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + terminationGracePeriodSeconds: 30 + volumes: + - + name: projected-scripts + projected: + defaultMode: 0755 + sources: + - configMap: + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + dnsPolicy: ClusterFirst + restartPolicy: OnFailure + serviceAccount: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + serviceAccountName: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + terminationGracePeriodSeconds: 30 diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/pv.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/pv.yaml new file mode 100644 index 0000000000000000000000000000000000000000..5d988f211f13f3e84e6254c423a3ff6d7d965377 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/pv.yaml @@ -0,0 +1,17 @@ +{{ if .Values.persistentvolume.enabled }} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: sis-pv +spec: + capacity: + storage: 5Gi + volumeMode: Filesystem + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + storageClassName: {{ .Values.storageclass.file_storage }} + csi: + driver: efs.csi.aws.com + volumeHandle: {{ .Values.volumeHandle }} +{{ end }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/pvc.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/pvc.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f8dd804c731a00eb297ae1cfd2345482df6c5cd4 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/pvc.yaml @@ -0,0 +1,14 @@ +kind: PersistentVolumeClaim +apiVersion : v1 +metadata: + name: sis-data + namespace: {{ .Release.Namespace }} + finalizers: + - kubernetes.io/pvc-protection +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: 5Gi + storageClassName: {{ .Values.storageclass.file_storage }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/service.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/service.yaml new file mode 100644 index 0000000000000000000000000000000000000000..6387ed624055c0ea0cafde5b805e11b5c33bbbec --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "ibm-crs-conversion-deploy.fullname" . }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "ibm-crs-conversion-deploy.selectorLabels" . | nindent 4 }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/templates/serviceaccount.yaml b/devops/ibm/ibm-crs-conversion-deploy/templates/serviceaccount.yaml new file mode 100644 index 0000000000000000000000000000000000000000..37405d7afafe41c14f5c5f5b1e90b4f55e9fc80d --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/templates/serviceaccount.yaml @@ -0,0 +1,59 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": pre-install,pre-upgrade + "helm.sh/hook-weight": "-40" +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": pre-install,pre-upgrade + "helm.sh/hook-weight": "-40" +rules: + - apiGroups: + - "config.openshift.io" + - "security.istio.io" + - "networking.istio.io" + - "" + resources: + - "secrets" + - "pods/exec" + - "pods" + - "configmaps" + - "services" + - "requestauthentications" + - "envoyfilters" + verbs: + - "list" + - "get" + - "patch" + - "create" +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + labels: + {{- include "ibm-crs-conversion-deploy.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": pre-install,pre-upgrade + "helm.sh/hook-weight": "-40" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} +subjects: +- kind: ServiceAccount + name: {{ include "ibm-crs-conversion-deploy.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/devops/ibm/ibm-crs-conversion-deploy/values.yaml b/devops/ibm/ibm-crs-conversion-deploy/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..d93c6f029dd854b60d6d2a3d800cb36c631bb6d1 --- /dev/null +++ b/devops/ibm/ibm-crs-conversion-deploy/values.yaml @@ -0,0 +1,104 @@ +# Default values for ibm-crs-conversion-deploy. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 +sidecarIstioInjected: "true" +image: + repository: community.opengroup.org:5555/osdu/platform/system/reference/crs-conversion-service/os-crs-conversion-ibm + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "release-0.14-apr22" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" +initimage: + name: dependency-check + initrepository: community.opengroup.org:5555/osdu/platform/deployment-and-operations/ibm-osdu-provisioning/k8s-healthprobe + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "v2.0" +conf: + configmap: "crs-conversion-config" + appName: "crs-conversion" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +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 + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 3 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +storageclass: + file_storage: ibmc-file-gold + +persistentvolume: + enabled: true +jobimage: + repository: community.opengroup.org:5555/osdu/platform/deployment-and-operations/ibm-osdu-provisioning/crs-data + pullPolicy: Always +# Overrides the image tag whose default is the chart appVersion. + tag: "v6.0" + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +volumeHandle: fs-0ea287aa1e373023e