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/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"