Skip to content

Commit

Permalink
feat: chart generic (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas GRUSON authored Jul 2, 2021
1 parent 044e017 commit 6699225
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 51 deletions.
2 changes: 1 addition & 1 deletion charts/candidate/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: ara
version: 9.0.2-rc.6
version: 9.1.0-rc.1
home: https://github.com/Decathlon/ara
description: |
ARA helps you to fight against regressions by letting it preanalyze your non-regression tests runs,
Expand Down
8 changes: 4 additions & 4 deletions charts/candidate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Create chart name and version as used by the chart label.
Create configmap name.
*/}}
{{- define "ara.configmap.name" -}}
{{ printf "%s-%s" .Release.Name "configmap" }}
{{ printf "%s-%s-%s" .Release.Name .Chart.Name "configmap" }}
{{- end -}}

{{/*
Expand All @@ -33,7 +33,7 @@ Secret name for database.
{{- if .Values.database.existingSecret.enabled -}}
{{ .Values.database.existingSecret.secretName }}
{{- else -}}
{{ printf "%s-%s" .Release.Name "db" }}
{{ printf "%s-%s-%s" .Release.Name .Chart.Name "db" }}
{{- end -}}
{{- end -}}

Expand All @@ -44,7 +44,7 @@ Secret name for api.
{{- if .Values.api.configExistingSecret.enabled -}}
{{ .Values.api.configExistingSecret.secretName }}
{{- else -}}
{{ printf "%s-%s" .Release.Name "api" }}
{{ printf "%s-%s-%s" .Release.Name .Chart.Name "api" }}
{{- end -}}
{{- end -}}

Expand Down Expand Up @@ -110,7 +110,7 @@ Define host url
{{- if .Values.database.embedded -}}
mem
{{- else if not .Values.database.host -}}
{{ printf "%s-db.%s.svc.cluster.local:3306" .Chart.Name .Release.Namespace }}
{{ printf "%s-%s-db.%s.svc.cluster.local:3306" .Release.Name .Chart.Name .Release.Namespace }}
{{- else -}}
{{ .Values.database.host }}
{{- end -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/candidate/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data:
database_type: {{ .Values.database.type }}
liquibase_active: {{ .Values.database.liquibaseActive | quote }}
app_url: {{ .Values.api.appUrl }}
api_url: {{ printf "%s-api.%s.svc.cluster.local:%.0f" .Chart.Name .Release.Namespace .Values.api.port }}
api_url: {{ printf "%s-%s-api.%s.svc.cluster.local:%.0f" .Release.Name .Chart.Name .Release.Namespace .Values.api.port }}

{{- if not .Values.api.configExistingSecret.enabled }}
---
Expand Down
18 changes: 0 additions & 18 deletions charts/candidate/templates/db-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,3 @@ data:
{{ template "ara.database.secret.passwordkey" }}: {{ .Values.database.username | b64enc | quote }}
{{ template "ara.database.secret.databasenamekey" }}: {{ .Values.database.name | b64enc | quote }}
{{- end }}

---
{{- if and (not .Values.database.external) (not .Values.database.embedded) }}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "ara.database.secret.name" . }}-root
labels:
app.kubernetes.io/name: {{ include "ara.name" . }}
helm.sh/chart: {{ include "ara.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.Version }}
app.kubernetes.io/component: db-secret-root
type: Opaque
data:
root-password: {{ randAlphaNum 10 | b64enc | quote }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/candidate/templates/deploy-api.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $name := printf "%s-%s" .Chart.Name "api" -}}
{{- $name := printf "%s-%s-%s" .Release.Name .Chart.Name "api" -}}
{{- $defaultImage := printf "%s:%s" "decathlon/ara-api" .Chart.Version -}}
apiVersion: apps/v1
kind: Deployment
Expand Down
15 changes: 5 additions & 10 deletions charts/candidate/templates/deploy-db.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and (not .Values.database.external) (not .Values.database.embedded) }}
{{- $name := printf "%s-%s" .Chart.Name "db" -}}
{{- $name := printf "%s-%s-%s" .Release.Name .Chart.Name "db" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down Expand Up @@ -27,25 +27,20 @@ spec:
spec:
containers:
- name: {{ $name }}
image: "mysql:5.7"
image: "postgres:12"
imagePullPolicy: IfNotPresent
env:
- name: MYSQL_DATABASE
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: {{ include "ara.database.secret.name" . }}
key: {{ include "ara.database.secret.databasenamekey" . }}
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "ara.database.secret.name" . }}-root
key: root-password
- name: MYSQL_USER
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "ara.database.secret.name" . }}
key: {{ include "ara.database.secret.usernamekey" . }}
- name: MYSQL_PASSWORD
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "ara.database.secret.name" . }}
Expand Down
2 changes: 1 addition & 1 deletion charts/candidate/templates/deploy-ui.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- $name := printf "%s-%s" .Chart.Name "ui" -}}
{{- $name := printf "%s-%s-%s" .Release.Name .Chart.Name "ui" -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
10 changes: 5 additions & 5 deletions charts/candidate/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.ingress.enabled }}
{{- $name := printf "%s-%s" .Chart.Name "ingress" -}}
{{- $name := printf "%s-%s-%s" .Release.Name .Chart.Name "ingress" -}}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
Expand All @@ -21,19 +21,19 @@ spec:
http:
paths:
- backend:
serviceName: {{ printf "%s-%s" .Chart.Name "ui" }}
serviceName: {{ printf "%s-%s-%s" .Release.Name .Chart.Name "ui" }}
servicePort: http-port
path: /
- backend:
serviceName: {{ printf "%s-%s" .Chart.Name "api" }}
serviceName: {{ printf "%s-%s-%s" .Release.Name .Chart.Name "api" }}
servicePort: http-port
path: /api
- backend:
serviceName: {{ printf "%s-%s" .Chart.Name "api" }}
serviceName: {{ printf "%s-%s-%s" .Release.Name .Chart.Name "api" }}
servicePort: http-port
path: /actuator
- backend:
serviceName: {{ printf "%s-%s" .Chart.Name "api" }}
serviceName: {{ printf "%s-%s-%s" .Release.Name .Chart.Name "api" }}
servicePort: http-port
path: /auth
{{- if .Values.ingress.tls }}
Expand Down
6 changes: 3 additions & 3 deletions charts/candidate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ api:
image:
registry: docker.io
repository: decathlon/ara-api
tag: 9.0.7
tag: 9.0.8
imagePullPolicy: IfNotPresent
replicas: 1
annotations: {}
Expand Down Expand Up @@ -66,9 +66,9 @@ ui:
##
database:
embedded: true
# type mysql is suported when embedded is false
# type postgresql is suported when embedded is false
type: h2
# When embedded is false you can provide default cluster database or external database:
# When embedded is false you can provide default cluster database (postgresql) or external database:
external: false
# When external is true you can set the host of database
# host:
Expand Down
2 changes: 1 addition & 1 deletion code/api/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-api</artifactId>
<version>9.0.7</version>
<version>9.0.8</version>

<name>ARA API</name>
<description>
Expand Down
4 changes: 4 additions & 0 deletions code/api/api/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ ara:
clientBaseUrl: http://localhost:8081/

management:
endpoints:
web:
exposure:
include: health,info
# Metrics
metrics:
export:
Expand Down
2 changes: 1 addition & 1 deletion code/api/database/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-database</artifactId>
<version>9.0.7</version>
<version>9.0.8</version>

<name>ARA Database</name>
<description>
Expand Down
2 changes: 1 addition & 1 deletion code/api/generated-cucumber-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-generated-cucumber-report</artifactId>
<version>9.0.7</version>
<version>9.0.8</version>

<name>ARA Cucumber</name>
<description>
Expand Down
4 changes: 2 additions & 2 deletions code/api/jacoco-aggregation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<parent>
<artifactId>ara-parent</artifactId>
<groupId>com.decathlon.ara</groupId>
<version>9.0.7</version>
<version>9.0.8</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.decathlon.ara</groupId>
<artifactId>jacoco-aggregation</artifactId>
<packaging>pom</packaging>
<version>9.0.7</version>
<version>9.0.8</version>

<name>Jacoco Report Aggregation</name>

Expand Down
2 changes: 1 addition & 1 deletion code/api/lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

<groupId>com.decathlon.ara</groupId>
<artifactId>ara-lib</artifactId>
<version>9.0.7</version>
<version>9.0.8</version>

<properties>
<java.version>16</java.version>
Expand Down
2 changes: 1 addition & 1 deletion code/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<groupId>com.decathlon.ara</groupId>
<artifactId>ara-parent</artifactId>
<packaging>pom</packaging>
<version>9.0.7</version>
<version>9.0.8</version>

<name>ARA Parent</name>
<description>
Expand Down

0 comments on commit 6699225

Please sign in to comment.