diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 93ff8fb16735b0769c699cbd8b556ce222277cef..bf37d049533a55ccdc3bdc7626ee9b7f1fe3f0b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -16,6 +16,7 @@ variables: OSDU_GCP_APPLICATION_NAME: os-legal OSDU_GCP_ENV_VARS: ENABLE_FULL_BUCKET_NAME=$ENABLE_FULL_BUCKET_NAME,PROJECT_ID=$OSDU_GCP_PROJECT,AUTHORIZE_API=$OSDU_GCP_AUTHORIZE_API,AUDIENCES=$GOOGLE_AUDIENCE,GOOGLE_AUDIENCES=$GOOGLE_AUDIENCE,PARTITION_API=$OSDU_GCP_PARTITION_API,REDIS_GROUP_HOST=$REDIS_GROUP_HOST,REDIS_STORAGE_HOST=$REDIS_STORAGE_HOST,LEGAL_HOSTNAME=$OSDU_GCP_LEGAL_HOSTNAME --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/legal-ibm IBM_INT_TEST_SUBDIR: testing/legal-test-ibm @@ -54,6 +55,11 @@ include: ref: "master" file: 'cloud-providers/gcp.yml' + - project: 'osdu/platform/ci-cd-pipelines' + ref: "master" + file: 'publishing/pages.yml' + compile-and-unit-test: variables: GOOGLE_CLOUD_PROJECT: opendes-evt + diff --git a/devops/gcp/configmap/Chart.yaml b/devops/gcp/configmap/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..3f0f7b646829979eff5838ef480ae6a8f1d8f66e --- /dev/null +++ b/devops/gcp/configmap/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gcp-legal-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/legal-variables.yml b/devops/gcp/configmap/templates/legal-variables.yml new file mode 100644 index 0000000000000000000000000000000000000000..f989f53363b11f60c49b1c50c3d056856af4bd4a --- /dev/null +++ b/devops/gcp/configmap/templates/legal-variables.yml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: {{ .Values.conf.app_name }} + name: {{ .Values.conf.configmap }} + namespace: {{ .Release.Namespace }} +data: + AUTHORIZE_API: "http://{{ .Values.conf.ent_name }}{{ .Values.data.authorize_api }}" + LOG_LEVEL: "{{ .Values.data.log_level }}" + ENABLE_FULL_BUCKET_NAME: "{{ .Values.data.enable_full_bucket_name }}" + PROJECT_ID: "{{ .Values.data.project_id }}" + AUDIENCES: "{{ .Values.data.audiences }}" + REDIS_GROUP_HOST: "{{ .Values.data.redis_group_host }}" + REDIS_STORAGE_HOST: "{{ .Values.data.redis_storage_host }}" + ACCEPT_HTTP: "{{ .Values.data.accept_http }}" +--- diff --git a/devops/gcp/configmap/values.yaml b/devops/gcp/configmap/values.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2e8b568accd4494eddc30d1ce8f90d3023ed9860 --- /dev/null +++ b/devops/gcp/configmap/values.yaml @@ -0,0 +1,18 @@ +# Default values for legal-configmap. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +data: + authorize_api: ".default.svc.cluster.local/entitlements/v1/" + log_level: "INFO" + enable_full_bucket_name: "true" + project_id: "" + audiences: "519000754840-r12fqsd3e12aqep8c5f3j3t3emv8jeg1.apps.googleusercontent.com" + redis_group_host: "" + redis_storage_host: "" + accept_http: "true" + +conf: + ent_name: "" + configmap: "legal-config" + app_name: "legal" diff --git a/devops/gcp/deploy/Chart.yaml b/devops/gcp/deploy/Chart.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a414dfd27bffc01863845895a8f7011d16da9db9 --- /dev/null +++ b/devops/gcp/deploy/Chart.yaml @@ -0,0 +1,24 @@ +apiVersion: v2 +name: gcp-legal-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/legal-deploy.yml b/devops/gcp/deploy/templates/legal-deploy.yml new file mode 100644 index 0000000000000000000000000000000000000000..b7398c42cff37d4f4f1057f6500bb830d9a93065 --- /dev/null +++ b/devops/gcp/deploy/templates/legal-deploy.yml @@ -0,0 +1,74 @@ +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.legal.image }}" + env: + - name: "AUTHORIZE_API" + valueFrom: + configMapKeyRef: + key: AUTHORIZE_API + name: "{{ .Values.conf.configmap }}" + - name: "LOG_LEVEL" + valueFrom: + configMapKeyRef: + key: LOG_LEVEL + name: "{{ .Values.conf.configmap }}" + - name: "ENABLE_FULL_BUCKET_NAME" + valueFrom: + configMapKeyRef: + key: ENABLE_FULL_BUCKET_NAME + name: "{{ .Values.conf.configmap }}" + - name: "PROJECT_ID" + valueFrom: + configMapKeyRef: + key: PROJECT_ID + name: "{{ .Values.conf.configmap }}" + - name: "AUDIENCES" + valueFrom: + configMapKeyRef: + key: AUDIENCES + name: "{{ .Values.conf.configmap }}" + - name: "REDIS_GROUP_HOST" + valueFrom: + configMapKeyRef: + key: REDIS_GROUP_HOST + name: "{{ .Values.conf.configmap }}" + - name: "REDIS_STORAGE_HOST" + valueFrom: + configMapKeyRef: + key: REDIS_STORAGE_HOST + name: "{{ .Values.conf.configmap }}" + - name: "ACCEPT_HTTP" + valueFrom: + configMapKeyRef: + key: ACCEPT_HTTP + name: "{{ .Values.conf.configmap }}" + securityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + ports: + - containerPort: 8080 + resources: + requests: + cpu: "{{ .Values.legal.requests_cpu }}" + memory: "{{ .Values.legal.requests_memory }}" + limits: + cpu: "{{ .Values.legal.limits_cpu }}" + memory: "{{ .Values.legal.limits_memory }}" + serviceAccountName: "{{ .Values.legal.serviceAccountName }}" diff --git a/devops/gcp/deploy/templates/legal-service.yml b/devops/gcp/deploy/templates/legal-service.yml new file mode 100644 index 0000000000000000000000000000000000000000..05eec1cd5b2b60b20d42bb396ead804f3eda1a56 --- /dev/null +++ b/devops/gcp/deploy/templates/legal-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/legal-virtual-service.yml b/devops/gcp/deploy/templates/legal-virtual-service.yml new file mode 100644 index 0000000000000000000000000000000000000000..b9150177c0a65b316cf7d79f26b7bfec2bcf69fe --- /dev/null +++ b/devops/gcp/deploy/templates/legal-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/legal" + 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..dab09cacb0bc1f5019df26b8ae34ce30a2b682e8 --- /dev/null +++ b/devops/gcp/deploy/values.yaml @@ -0,0 +1,16 @@ +# Default values for legal-deploy. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +legal: + requests_cpu: "0.25" + requests_memory: "128M" + limits_cpu: "0.5" + limits_memory: "256M" + serviceAccountName: "" + image: "" + +conf: + configmap: "legal-config" + app_name: "legal" +