Skip to content
Snippets Groups Projects
Commit 5fd7a552 authored by Yevhenii Orlov (EPAM) [GCP]'s avatar Yevhenii Orlov (EPAM) [GCP] Committed by Oleksandr Kosse (EPAM)
Browse files

GONRG-5118 - Refactor variables with a camel case

parent a378a2a0
No related branches found
No related tags found
1 merge request!190GONRG-5118 - Refactor variables with a camel case
<!--- Configmap -->
# Configmap helm chart
## Introduction
This chart bootstraps 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
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**logLevel** | logging level | string | INFO | yes
### GCP variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**entitlementsHost** | entitlements service host address | string | `http://entitlements` | yes
### Config variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**appName** | name of the app | string | unit | yes
**configmap** | configmap name | string | unit-config | yes
### Install the helm chart
Run this command from within this directory:
```bash
helm install gcp-unit-configmap .
```
## Uninstalling the Chart
To uninstall the helm deployment:
```bash
helm uninstall gcp-unit-configmap
```
[Move-to-Top](#configmap-helm-chart)
......@@ -2,9 +2,9 @@ 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 }}"
ENTITLEMENT_URL: "{{ .Values.data.entitlement_url }}"
LOG_LEVEL: "{{ .Values.data.logLevel }}"
ENTITLEMENTS_HOST: "{{ .Values.data.entitlementsHost }}"
......@@ -3,9 +3,9 @@
# Declare variables to be passed into your templates.
data:
log_level: "INFO"
entitlement_url: "http://entitlements/api/entitlements/v2/"
logLevel: "INFO"
entitlementsHost: "http://entitlements"
conf:
appName: "unit"
configmap: "unit-config"
app_name: "unit"
<!--- Deploy -->
# Deploy helm chart
## Introduction
This chart bootstraps 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
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 | 256M | yes
**limitsCpu** | CPU limit | string | 1 | yes
**limitsMemory** | memory limit | string | 1G | yes
**serviceAccountName** | name of your service account | string | unit | yes
**imagePullPolicy** | when to pull image | string | IfNotPresent | yes
**image** | service image | string | - | yes
### Config variables
| Name | Description | Type | Default |Required |
|------|-------------|------|---------|---------|
**appName** | name of the app | string | `unit` | yes
**configmap** | configmap to be used | string | `unit-config` | yes
**onPremEnabled** | whether on-prem is enabled | boolean | false | yes
**domain** | your domain | string | - | yes
### Install the helm chart
Run this command from within this directory:
```console
helm install gcp-unit-deploy .
```
## Uninstalling the Chart
To uninstall the helm deployment:
```console
helm uninstall gcp-unit-deploy
```
[Move-to-Top](#deploy-helm-chart)
......@@ -2,23 +2,23 @@ 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:
......@@ -31,10 +31,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 }}"
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 }}"
service: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
service: "{{ .Values.conf.appName }}"
spec:
ports:
- protocol: TCP
......@@ -17,4 +17,4 @@ spec:
targetPort: 8080
name: http
selector:
app: "{{ .Values.conf.app_name }}"
app: "{{ .Values.conf.appName }}"
{{- if .Values.conf.on_prem_enabled }}
{{- if .Values.conf.onPremEnabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
......
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"
......@@ -3,16 +3,16 @@
# Declare variables to be passed into your templates.
data:
requests_cpu: "0.1"
requests_memory: "256M"
limits_cpu: "1"
limits_memory: "1G"
serviceAccountName: ""
requestsCpu: "0.1"
requestsMemory: "256M"
limitsCpu: "1"
limitsMemory: "1G"
serviceAccountName: "unit"
imagePullPolicy: "IfNotPresent"
image: ""
conf:
appName: "unit"
configmap: "unit-config"
app_name: "unit"
on_prem_enabled: false
onPremEnabled: false
domain: ""
......@@ -7,5 +7,9 @@ spring.main.allow-bean-definition-overriding=true
osdu.entitlement.url=${ENTITLEMENT_URL}
ENTITLEMENTS_HOST=http://entitlements
ENTITLEMENTS_PATH=/api/entitlements/v2
ENTITLEMENT_URL=${ENTITLEMENTS_HOST}${ENTITLEMENTS_PATH}
# [Optional] [AKS] [GKE] File location of the unit catalog
osdu.unit.catalog.filename=${UNIT_CATALOG_FILENAME:/mnt/unit_catalogs/unit_catalog_v2.json}
\ No newline at end of file
osdu.unit.catalog.filename=${UNIT_CATALOG_FILENAME:/mnt/unit_catalogs/unit_catalog_v2.json}
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