From 693e2fa9ce5d9775581a02d2d5f01503766ef945 Mon Sep 17 00:00:00 2001 From: Oleksii Tsyganov <oleksii_tsyganov@epam.com> Date: Thu, 17 Jun 2021 08:39:06 +0300 Subject: [PATCH] Added helm charts --- .gitlab-ci.yml | 1 + devops/gcp/configmap/Chart.yaml | 20 ++++++++++ .../templates/partition-variables.yml | 13 +++++++ devops/gcp/configmap/values.yaml | 10 +++++ devops/gcp/deploy/Chart.yaml | 20 ++++++++++ .../gcp/deploy/templates/partition-deploy.yml | 38 +++++++++++++++++++ .../deploy/templates/partition-service.yml | 15 ++++++++ .../templates/partition-virtual-service.yml | 19 ++++++++++ devops/gcp/deploy/values.yaml | 15 ++++++++ 9 files changed, 151 insertions(+) create mode 100644 devops/gcp/configmap/Chart.yaml create mode 100644 devops/gcp/configmap/templates/partition-variables.yml create mode 100644 devops/gcp/configmap/values.yaml create mode 100644 devops/gcp/deploy/Chart.yaml create mode 100644 devops/gcp/deploy/templates/partition-deploy.yml create mode 100644 devops/gcp/deploy/templates/partition-service.yml create mode 100644 devops/gcp/deploy/templates/partition-virtual-service.yml create mode 100644 devops/gcp/deploy/values.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f626195e8..6ed7dde91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,6 +18,7 @@ variables: OSDU_GCP_ENV_VARS: AUTHORIZE_API=$OSDU_GCP_AUTHORIZE_API,GOOGLE_CLOUD_PROJECT=$OSDU_GCP_PROJECT,GOOGLE_AUDIENCES=$GOOGLE_AUDIENCE,PARTITION_ADMIN_ACCOUNT=$OSDU_GCP_SERVICE_ACCOUNT MAVEN_PROJECTS: "-pl partition-core,provider/partition-gcp" OSDU_GCP_TEST_SUBDIR: testing/$OSDU_GCP_SERVICE-test-$OSDU_GCP_VENDOR + OSDU_GCP_HELM_PACKAGE_CHARTS: "devops/gcp/deploy devops/gcp/configmap" include: - project: "osdu/platform/ci-cd-pipelines" diff --git a/devops/gcp/configmap/Chart.yaml b/devops/gcp/configmap/Chart.yaml new file mode 100644 index 000000000..d423a9dc2 --- /dev/null +++ b/devops/gcp/configmap/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: partition-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. +appVersion: 1.16.0 diff --git a/devops/gcp/configmap/templates/partition-variables.yml b/devops/gcp/configmap/templates/partition-variables.yml new file mode 100644 index 000000000..d0073e7b7 --- /dev/null +++ b/devops/gcp/configmap/templates/partition-variables.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + labels: + app: "{{ .Values.conf.app_name }}" + name: "{{ .Values.conf.configmap }}" + namespace: "{{ .Release.Namespace }}" +data: + GOOGLE_CLOUD_PROJECT: "{{ .Values.data.google_cloud_project }}" + PARTITION_ADMIN_ACCOUNT: "{{ .Values.data.partition_admin_account }}" + GOOGLE_AUDIENCES: "{{ .Values.data.google_audiences }}" + KEY_RING: "{{ .Values.data.key_ring }}" + LOG_LEVEL: "{{ .Values.data.log_level }}" diff --git a/devops/gcp/configmap/values.yaml b/devops/gcp/configmap/values.yaml new file mode 100644 index 000000000..6ae6d4b6a --- /dev/null +++ b/devops/gcp/configmap/values.yaml @@ -0,0 +1,10 @@ +data: + google_cloud_project: "" + partition_admin_account: "" + google_audiences: "" + key_ring: "" + log_level: "" + +conf: + configmap: "partition-config" + app_name: "partition" diff --git a/devops/gcp/deploy/Chart.yaml b/devops/gcp/deploy/Chart.yaml new file mode 100644 index 000000000..18597150b --- /dev/null +++ b/devops/gcp/deploy/Chart.yaml @@ -0,0 +1,20 @@ +apiVersion: v2 +name: partition-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. +appVersion: 1.16.0 diff --git a/devops/gcp/deploy/templates/partition-deploy.yml b/devops/gcp/deploy/templates/partition-deploy.yml new file mode 100644 index 000000000..7640b812e --- /dev/null +++ b/devops/gcp/deploy/templates/partition-deploy.yml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "{{ .Values.conf.app_name }}" + namespace: {{ .Release.Namespace }} +spec: + replicas: 1 + selector: + matchLabels: + app: "{{ .Values.conf.app_name }}" + template: + metadata: + labels: + app: "{{ .Values.conf.app_name }}" + spec: + containers: + - image: "{{ .Values.data.image }}" + imagePullPolicy: Always + name: "{{ .Values.conf.app_name }}" + env: + - name: "ACCEPT_HTTP" + value: "true" + 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/partition-service.yml b/devops/gcp/deploy/templates/partition-service.yml new file mode 100644 index 000000000..d507d6833 --- /dev/null +++ b/devops/gcp/deploy/templates/partition-service.yml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: "{{ .Values.conf.app_name }}" + namespace: {{ .Release.Namespace }} + annotations: + cloud.google.com/neg: '{"ingress": true}' +spec: + ports: + - port: 80 + targetPort: 8080 + protocol: TCP + name: http + selector: + app: "{{ .Values.conf.app_name }}" diff --git a/devops/gcp/deploy/templates/partition-virtual-service.yml b/devops/gcp/deploy/templates/partition-virtual-service.yml new file mode 100644 index 000000000..4ac78d87c --- /dev/null +++ b/devops/gcp/deploy/templates/partition-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/partition + 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 000000000..eb04941e6 --- /dev/null +++ b/devops/gcp/deploy/values.yaml @@ -0,0 +1,15 @@ +# Default values for partition-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: "partition-config" + app_name: "partition" -- GitLab