Skip to content

Commit

Permalink
[CITYLENS-728] Add citylens-routes-ui chart
Browse files Browse the repository at this point in the history
  • Loading branch information
xalvaine committed Dec 13, 2024
1 parent 1044386 commit 26a6bb6
Show file tree
Hide file tree
Showing 15 changed files with 619 additions and 0 deletions.
2 changes: 2 additions & 0 deletions charts/citylens-routes-ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Chart.lock
charts/
22 changes: 22 additions & 0 deletions charts/citylens-routes-ui/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
13 changes: 13 additions & 0 deletions charts/citylens-routes-ui/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v2
name: citylens-routes-ui
description: A Helm chart for Kubernetes to deploy Citylens UI service
type: application
version: 0.0.1
appVersion: '0.0.1'
dependencies:
- name: generic-chart
version: '*'
repository: file://../generic-chart
maintainers:
- name: 2gis
email: [email protected]
123 changes: 123 additions & 0 deletions charts/citylens-routes-ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
## Values

### Docker Registry settings

| Name | Description | Value |
| --------------------- | --------------------------------------------------------------------------------------- | -------------- |
| `dgctlDockerRegistry` | Docker Registry endpoint where On-Premise services' images reside. Format: `host:port`. | `""` |
| `imagePullPolicy` | Pull Policy | `IfNotPresent` |
| `imagePullSecrets` | Kubernetes image pull secrets. | `[]` |

### Strategy settings

| Name | Description | Value |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
| `strategy.type` | Type of Kubernetes deployment. Can be `Recreate` or `RollingUpdate`. | `RollingUpdate` |
| `strategy.rollingUpdate.maxUnavailable` | Maximum number of pods that can be created over the desired number of pods when doing [rolling update](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment). | `0` |
| `strategy.rollingUpdate.maxSurge` | Maximum number of pods that can be unavailable during the [rolling update](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment) process. | `1` |

### Deployment settings

| Name | Description | Value |
| ------------------ | ----------- | ------------------------------------ |
| `image.repository` | Repository | `2gis-on-premise/citylens-routes-ui` |
| `image.tag` | Tag | `latest` |

### Environment

| Name | Description | Value |
| ----------------------------- | ------------------------------------------------- | ----- |
| `env.CATALOG_API_URL` | Catalog API base URL | `""` |
| `env.MAPGL_API_URL` | Map API base URL | `""` |
| `env.MAPGL_COPYRIGHT_VARIANT` | Copyright variant, can be '2gis', 'urbi' or empty | `""` |
| `env.MAPGL_KEY` | API key for mapgl | `""` |
| `env.MAPGL_STYLE_ID` | Map style ID | `""` |
| `env.ROUTES_API_URL` | Backend (citylens-routes-api) base URL | `""` |

### Common deployment settings

| Name | Description | Value |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `replicas` | A replica count for the pod. | `1` |
| `revisionHistoryLimit` | Revision history limit (used for [rolling back](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/) a deployment). | `3` |
| `terminationGracePeriodSeconds` | Seconds pod needs to [terminate](https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods) gracefully | `60` |
| `nodeSelector` | Kubernetes [node selectors](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector). | `{}` |
| `affinity` | Kubernetes pod [affinity settings](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity). | `{}` |
| `tolerations` | Kubernetes [tolerations](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) settings. | `[]` |
| `podAnnotations` | Kubernetes [pod annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/). | `{}` |
| `podLabels` | Kubernetes [pod labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). | `{}` |
| `annotations` | Kubernetes [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/). | `{}` |
| `labels` | Kubernetes [labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). | `{}` |
| `readinessProbe.enabled` | Enable [readinessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes) on PRO UI containers | `false` |
| `livenessProbe.enabled` | Enable [livenessProbe](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes) on PRO UI containers | `true` |
| `livenessProbe.healthcheckPath` | Application http path for health check | `/health` |
| `containerPort` | Port on which application listen connection in container | `3000` |

### Logs

| Name | Description | Value |
| -------------------- | ------------------------------------------------------------------------------------------------------ | ------- |
| `log.errorLog.level` | Error log level. Allowed values: `debug`, `info`, `notice`, `warn`, `error`, `crit`, `alert`, `emerg`. | `debug` |
| `log.accessLog` | NGINX access log definition. | `off` |
| `log.formats` | List of log formats to be used in NGINX configuration | `[]` |

### Service settings

| Name | Description | Value |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------- |
| `service.annotations` | Kubernetes [service annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/). | `{}` |
| `service.labels` | Kubernetes [service labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/). | `{}` |
| `service.type` | Kubernetes [service type](https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types). | `ClusterIP` |
| `service.port` | Service port. | `80` |

### Kubernetes [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) settings

| Name | Description | Value |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------- | ------------------------- |
| `ingress.enabled` | If Ingress is enabled for the service. | `false` |
| `ingress.annotations` | Kubernetes [annotations](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/). | `{}` |
| `ingress.className` | Name of the Ingress controller class. | `nginx` |
| `ingress.hosts[0].host` | Hostname for the Ingress service. | `citylens-ui.example.com` |
| `ingress.hosts[0].paths[0].path` | Path of the host for the Ingress service. | `/` |
| `ingress.hosts[0].paths[0].pathType` | Type of the path for the Ingress service. | `Prefix` |
| `ingress.tls` | TLS configuration | `[]` |

### Limits

| Name | Description | Value |
| --------------------------- | ----------------- | ------- |
| `resources.requests.cpu` | A CPU request. | `300m` |
| `resources.requests.memory` | A memory request. | `256Mi` |
| `resources.limits.cpu` | A CPU limit. | `1` |
| `resources.limits.memory` | A memory limit. | `384Mi` |

### Kubernetes [Pod Disruption Budget](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets) settings

| Name | Description | Value |
| -------------------- | --------------------------------------------------- | ------- |
| `pdb.enabled` | If PDB is enabled for the service | `false` |
| `pdb.minAvailable` | How many pods must be available after the eviction | `""` |
| `pdb.maxUnavailable` | How many pods can be unavailable after the eviction | `1` |

### Kubernetes [Horizontal Pod Autoscaling](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) settings

| Name | Description | Value |
| ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `hpa.enabled` | If HPA is enabled for the service | `false` |
| `hpa.minReplicas` | Lower limit for the number of replicas to which the autoscaler can scale down | `1` |
| `hpa.maxReplicas` | Upper limit for the number of replicas to which the autoscaler can scale up | `100` |
| `hpa.scaleDownStabilizationWindowSeconds` | Scale-down window | `""` |
| `hpa.scaleUpStabilizationWindowSeconds` | Scale-up window | `""` |
| `hpa.targetCPUUtilizationPercentage` | Target average CPU utilization (represented as a percentage of requested CPU) over all the pods; if not specified the default autoscaling policy will be used | `80` |
| `hpa.targetMemoryUtilizationPercentage` | Target average memory utilization (represented as a percentage of requested memory) over all the pods; if not specified the default autoscaling policy will be used | `""` |

### Kubernetes [Vertical Pod Autoscaling](https://github.com/kubernetes/autoscaler/blob/master/vertical-pod-autoscaler/README.md) settings

| Name | Description | Value |
| ----------------------- | ------------------------------------------------------------------------------------------------------------ | ------- |
| `vpa.enabled` | If VPA is enabled for the service. | `false` |
| `vpa.updateMode` | VPA [update mode](https://github.com/kubernetes/autoscaler/tree/master/vertical-pod-autoscaler#quick-start). | `Auto` |
| `vpa.minAllowed.cpu` | Lower limit for the number of CPUs to which the autoscaler can scale down. | `500m` |
| `vpa.minAllowed.memory` | Lower limit for the RAM size to which the autoscaler can scale down. | `128Mi` |
| `vpa.maxAllowed.cpu` | Upper limit for the number of CPUs to which the autoscaler can scale up. | `2000` |
| `vpa.maxAllowed.memory` | Upper limit for the RAM size to which the autoscaler can scale up. | `512Mi` |
14 changes: 14 additions & 0 deletions charts/citylens-routes-ui/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ .Chart.Name }} is installed by release "{{ .Release.Name }}" at "{{ .Release.Namespace }}" namespace

You can check the status of the app using command

kubectl get pods -n {{ .Release.Namespace}} -l app.kubernetes.io/name={{ include "citylens-ui.name" . }} -l app.kubernetes.io/instance={{ .Release.Name }}

{{- if .Values.ingress.enabled }}
You can check service using curl
{{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .host }}/
{{- end }}
{{- else }}
You should publish the service in your preferred way (ingress, balancer, etc).
{{- end }}
13 changes: 13 additions & 0 deletions charts/citylens-routes-ui/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- define "citylens-ui.name" -}}
{{- .Release.Name }}
{{- end }}

{{- define "citylens-ui.selectorLabels" -}}
app.kubernetes.io/name: {{ .Chart.Name }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "citylens-ui.labels" -}}
{{ include "citylens-ui.selectorLabels" . }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
61 changes: 61 additions & 0 deletions charts/citylens-routes-ui/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "citylens-ui.name" . }}
labels:
{{- include "citylens-ui.labels" . | nindent 4 }}
data:
nginx.conf: |
worker_processes auto;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
{{ range .Values.log.formats }}
log_format {{ .name }} escape={{ .escape }} {{ .format | nindent 36 | trim }};
{{- end }}
access_log {{ required "A valid .Values.log.accessLog" .Values.log.accessLog }};
error_log /dev/stderr {{ required "A valid .Values.log.errorLog.level required" .Values.log.errorLog.level }};
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
server {
listen 3000;
root /usr/share/nginx/html;
error_page 500 502 503 504 /50x.html;
gzip_static on;
location ~ \.(css|js|svg|woff|woff2|ico|ttf|eot|jpe?g|png|txt|mp3|json|svg|otf|wasm)$ {
try_files $uri $uri/ =404;
expires 1y;
add_header Cache-Control "public";
}
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
add_header Pragma "no-cache";
if_modified_since off;
expires -1;
etag off;
}
location /health {
access_log off;
add_header 'Content-Type' 'text/plain';
return 200 "UP";
}
}
}
Loading

0 comments on commit 26a6bb6

Please sign in to comment.