Skip to content

Commit

Permalink
add PostgreSQL to chart (mend#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
nabeelsaabna authored Jan 18, 2024
1 parent 929f89c commit c242020
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 6 deletions.
41 changes: 41 additions & 0 deletions helm-charts/mend-renovate-ee/templates/deployment-postgresql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if and .Values.postgresql.enabled .Values.postgresql.development }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mend-renovate.fullname" . }}-database
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
helm.sh/chart: {{ include "mend-renovate.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: {{ include "mend-renovate.name" . }}-database
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: {{ include "mend-renovate.name" . }}-database
spec:
containers:
- name: {{ .Chart.Name }}-postgresql
image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}"
imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }}
env:
- name: POSTGRES_USER
value: {{ .Values.postgresql.user | quote }}
- name: POSTGRES_PASSWORD
value: {{ .Values.postgresql.password | quote }}
ports:
- name: ee-db
containerPort: {{ .Values.postgresql.port }}
protocol: TCP
{{- end }}
27 changes: 26 additions & 1 deletion helm-charts/mend-renovate-ee/templates/deployment-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
replicas: 1
replicas: {{ .Values.renovateServer.replicas }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
Expand Down Expand Up @@ -46,6 +46,27 @@ spec:
{{- with .Values.renovateServer.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}

{{- if .Values.postgresql.enabled }}
- name: MEND_RNV_DATA_HANDLER_TYPE
value: postgresql
- name: PGDATABASE
value: {{ .Values.postgresql.database | quote }}
- name: PGUSER
value: {{ .Values.postgresql.user | quote }}
- name: PGPASSWORD
value: {{ .Values.postgresql.password | quote }}
- name: PGPORT
value: {{ .Values.postgresql.port | quote }}
{{- end }}
{{- if and .Values.postgresql.enabled .Values.postgresql.development }}
- name: PGHOST
value: "{{ include "mend-renovate.fullname" . }}-srv-database"
{{- else if .Values.postgresql.enabled }}
- name: PGHOST
value: {{ .Values.postgresql.host | quote }}
{{- end }}

{{- if .Values.license.mendRnvAcceptTos }}
- name: MEND_RNV_ACCEPT_TOS
value: {{ .Values.license.mendRnvAcceptTos | quote }}
Expand Down Expand Up @@ -125,6 +146,10 @@ spec:
- name: LOG_LEVEL
value: {{ .Values.renovateServer.logLevel | quote }}
{{- end }}
{{- if .Values.renovateServer.logFormat }}
- name: LOG_FORMAT
value: {{ .Values.renovateServer.logFormat | quote }}
{{- end }}
{{- if .Values.renovateServer.mendRnvAdminApiEnabled }}
- name: MEND_RNV_ADMIN_API_ENABLED
value: {{ .Values.renovateServer.mendRnvAdminApiEnabled | quote }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: MEND_RNV_SERVER_HOSTNAME
value: "http://{{ include "mend-renovate.fullname" . }}"
value: "http://{{ include "mend-renovate.fullname" . }}-srv-server"
{{- if or .Values.renovateServer.mendRnvServerApiSecret .Values.renovateServer.existingSecret }}
- name: MEND_RNV_SERVER_API_SECRET
valueFrom:
Expand Down Expand Up @@ -110,6 +110,10 @@ spec:
- name: LOG_LEVEL
value: {{ .Values.renovateWorker.logLevel | quote }}
{{- end }}
{{- if .Values.renovateWorker.logFormat }}
- name: LOG_FORMAT
value: {{ .Values.renovateWorker.logFormat | quote }}
{{- end }}
resources:
{{- toYaml .Values.renovateWorker.resources | nindent 12 }}
volumeMounts:
Expand Down
22 changes: 22 additions & 0 deletions helm-charts/mend-renovate-ee/templates/srv-database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if and .Values.postgresql.enabled .Values.postgresql.development }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "mend-renovate.fullname" . }}-srv-database
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
helm.sh/chart: {{ include "mend-renovate.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
type: ClusterIP
ports:
- protocol: TCP
port: {{ .Values.postgresql.port }}
targetPort: {{ .Values.postgresql.port }}
selector:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: {{ include "mend-renovate.name" . }}-database
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "mend-renovate.fullname" . }}
name: {{ include "mend-renovate.fullname" . }}-srv-server
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
Expand All @@ -22,4 +22,4 @@ spec:
selector:
app.kubernetes.io/name: {{ include "mend-renovate.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app: {{ .Chart.Name }}-server
app: {{ include "mend-renovate.name" . }}-server
26 changes: 24 additions & 2 deletions helm-charts/mend-renovate-ee/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nameOverride: ""
fullnameOverride: ""
nameOverride: "mend-renovate"
fullnameOverride: "mend-renovate"

license:
# Set this to the key you received by email.
Expand All @@ -16,12 +16,30 @@ license:
# mendRnvLicenseKey:
existingSecret:

postgresql:
# if to use PostgreSQL, if set to 'false' SQLite will be used instead
enabled:
host:
port:
database:
user:
password:

# used for development purposes
development: {}
# repository: postgres
# tag: 16.1-alpine3.17
# pullPolicy: IfNotPresent

renovateServer:
image:
repository: ghcr.io/mend/renovate-ee-server
tag: 6.8.0
pullPolicy: IfNotPresent

# Number of renovate-ee-server (for SQLite only 1 replica is allowed)
replicas: 1

# Additional server env vars
extraEnvVars: []

Expand Down Expand Up @@ -78,6 +96,8 @@ renovateServer:

# Set log level, defaults to 'info'. Allowed values: fatal, error, warn, info, debug, trace
logLevel: info
# Set log format, defaults to pretty format. Allowed values: undefined or 'json'
logFormat: json

resources: { }

Expand Down Expand Up @@ -174,6 +194,8 @@ renovateWorker:

# Set log level, defaults to 'info'. Allowed values: fatal, error, warn, info, debug, trace
logLevel: info
# Set log format, defaults to pretty format. Allowed values: undefined or 'json'
logFormat: json

# Self-hosted renovate configuration file, will be mounted as a config map
config: |
Expand Down

0 comments on commit c242020

Please sign in to comment.