From 310cf870eba9175e8cfac9a22738ff8a6a689746 Mon Sep 17 00:00:00 2001 From: Irfan Hakim Date: Mon, 16 Dec 2024 13:51:01 +0800 Subject: [PATCH 1/5] mariadb-agent: Update command for setting password Compatible with MariaDB 11 and MySQL 8 --- mika/mariadb-agent/templates/job.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mika/mariadb-agent/templates/job.yaml b/mika/mariadb-agent/templates/job.yaml index 0af8eb2e..69b9d56f 100644 --- a/mika/mariadb-agent/templates/job.yaml +++ b/mika/mariadb-agent/templates/job.yaml @@ -52,7 +52,7 @@ spec: {{- end }} {{- if $create }} CREATE USER IF NOT EXISTS {{ $user | quote }}@"%"; - SET PASSWORD FOR {{ $user | quote }}@"%" = PASSWORD({{ $password | quote }}); + ALTER USER {{ $user | quote }}@"%" IDENTIFIED BY {{ $password | quote }}; CREATE DATABASE IF NOT EXISTS {{ $db }}; GRANT ALL PRIVILEGES ON {{ $db }}.* TO {{ $user | quote }}@"%"; {{- end }} From e201fe9677b12dbe05b34bb49724fa696b75c88d Mon Sep 17 00:00:00 2001 From: Irfan Hakim Date: Mon, 16 Dec 2024 13:57:41 +0800 Subject: [PATCH 2/5] mariadb-agent: Add new mariadb.client value In order to add support for MySQL. Defaults to `mariadb`. --- mika/mariadb-agent/README.md | 1 + mika/mariadb-agent/values.yaml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/mika/mariadb-agent/README.md b/mika/mariadb-agent/README.md index 19822a72..5e1b42fe 100644 --- a/mika/mariadb-agent/README.md +++ b/mika/mariadb-agent/README.md @@ -132,6 +132,7 @@ Easily create or delete multiple pairs of databases and users in a remote MariaD | image.mariadb.repository | string | `""` | The name of the repository that contains the MariaDB container image used. Default: `"bitnami/mariadb"`. | | image.mariadb.tag | string | `""` | The tag that specifies the version of the MariaDB container image used. Default: `Chart appVersion`. | | imagePullSecrets | list | `[]` | Credentials used to securely authenticate and authorise the pulling of container images from private registries. | +| mariadb.client | string | `""` | The command-line client tool to connect to the database server. Default: `"mariadb"`. | | mariadb.databases | list | `[]` | Database configurations array. Items: `.name`, `.user`, `.password`, `.create`, `.drop`, `.custom`, `.custom_command`. | | mariadb.host | string | `""` | The hostname or IP address of the MariaDB database server. | | mariadb.port | string | `""` | The port number the MariaDB database server is listening for connections. Default: `"3306"`. | diff --git a/mika/mariadb-agent/values.yaml b/mika/mariadb-agent/values.yaml index 5b7a9285..9fd0a2f3 100644 --- a/mika/mariadb-agent/values.yaml +++ b/mika/mariadb-agent/values.yaml @@ -28,6 +28,11 @@ imagePullSecrets: [] # MariaDB-Agent configurations. mariadb: + # The command-line client tool to connect to the database server. + # Default: "mariadb" + # Example: + # client: "mysql" + client: "" # The hostname or IP address of the MariaDB database server. # Example: # host: "mariadb.default.svc.cluster.local" From 090f8f0b91566b105b112ed1c959a53a3c29b0db Mon Sep 17 00:00:00 2001 From: Irfan Hakim Date: Mon, 16 Dec 2024 13:58:22 +0800 Subject: [PATCH 3/5] mariadb-agent: Use specified client tool to operate db --- mika/mariadb-agent/templates/job.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mika/mariadb-agent/templates/job.yaml b/mika/mariadb-agent/templates/job.yaml index 69b9d56f..7aa390fc 100644 --- a/mika/mariadb-agent/templates/job.yaml +++ b/mika/mariadb-agent/templates/job.yaml @@ -1,8 +1,9 @@ +{{- $databases := .Values.mariadb.databases }} {{- $mariadb_registry := .Values.image.mariadb.registry | default "docker.io" | toString }} {{- $mariadb_repository := .Values.image.mariadb.repository | default "bitnami/mariadb" | toString }} {{- $mariadb_tag := .Values.image.mariadb.tag | default .Chart.AppVersion | toString }} {{- $mariadb_pullPolicy := .Values.image.mariadb.pullPolicy | default "IfNotPresent" | toString | quote }} -{{- $databases := .Values.mariadb.databases }} +{{- $client := .Values.mariadb.client | default "mariadb" | toString }} {{- $mariadbHost := .Values.mariadb.host | default "mariadb" | toString }} --- apiVersion: batch/v1 @@ -37,7 +38,7 @@ spec: args: - -c - >- - mariadb -h $(DB_HOST) -P $(DB_PORT) -u $(ROOT_USER) -e ' + {{ $client }} -h $(DB_HOST) -P $(DB_PORT) -u $(ROOT_USER) -e ' {{- range $databases }} {{- $create := .create }} {{- $drop := .drop }} From 68181c94f6d2d8d5bde979a4b11cd4722398783d Mon Sep 17 00:00:00 2001 From: Irfan Hakim Date: Mon, 16 Dec 2024 13:59:46 +0800 Subject: [PATCH 4/5] mariadb-agent: Indicate MySQL support in chart desc --- README.md | 2 +- mika/mariadb-agent/Chart.yaml | 2 +- mika/mariadb-agent/README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ae64accf..fb7cdc79 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Applications, developed or curated by [mika](https://github.com/irfanhakim-as), | [kutt](mika/kutt) | Kutt is a modern URL shortener with support for custom domains. Shorten URLs, manage your links and view the click rate statistics. | ✅ | ✅ | | [linkstack](mika/linkstack) | LinkStack is a highly customizable link sharing platform with an intuitive, easy to use user interface. | ✅ | ✅ | | [littlelink](mika/littlelink) | The DIY self-hosted LinkTree alternative. | ✅ | ✅ | -| [mariadb-agent](mika/mariadb-agent) | Easily create or delete multiple pairs of databases and users in a remote MariaDB instance. | ✅ | ✅ | +| [mariadb-agent](mika/mariadb-agent) | Easily create or delete multiple pairs of databases and users in a remote MariaDB or MySQL instance. | ✅ | ✅ | | [postgres](mika/postgres) | Easy tool to deploy a PostgreSQL instance on Kubernetes. | ✅ | ✅ | | [postgres-agent](mika/postgres-agent) | Easily create or delete a database and user pair in a remote PostgreSQL instance. | ✅ | ✅ | | [rizz](mika/rizz) | Rizz is a simple web application that tracks and posts content from RSS Feeds to Mastodon. | ✅ | 🔒 | diff --git a/mika/mariadb-agent/Chart.yaml b/mika/mariadb-agent/Chart.yaml index 8dbafcc9..f74ec6f4 100644 --- a/mika/mariadb-agent/Chart.yaml +++ b/mika/mariadb-agent/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: mariadb-agent -description: Easily create or delete multiple pairs of databases and users in a remote MariaDB instance. +description: Easily create or delete multiple pairs of databases and users in a remote MariaDB or MySQL instance. type: application version: 0.1.2 appVersion: "11.1.3-debian-11-r0" diff --git a/mika/mariadb-agent/README.md b/mika/mariadb-agent/README.md index 5e1b42fe..2519d185 100644 --- a/mika/mariadb-agent/README.md +++ b/mika/mariadb-agent/README.md @@ -1,6 +1,6 @@ # [MariaDB-Agent](https://github.com/MariaDB/server) -Easily create or delete multiple pairs of databases and users in a remote MariaDB instance. +Easily create or delete multiple pairs of databases and users in a remote MariaDB or MySQL instance. ## Prerequisites From 6ecbd5c30df4f993b16658f10db8e3b7bc325b85 Mon Sep 17 00:00:00 2001 From: Irfan Hakim Date: Mon, 16 Dec 2024 14:00:02 +0800 Subject: [PATCH 5/5] mariadb-agent: Update chart version --- mika/mariadb-agent/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mika/mariadb-agent/Chart.yaml b/mika/mariadb-agent/Chart.yaml index f74ec6f4..7b6c89e6 100644 --- a/mika/mariadb-agent/Chart.yaml +++ b/mika/mariadb-agent/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: mariadb-agent description: Easily create or delete multiple pairs of databases and users in a remote MariaDB or MySQL instance. type: application -version: 0.1.2 +version: 0.1.3 appVersion: "11.1.3-debian-11-r0" keywords: - "mariadb"