Skip to content
Snippets Groups Projects
Commit 4ad96d56 authored by Mikhail Piatliou (EPAM)'s avatar Mikhail Piatliou (EPAM) Committed by Oleksandr Kosse (EPAM)
Browse files

camelCase for helms [GONRG-5114]

parent 887c837d
No related branches found
No related tags found
1 merge request!353camelCase for helms [GONRG-5114]
Showing with 255 additions and 90 deletions
......@@ -14,6 +14,11 @@
# - OPENID_PROVIDER_URL
# - OPENID_PROVIDER_CLIENT_ID
# - OPENID_PROVIDER_CLIENT_SECRET
# (with datastore cleanup)
# - SCHEMA_BUCKET
# - DATASTORE_NAMESPACE
# - DATASTORE_KIND
# - ENABLE_CLEANUP
#
set -e
......@@ -31,20 +36,21 @@ bootstrap_schema_gettoken_onprem() {
--data-urlencode "scope=openid" \
--data-urlencode "client_id=${OPENID_PROVIDER_CLIENT_ID}" \
--data-urlencode "client_secret=${OPENID_PROVIDER_CLIENT_SECRET}" | jq -r ".id_token")"
export BEARER_TOKEN="Bearer ${ID_TOKEN}"
}
bootstrap_schema_gettoken_gcp() {
BEARER_TOKEN=$(gcloud auth print-identity-token --audiences="${AUDIENCES}")
export BEARER_TOKEN
export BEARER_TOKEN
}
bootstrap_schema_prechek_env() {
status_code=$(curl --retry 1 --location -globoff --request GET \
"${ENTITLEMENTS_HOST}/api/entitlements/v2/groups" \
--write-out "%{http_code}" --silent --output "/dev/null"\
status_code=$(curl --retry 1 --location -globoff --request GET "${ENTITLEMENTS_HOST}/api/entitlements/v2/groups" \
--write-out "%{http_code}" --silent --output "/dev/null" \
--header 'Content-Type: application/json' \
--header "data-partition-id: ${DATA_PARTITION}" \
--header "Authorization: ${BEARER_TOKEN}")
......@@ -62,7 +68,6 @@ bootstrap_schema_deploy_shared_schemas() {
python3 ./scripts/DeploySharedSchemas.py -u "${SCHEMA_URL}"/api/schema-service/v1/schemas/system
}
if [ "${ONPREM_ENABLED}" == "true" ]
then
source ./validate-env.sh "OPENID_PROVIDER_URL"
......@@ -91,7 +96,6 @@ else
fi
# Precheck entitlements
bootstrap_schema_prechek_env
# Deploy shared schemas
......
<!--- Configmap --->
# Configmap helm chart
This chart installs a configmap deployment on a [Kubernetes](https://kubernetes.io) cluster using [Helm](https://helm.sh) package manager.
## Prerequisites
The code was tested on **Kubernetes cluster** (v1.21.11) with **Istio** (1.12.6)
> It is possible to use other versions, but it hasn't been tested
### Operation system
The code works in Debian-based Linux (Debian 10 and Ubuntu 20.04) and Windows WSL 2. Also, it works but is not guaranteed in Google Cloud Shell. All other operating systems, including macOS, are not verified and supported.
### Packages
Packages are only needed for installation from a local computer.
* **HELM** (version: v3.7.1 or higher) [helm](https://helm.sh/docs/intro/install/)
* **Kubectl** (version: v1.21.0 or higher) [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
## Installation
First you need to set variables in **values.yaml** file using any code editor. Some of the values are prefilled, but you need to specify some values as well. You can find more information about them below.
### Common variables for GCP and Anthos implementation
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**dataPartitionId** | data partition id | string | - | yes
**entitlementsHost** | entitlements host | string | "http://entitlements" | yes
**javaOptions** | java options | string | "-Xms512M -Xmx1024M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45" | yes
**logLevel** | logging level | string | INFO | yes
**partitionHost** | partition host | string | "http://partition" | yes
**schemaTopicName** | topic for schema changes events | string | "schema-changed" | yes
**springProfilesActive** | active spring profile | string | gcp | yes
### GCP specific variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**googleAudiences** | your GCP client ID | string | - | yes
### Datastore cleanup and bootstrap schemas variables
> Datastore cleanup is used for cleaning Datastore Schema Entities if they are not present in Schema bucket
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**datastoreKind** | Datastore Kind for Schema | string | "system_schema_osm" | yes
**datastoreNamespace** | Datastore Namespace for Schema | string | "dataecosystem" | yes
**enableCleanup** | whether cleanup is enabled | boolean | false | yes
**schemaBucket** | name of the bucket with schemas | string | - | yes
**schemaHost** | schema host | string | "http://schema" | yes
### Config variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**appName** | name of the app | string | schema | yes
**configmap** | configmap to be used | string | schema-config | yes
**onPremEnabled** | whether on-prem is enabled | boolean | false | yes
### Install the helm chart
Run this command from within this directory:
```console
helm install gcp-schema-configmap .
```
## Uninstalling the chart
To uninstall the helm deployment:
```console
helm uninstall gcp-schema-configmap
```
[Move-to-Top](#configmap-helm-chart)
......@@ -2,20 +2,20 @@ apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: "{{ .Values.conf.app_name }}-bootstrap"
app: "{{ .Values.conf.appName }}-bootstrap"
name: "{{ .Values.conf.configmap }}-bootstrap"
namespace: "{{ .Release.Namespace }}"
data:
DATA_PARTITION: "{{ .Values.data.data_partition_id }}"
ONPREM_ENABLED: "{{ .Values.conf.on_prem_enabled }}"
ENABLE_CLEANUP: "{{ .Values.data.enable_cleanup }}"
SCHEMA_URL: "{{ .Values.data.schema_host }}"
ENTITLEMENTS_HOST: "{{ .Values.data.entitlements_host }}"
{{- if not .Values.conf.on_prem_enabled }}
AUDIENCES: "{{ .Values.data.google_audiences }}"
DATA_PARTITION: "{{ .Values.data.dataPartitionId }}"
ONPREM_ENABLED: "{{ .Values.conf.onPremEnabled }}"
ENABLE_CLEANUP: "{{ .Values.data.enableCleanup }}"
SCHEMA_URL: "{{ .Values.data.schemaHost }}"
ENTITLEMENTS_HOST: "{{ .Values.data.entitlementsHost }}"
{{- if not .Values.conf.onPremEnabled }}
AUDIENCES: "{{ .Values.data.googleAudiences }}"
{{- end }}
{{- if .Values.data.enable_cleanup }}
SCHEMA_BUCKET: "{{ .Values.data.schema_bucket }}"
DATASTORE_NAMESPACE: "{{ .Values.data.datastore_namespace }}"
DATASTORE_KIND: "{{ .Values.data.datastore_kind }}"
{{- if .Values.data.enableCleanup }}
SCHEMA_BUCKET: "{{ .Values.data.schemaBucket }}"
DATASTORE_NAMESPACE: "{{ .Values.data.datastoreNamespace }}"
DATASTORE_KIND: "{{ .Values.data.datastoreKind }}"
{{- end }}
......@@ -2,17 +2,17 @@ apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
name: "{{ .Values.conf.configmap }}"
namespace: "{{ .Release.Namespace }}"
data:
LOG_LEVEL: "{{ .Values.data.log_level }}"
ENTITLEMENTS_HOST: "{{ .Values.data.entitlements_host }}"
GCP_SCHEMA_CHANGED_TOPIC_NAME: "{{ .Values.data.gcp_schema_changed_topic_name }}"
PARTITION_HOST: "{{ .Values.data.partition_host }}"
SHARED_TENANT_NAME: "{{ .Values.data.shared_tenant_name }}"
SPRING_PROFILES_ACTIVE: "{{ .Values.data.spring_profiles_active }}"
_JAVA_OPTIONS: "{{ .Values.data.java_options }}"
{{- if not .Values.conf.on_prem_enabled }}
GOOGLE_AUDIENCES: "{{ .Values.data.google_audiences }}"
LOG_LEVEL: "{{ .Values.data.logLevel }}"
ENTITLEMENTS_HOST: "{{ .Values.data.entitlementsHost }}"
GCP_SCHEMA_CHANGED_TOPIC_NAME: "{{ .Values.data.schemaTopicName }}"
PARTITION_HOST: "{{ .Values.data.partitionHost }}"
SHARED_TENANT_NAME: "{{ .Values.data.dataPartitionId }}"
SPRING_PROFILES_ACTIVE: "{{ .Values.data.springProfilesActive }}"
_JAVA_OPTIONS: "{{ .Values.data.javaOptions }}"
{{- if not .Values.conf.onPremEnabled }}
GOOGLE_AUDIENCES: "{{ .Values.data.googleAudiences }}"
{{- end }}
data:
# common
entitlements_host: "http://entitlements"
gcp_schema_changed_topic_name: "schema-changed"
log_level: "INFO"
partition_host: "http://partition"
shared_tenant_name: ""
spring_profiles_active: "gcp"
dataPartitionId: ""
entitlementsHost: "http://entitlements"
javaOptions: "-Xms512M -Xmx1024M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45"
logLevel: "INFO"
partitionHost: "http://partition"
schemaTopicName: "schema-changed"
springProfilesActive: "gcp"
# gcp
google_audiences: ""
# bootstrap
enable_cleanup: false
data_partition_id: ""
schema_host: "http://schema"
# cleanup
schema_bucket: ""
datastore_namespace: "dataecosystem"
datastore_kind: "system_schema_osm"
java_options: "-Xms512M -Xmx1024M -XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitiatingHeapOccupancyPercent=45"
googleAudiences: ""
# Datastore cleanup and bootstrap schemas
datastoreKind: "system_schema_osm"
datastoreNamespace: "dataecosystem"
enableCleanup: false
schemaBucket: ""
schemaHost: "http://schema"
conf:
app_name: "schema"
appName: "schema"
configmap: "schema-config"
on_prem_enabled: false
onPremEnabled: false
<!--- Deploy --->
# Deploy helm chart
## Introduction
This chart installs a deployment on a [Kubernetes](https://kubernetes.io) cluster using [Helm](https://helm.sh) package manager.
## Prerequisites
The code was tested on **Kubernetes cluster** (v1.21.11) with **Istio** (1.12.6)
> It is possible to use other versions, but it hasn't been tested
### Operation system
The code works in Debian-based Linux (Debian 10 and Ubuntu 20.04) and Windows WSL 2. Also, it works but is not guaranteed in Google Cloud Shell. All other operating systems, including macOS, are not verified and supported.
### Packages
Packages are only needed for installation from a local computer.
* **HELM** (version: v3.7.1 or higher) [helm](https://helm.sh/docs/intro/install/)
* **Kubectl** (version: v1.21.0 or higher) [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl)
## Installation
Before installing deploy Helm chart you need to install [configmap Helm chart](../configmap).
First you need to set variables in **values.yaml** file using any code editor. Some of the values are prefilled, but you need to specify some values as well. You can find more information about them below.
### Common variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**requestsCpu** | amount of requested CPU | string | 0.1 | yes
**requestsMemory** | amount of requested memory| string | 1G | yes
**limitsCpu** | CPU limit | string | 1 | yes
**limitsMemory** | memory limit | string | 1.5G | yes
**image** | service image | string | - | yes
**imagePullPolicy** | when to pull image | string | IfNotPresent | yes
**serviceAccountName** | name of your service account | string | schema | yes
### Bootstrap variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**bootstrapLimitsCpu** | CPU limit | string | 0.2 | yes
**bootstrapLimitsMemory** | memory limit | string | 200M | yes
**bootstrapImage** | bootstrap image | string | - | yes
**bootstrapServiceAccountName** | bootstrap service account name | string | - | yes
### Config variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**appName** | name of the app | string | `schema` | yes
**configmap** | configmap to be used | string | `schema-config` | yes
**bootstrapSecretName** | secret for bootstrap | string | `datafier-secret` | yes
**domain** | your domain | string | - | yes
**minioSecretName** | secret for minio | string | `schema-minio-secret` | yes
**onPremEnabled** | whether on-prem is enabled | boolean | false | yes
**postgresSecretName** | secret for postgres | string | `schema-postgres-secret` | yes
**rabbitmqSecretName** | secret for rabbitmq | string | `rabbitmq-secret` | yes
### Install the helm chart
Run this command from within this directory:
```console
helm install gcp-schema-deploy .
```
## Uninstalling the Chart
To uninstall the helm deployment:
```console
helm uninstall gcp-schema-deploy
```
[Move-to-Top](#deploy-helm-chart)
......@@ -2,24 +2,24 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: "{{ .Values.conf.app_name }}-bootstrap"
name: "{{ .Values.conf.app_name }}-bootstrap"
app: "{{ .Values.conf.appName }}-bootstrap"
name: "{{ .Values.conf.appName }}-bootstrap"
namespace: "{{ .Release.Namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: "{{ .Values.conf.app_name }}-bootstrap"
app: "{{ .Values.conf.appName }}-bootstrap"
template:
metadata:
labels:
app: "{{ .Values.conf.app_name }}-bootstrap"
app: "{{ .Values.conf.appName }}-bootstrap"
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
containers:
- name: "{{ .Values.conf.app_name }}-bootstrap"
image: "{{ .Values.data.bootstrap_image }}"
- name: "{{ .Values.conf.appName }}-bootstrap"
image: "{{ .Values.data.bootstrapImage }}"
readinessProbe:
exec:
command:
......@@ -29,12 +29,12 @@ spec:
envFrom:
- configMapRef:
name: "{{ .Values.conf.configmap }}-bootstrap"
{{- if .Values.conf.on_prem_enabled }}
{{- if .Values.conf.onPremEnabled }}
- secretRef:
name: "{{ .Values.conf.bootstrap_secret_name }}"
name: "{{ .Values.conf.bootstrapSecretName }}"
{{- end }}
resources:
limits:
cpu: "{{ .Values.data.bootstrap_limits_cpu}}"
memory: "{{ .Values.data.bootstrap_limits_memory }}"
cpu: "{{ .Values.data.bootstrapLimitsCpu}}"
memory: "{{ .Values.data.bootstrapLimitsMemory }}"
serviceAccountName: "{{ .Values.data.bootstrapServiceAccountName }}"
......@@ -2,35 +2,35 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: "{{ .Values.conf.app_name }}"
name: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
name: "{{ .Values.conf.appName }}"
namespace: "{{ .Release.Namespace }}"
spec:
selector:
matchLabels:
app: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
replicas: 1
template:
metadata:
labels:
app: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
annotations:
rollme: {{ randAlphaNum 5 | quote }}
spec:
containers:
- name: "{{ .Values.conf.app_name }}"
- name: "{{ .Values.conf.appName }}"
image: "{{ .Values.data.image }}"
imagePullPolicy: "{{ .Values.data.imagePullPolicy }}"
envFrom:
- configMapRef:
name: "{{ .Values.conf.configmap }}"
{{- if .Values.conf.on_prem_enabled }}
{{- if .Values.conf.onPremEnabled }}
- secretRef:
name: "{{ .Values.conf.minio_secret_name }}"
name: "{{ .Values.conf.minioSecretName }}"
- secretRef:
name: "{{ .Values.conf.postgres_secret_name }}"
name: "{{ .Values.conf.postgresSecretName }}"
- secretRef:
name: "{{ .Values.conf.rabbitmq_secret_name }}"
name: "{{ .Values.conf.rabbitmqSecretName }}"
{{- end }}
securityContext:
allowPrivilegeEscalation: false
......@@ -39,9 +39,9 @@ spec:
- containerPort: 8080
resources:
requests:
cpu: "{{ .Values.data.requests_cpu }}"
memory: "{{ .Values.data.requests_memory }}"
cpu: "{{ .Values.data.requestsCpu }}"
memory: "{{ .Values.data.requestsMemory }}"
limits:
cpu: "{{ .Values.data.limits_cpu }}"
memory: "{{ .Values.data.limits_memory }}"
cpu: "{{ .Values.data.limitsCpu }}"
memory: "{{ .Values.data.limitsMemory }}"
serviceAccountName: "{{ .Values.data.serviceAccountName }}"
{{- if .Values.conf.on_prem_enabled }}
{{- if .Values.conf.onPremEnabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
......
apiVersion: v1
kind: Service
metadata:
name: "{{ .Values.conf.app_name }}"
name: "{{ .Values.conf.appName }}"
annotations:
{{- if not .Values.conf.on_prem_enabled }}
{{- if not .Values.conf.onPremEnabled }}
cloud.google.com/neg: '{"ingress": true}'
{{- end }}
namespace: "{{ .Release.Namespace }}"
labels:
app: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
spec:
ports:
- protocol: TCP
......@@ -16,4 +16,4 @@ spec:
targetPort: 8080
name: http
selector:
app: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: "{{ .Values.conf.app_name }}"
name: "{{ .Values.conf.appName }}"
namespace: "{{ .Release.Namespace }}"
spec:
hosts:
{{- if .Values.conf.domain }}
{{- if and .Values.conf.domain .Values.conf.onPremEnabled }}
- {{ printf "osdu.%s" .Values.conf.domain | quote }}
{{- else if .Values.conf.domain }}
- {{ .Values.conf.domain | quote }}
{{- else }}
- "*"
{{- end }}
......@@ -20,4 +22,4 @@ spec:
- destination:
port:
number: 80
host: "{{ .Values.conf.app_name }}.{{ .Release.Namespace }}.svc.cluster.local"
host: "{{ .Values.conf.appName }}.{{ .Release.Namespace }}.svc.cluster.local"
data:
requests_cpu: "0.1"
requests_memory: "1G"
limits_cpu: "1"
limits_memory: "1.5G"
bootstrap_limits_cpu: "0.2"
bootstrap_limits_memory: "200M"
bootstrap_image: ""
requestsCpu: "0.1"
requestsMemory: "1G"
limitsCpu: "1"
limitsMemory: "1.5G"
bootstrapLimitsCpu: "0.2"
bootstrapLimitsMemory: "200M"
bootstrapImage: ""
bootstrapServiceAccountName: ""
image: ""
imagePullPolicy: "IfNotPresent"
serviceAccountName: "schema"
conf:
app_name: "schema"
bootstrap_secret_name: "datafier-secret"
appName: "schema"
bootstrapSecretName: "datafier-secret"
configmap: "schema-config"
minio_secret_name: "schema-minio-secret"
on_prem_enabled: false
postgres_secret_name: "schema-postgres-secret"
rabbitmq_secret_name: "rabbitmq-secret"
domain: ""
minioSecretName: "schema-minio-secret"
onPremEnabled: false
postgresSecretName: "schema-postgres-secret"
rabbitmqSecretName: "rabbitmq-secret"
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