-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
966 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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 | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v2 | ||
name: public-enemy | ||
description: A Helm chart for Public Enemy API, UI and DB | ||
|
||
dependencies: | ||
- name: postgresql | ||
condition: postgresql.enabled | ||
version: 11.6.15 | ||
repository: https://charts.bitnami.com/bitnami | ||
|
||
type: application | ||
version: 0.5.6 | ||
appVersion: "2.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Public Enemy V2 Helm Chart | ||
|
||
Helm chart to deploy Public Enemy UI, Public Enemy API and Postgres database from the chart proposed by Bitnami | ||
|
||
## Environment values : | ||
|
||
Environnement values are saved in a configMap both for ui and api. They came from the values.yaml file. | ||
|
||
### In case of ui values : | ||
|
||
```yaml | ||
ui: | ||
env: | ||
key: values | ||
``` | ||
### API environment values : | ||
```yaml | ||
api: | ||
env: | ||
key: values | ||
``` | ||
Environnement values concerning the database such as host, schema, password and username are already pass to postgres. So we decided to pass them to the api throught the environement values in the `api\deployment.yaml` | ||
|
||
## LivenessProb and ReadinessProb : | ||
|
||
### API : | ||
|
||
This point is visibled in the `api\deployment.yaml`. The choice of values must be perfected. | ||
|
||
```yaml | ||
livenessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /actuator/health/liveness | ||
port: http | ||
scheme: HTTP | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
timeoutSeconds: 2 | ||
readinessProbe: | ||
failureThreshold: 3 | ||
httpGet: | ||
path: /actuator/health/readiness | ||
port: http | ||
scheme: HTTP | ||
periodSeconds: 10 | ||
successThreshold: 1 | ||
timeoutSeconds: 5 | ||
``` | ||
|
||
### UI: | ||
|
||
UI prob's are the classic one automaticaly generated (by `helm create`) | ||
|
||
```yaml | ||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
``` | ||
|
||
## Metrics :construction_worker: | ||
|
||
This part is still in progress. | ||
|
||
It's possible to enable metric for the api. It is not finished and some changes must be needed. The aim is to connect a prometheus operator. | ||
|
||
See `api/metrics-svc.yaml` and `api/servicemonitor.yaml` and `values.yaml` in the `api.metrics` block. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
|
||
|
||
{{- define "publicEnemy.api.name" -}} | ||
{{- .Values.api.nameOverride | default (printf "-%s-api" .Chart.Name ) }} | ||
{{- end }} | ||
|
||
{{- define "publicEnemy.ui.name" -}} | ||
{{- .Values.ui.nameOverride | default (printf "-%s-ui" .Chart.Name ) }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
|
||
{{- define "publicEnemy.api.fullname" -}} | ||
{{- if .Values.api.fullnameOverride }} | ||
{{- .Values.api.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.api.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "publicEnemy.ui.fullname" -}} | ||
{{- if .Values.ui.fullnameOverride }} | ||
{{- .Values.ui.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.ui.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "publicEnemy.postgresql.fullname" -}} | ||
{{- if .Values.postgresql.fullnameOverride -}} | ||
{{- .Values.postgresql.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "publicEnemy.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{- define "publicEnemy.api.chart" -}} | ||
{{- printf "publicEnemy-api" -}} | ||
{{- end -}} | ||
|
||
{{- define "publicEnemy.ui.chart" -}} | ||
{{- printf "publicEnemy-ui" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts. | ||
*/}} | ||
{{- define "publicEnemy.namespace" -}} | ||
{{- print .Release.Namespace -}} | ||
{{- end -}} | ||
{{- define "publicEnemy.api.serviceMonitor.namespace" -}} | ||
{{- if .Values.api.metrics.serviceMonitor.namespace -}} | ||
{{- print .Values.api.metrics.serviceMonitor.namespace -}} | ||
{{- else -}} | ||
{{- include "publicEnemy.namespace" . -}} | ||
{{- end }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
|
||
{{- define "publicEnemy.api.labels" -}} | ||
helm.sh/chart: {{ include "publicEnemy.api.chart" . }} | ||
{{ include "publicEnemy.api.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{- define "publicEnemy.ui.labels" -}} | ||
helm.sh/chart: {{ include "publicEnemy.ui.chart" . }} | ||
{{ include "publicEnemy.ui.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end -}} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
|
||
{{- define "publicEnemy.api.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "publicEnemy.api.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
{{- define "publicEnemy.ui.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "publicEnemy.ui.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
|
||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "publicEnemy.api.serviceAccountName" -}} | ||
{{- if .Values.api.serviceAccount.create }} | ||
{{- default (include "publicEnemy.api.fullname" .) .Values.api.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.api.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{- define "publicEnemy.ui.serviceAccountName" -}} | ||
{{- if .Values.ui.serviceAccount.create }} | ||
{{- default (include "publicEnemy.ui.fullname" .) .Values.ui.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.ui.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- if .Values.api.enabled }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "publicEnemy.api.fullname" . }} | ||
labels: | ||
app: {{ template "publicEnemy.api.name" . }} | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
{{- if .Values.api.env }} | ||
{{- range $key, $value := .Values.api.env }} | ||
{{ $key }}: {{ $value | quote }} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{{- if .Values.api.enabled -}} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "publicEnemy.api.fullname" . }} | ||
labels: | ||
{{- include "publicEnemy.api.labels" . | nindent 4 }} | ||
spec: | ||
{{- if not .Values.api.autoscaling.enabled }} | ||
replicas: {{ .Values.api.replicaCount }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "publicEnemy.api.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/api/configmap.yaml") . | sha256sum }} | ||
labels: | ||
{{- include "publicEnemy.api.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.api.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "publicEnemy.api.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.api.podSecurityContext | nindent 8 }} | ||
|
||
initContainers: | ||
- name: check-db-ready | ||
image: postgres:11.6 | ||
command: ['sh', '-c', | ||
until pg_isready -h {{ include "publicEnemy.postgresql.fullname" . }} -p {{ .Values.postgresql.auth.port}}; | ||
do echo waiting for database; sleep 2; done;] | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.api.securityContext | nindent 12 }} | ||
image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.api.image.pullPolicy }} | ||
env: | ||
- name: SPRING_PROFILES_ACTIVE | ||
value: {{ .Values.api.profiles}} | ||
- name: MANAGEMENT_SERVER_PORT | ||
value: '{{ .Values.api.actuatorPort}}' | ||
{{- if .Values.postgresql.enabled }} | ||
- name: SPRING_DATASOURCE_URL | ||
value: {{ printf "jdbc:postgresql://%s:%.0f/%s" (include "publicEnemy.postgresql.fullname" .) .Values.postgresql.auth.port .Values.postgresql.auth.database | quote }} | ||
- name: SPRING_DATASOURCE_USERNAME | ||
value: {{ .Values.postgresql.auth.username | quote}} | ||
- name: SPRING_DATASOURCE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "publicEnemy.postgresql.fullname" .}} | ||
key: password | ||
{{- end }} | ||
envFrom: | ||
- configMapRef: | ||
name: {{ template "publicEnemy.api.fullname" . }} | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: {{ .Values.api.health.liveness.path }} | ||
port: {{ .Values.api.actuatorPort }} | ||
initialDelaySeconds: {{ .Values.api.health.liveness.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.api.health.liveness.periodSeconds }} | ||
timeoutSeconds: {{ .Values.api.health.liveness.timeoutSeconds }} | ||
failureThreshold: {{ .Values.api.health.liveness.failureThreshold }} | ||
readinessProbe: | ||
httpGet: | ||
path: {{ .Values.api.health.readiness.path }} | ||
port: {{ .Values.api.actuatorPort }} | ||
initialDelaySeconds: {{ .Values.api.health.readiness.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.api.health.readiness.periodSeconds }} | ||
timeoutSeconds: {{ .Values.api.health.readiness.timeoutSeconds }} | ||
failureThreshold: {{ .Values.api.health.readiness.failureThreshold }} | ||
resources: | ||
{{- toYaml .Values.api.resources | nindent 12 }} | ||
{{- with .Values.api.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.api.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.api.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- end -}} |
Oops, something went wrong.