Skip to content

Commit

Permalink
fix(4allportal): split operator and existing (#209)
Browse files Browse the repository at this point in the history
* feat: split database.operator from database.existing
feat: throw error on >1 database option usage

feat: use values depending on scale of option (maxscale > operator > existing)

chore: incremental increase of Chart patch version (4allportal)

* chore: Update 'README.md's

* chore: set appVersion to new minimum patch and increase major Chart version

* chore: Update 'README.md's

---------

Co-authored-by: jpkraemer-mg <[email protected]>
  • Loading branch information
jpkraemer-mg and jpkraemer-mg authored Feb 15, 2024
1 parent 4045df9 commit 063f5ed
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 31 deletions.
4 changes: 2 additions & 2 deletions charts/4allportal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: v2
appVersion: "3.10.37"
appVersion: "3.10.38"
description: A Helm chart for 4ALLPORTAL version 3.10.0 and up
name: 4allportal
version: 19.3.2
version: 20.0.0
icon: https://4allportal.com/wp-content/uploads/2022/07/cropped-4ap_logo.png
keywords:
- 4ALLPORTAL
Expand Down
2 changes: 1 addition & 1 deletion charts/4allportal/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 4allportal

![Version: 19.3.2](https://img.shields.io/badge/Version-19.3.2-informational?style=flat-square) ![AppVersion: 3.10.37](https://img.shields.io/badge/AppVersion-3.10.37-informational?style=flat-square)
![Version: 20.0.0](https://img.shields.io/badge/Version-20.0.0-informational?style=flat-square) ![AppVersion: 3.10.38](https://img.shields.io/badge/AppVersion-3.10.38-informational?style=flat-square)

A Helm chart for 4ALLPORTAL version 3.10.0 and up

Expand Down
2 changes: 1 addition & 1 deletion charts/4allportal/templates/4allportal/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ spec:
value: {{ .Values.fourAllPortal.mail.security | quote }}
{{- end }}

{{- if .Values.fourAllPortal.database.operator.enabled }}
{{- if and .Values.fourAllPortal.database.operator.enabled (not .Values.maxscale.enabled) }}
- name: DATABASE_USER
value: {{ required "You must set a database user when using the operator." .Values.fourAllPortal.database.operator.user | quote }}
- name: DATABASE_PASSWORD
Expand Down
27 changes: 24 additions & 3 deletions charts/4allportal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,68 @@
{{- if .Values.maxscale.enabled -}}
{{- .Values.maxscale.mariadb.db.user -}}
{{- else -}}
{{- required "MySQL deployment is disabled, please provide a user for the existing database" .Values.fourAllPortal.database.existing.user -}}
{{- if .Values.fourAllPortal.database.operator.enabled -}}
{{- required "MariaDB deployment is disabled and operator is enabled, please provide a username." .Values.fourAllPortal.database.operator.user -}}
{{- else -}}
{{- required "MariaDB deployment is disabled, please provide a user for the existing database" .Values.fourAllPortal.database.existing.user -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "4allportal.fourallportal.database.password" -}}
{{- if .Values.maxscale.enabled -}}
{{- required "You must provide a password for the bundled MariaDB deployment" .Values.maxscale.mariadb.db.password -}}
{{- else -}}
{{- if .Values.fourAllPortal.database.operator.enabled -}}
{{- required "You must provide a password for the database user to be created" .Values.fourAllPortal.database.operator.password }}
{{- else -}}
{{- required "You must provide a password for the existing database" .Values.fourAllPortal.database.existing.password -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "4allportal.fourallportal.database.type" -}}
{{- if .Values.maxscale.enabled -}}
mariadb
{{- else -}}
{{- if .Values.fourAllPortal.database.operator.enabled }}
{{- else -}}
{{- required "You must provide a type for the existing database" .Values.fourAllPortal.database.existing.type -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "4allportal.fourallportal.database.host" -}}
{{- if and .Values.maxscale.enabled -}}
{{- include "common.names.dependency.fullname" (dict "chartName" "maxscale" "chartValues" .Values.maxscale "context" $) -}}
{{- else -}}
{{- if .Values.fourAllPortal.database.operator.enabled }}
{{- else -}}
{{- required "Bundled DB deployment is disabled, please provide a host for the existing database" (tpl .Values.fourAllPortal.database.existing.host .) -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "4allportal.fourallportal.database.port" -}}
{{- if or .Values.maxscale.enabled (and (not .Values.fourAllPortal.database.existing.port) ((list "mysql" "mariadb") | has (include "4allportal.fourallportal.database.type" .))) -}}
{{- if or .Values.maxscale.enabled (not .Values.fourAllPortal.database.operator.enabled) (and (not .Values.fourAllPortal.database.existing.port) ((list "mysql" "mariadb") | has (include "4allportal.fourallportal.database.type" .))) -}}
3306
{{- else -}}
{{- if .Values.fourAllPortal.database.operator.enabled }}
{{- else -}}
{{- required "Bundled DB deployment is disabled, please provide a port for the existing database" .Values.fourAllPortal.database.existing.port -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- define "4allportal.fourallportal.database.name" -}}
{{- if .Values.maxscale.enabled -}}
{{- .Values.maxscale.mariadb.db.name -}}
{{- else -}}
{{- required "MySQL deployment is disabled, please provide a name for the existing database" .Values.fourAllPortal.database.existing.name -}}
{{- if .Values.fourAllPortal.database.operator.enabled }}
{{- required "MariaDB deployment is disabled and operator is enabled, please provide a name for the database" .Values.fourAllPortal.database.operator.databaseName -}}
{{- else -}}
{{- required "MariaDB deployment is disabled, please provide a name for the existing database" .Values.fourAllPortal.database.existing.name -}}
{{- end -}}
{{- end -}}
{{- end -}}

Expand Down
4 changes: 2 additions & 2 deletions charts/4allportal/templates/validation.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if not (eq (without (list .Values.maxscale.enabled (not (empty .Values.fourAllPortal.database.existing.host))) false | len) 1) -}}
{{- fail "Need to use either mariadb or an existing database" -}}
{{- if not (eq (without (list .Values.maxscale.enabled .Values.fourAllPortal.database.operator.enabled (not (empty .Values.fourAllPortal.database.existing.host))) false | len) 1) -}}
{{- fail "Need to use MariaDB, existing database or database creation via operator" -}}
{{- end -}}

{{- if and .Release.IsInstall .Values.maxscale.enabled -}}
Expand Down
64 changes: 42 additions & 22 deletions charts/4allportal/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
"allOf": [
{
"anyOf": [
{
"$ref": "#/definitions/credentialsOperator"
},
{
"$ref": "#/definitions/existingDatabase"
},
Expand All @@ -112,26 +115,7 @@
},
{
"operator": {
"type": "object",
"description": "Options for the Credentials Operator",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"user": {
"type": "string"
},
"password": {
"type": "string"
},
"databaseName": {
"type": "string"
},
"databaseRef": {
"type": "string"
}
}
"type": "object"
}
}
]
Expand Down Expand Up @@ -667,14 +651,21 @@
]
},
{
"oneOf": [
"anyOf": [
{
"properties": {
"fourAllPortal": {
"type": "object",
"properties": {
"database": {
"$ref": "#/definitions/existingDatabase"
"anyOf": [
{
"$ref": "#/definitions/existingDatabase"
},
{
"$ref": "#/definitions/credentialsOperator"
}
]
}
}
}
Expand Down Expand Up @@ -1166,6 +1157,35 @@
"required": [
"existing"
]
},
"credentialsOperator": {
"type": "object",
"description": "Options for the Credentials Operator",
"properties": {
"operator": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"user": {
"type": "string"
},
"password": {
"type": "string"
},
"databaseName": {
"type": "string"
},
"databaseRef": {
"type": "string"
}
}
}
},
"required": [
"operator"
]
}
}
}

0 comments on commit 063f5ed

Please sign in to comment.