Skip to content

Commit 17fd8f3

Browse files
authored
Merge pull request #19 from T-Systems-MMS/akvk8s_proxysql
proxysql tmpl force k8s secret usage, akv2k8s add more options
2 parents d75e86e + 5cb4498 commit 17fd8f3

7 files changed

Lines changed: 98 additions & 54 deletions

File tree

akv2k8s/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
apiVersion: v1
33
name: akv2k8s
44
description: Azure Key Vault to Kubernetes
5-
version: 0.1.3
5+
version: 0.1.4
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.sync_secret_to_configmap -}}
2+
{{- $sync_secret_to_configmap := .Values.sync_secret_to_configmap }}
3+
{{- range $secret := $sync_secret_to_configmap.secret.object }}
4+
---
5+
apiVersion: spv.no/v2beta1
6+
kind: AzureKeyVaultSecret
7+
metadata:
8+
name: {{ $secret }}
9+
namespace: {{ $sync_secret_to_configmap.namespace }}
10+
spec:
11+
vault:
12+
name: {{ $sync_secret_to_configmap.vault.name }}
13+
object:
14+
name: {{ $secret }}
15+
type: secret
16+
output:
17+
configMap:
18+
name: {{ $sync_secret_to_configmap.configmap.name }}
19+
dataKey: {{ $secret }}
20+
{{- end }}
21+
{{- end }}

akv2k8s/templates/sync-secret.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- if .Values.sync_secret -}}
2+
{{- $sync_secret := .Values.sync_secret }}
3+
{{- range $secret := $sync_secret.secret.object }}
4+
---
5+
apiVersion: spv.no/v2beta1
6+
kind: AzureKeyVaultSecret
7+
metadata:
8+
name: {{ $secret }}
9+
namespace: {{ $sync_secret.namespace }}
10+
spec:
11+
vault:
12+
name: {{ $sync_secret.vault.name }}
13+
object:
14+
name: {{ $secret }}
15+
type: secret
16+
output:
17+
secret:
18+
name: {{ $secret }}
19+
dataKey: value
20+
{{- end }}
21+
{{- end }}

proxysql/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
apiVersion: v1
33
name: proxysql
44
description: ProxySQL Configuration
5-
version: 0.1.8
5+
version: 0.1.9

proxysql/config/proxysql.cnf

Lines changed: 0 additions & 48 deletions
This file was deleted.

proxysql/templates/configmap.yaml

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,55 @@ metadata:
1010
{{ $key }}: {{ $value }}
1111
{{- end }}
1212
data:
13-
{{ tpl (.Files.Glob "config/proxysql.cnf").AsConfig . | indent 2 }}
13+
proxysql.tmpl: |-
14+
{{- $proxysql := .Values.configmap }}
15+
datadir = "{{ $proxysql.datadir }}"
16+
errorlog = "{{ $proxysql.errorlog }}"
17+
18+
admin_variables = { {{- range $key, $value := $proxysql.admin_variables }}
19+
{{- if eq $key "admin_credentials" }}
20+
{{ $key }} = "{{ $value.username }}:{{ (lookup "v1" "Secret" $.Release.Namespace $value.password).data.value }}" {{- else }}
21+
{{ $key }} = "{{ $value }}" {{- end }}{{- end }}
22+
}
23+
24+
mysql_variables = { {{- range $key, $value := $proxysql.mysql_variables }}
25+
{{- if eq $key "monitor_password" }}
26+
{{ $key }} = "{{ (lookup "v1" "Secret" $.Release.Namespace $value).data.value }}" {{- else }}
27+
{{ $key }} = "{{ $value }}" {{- end }}{{- end }}
28+
}
29+
30+
mysql_users = ( {{- range $key, $mysql_user := $proxysql.mysql_users }}
31+
{
32+
username = "{{ default $key $mysql_user.username }}"
33+
default_hostgroup = "{{ default 0 $mysql_user.default_hostgroup }}"
34+
active = "{{ default 1 $mysql_user.active }}"
35+
password = "{{ (lookup "v1" "Secret" $.Release.Namespace $mysql_user.password).data.value }}"
36+
}, {{- end }}
37+
)
38+
39+
mysql_servers = ( {{- range $key, $mysql_server := $proxysql.mysql_servers }}
40+
{
41+
hostgroup_id = "{{ default 0 $mysql_server.hostgroup_id }}"
42+
hostname = "{{ default $key $mysql_server.hostname}}"
43+
port = "{{ default 3306 $mysql_server.port }}"
44+
use_ssl = "{{ default 1 $mysql_server.use_ssl }}"
45+
weight = "{{ default 1 $mysql_server.weight }}"
46+
comment = "{{ $mysql_server.comment }}"
47+
}, {{- end }}
48+
)
49+
50+
mysql_query_rules = ( {{- range $key, $value := $proxysql.mysql_query_rules }}
51+
{{ $key }} = "{{ $value }}" {{- end }}
52+
)
53+
54+
scheduler = ( {{- range $key, $value := $proxysql.scheduler }}
55+
{{ $key }} = "{{ $value }}" {{- end }}
56+
)
57+
58+
mysql_replication_hostgroups = ( {{- range $mysql_replication_hostgroup := $proxysql.mysql_replication_hostgroups }}
59+
{
60+
writer_hostgroup = "{{ default 0 $mysql_replication_hostgroup.writer_hostgroup }}"
61+
reader_hostgroup = "{{ default 1 $mysql_replication_hostgroup.reader_hostgroup }}"
62+
comment = "{{ $mysql_replication_hostgroup.comment }}"
63+
}, {{- end }}
64+
)

proxysql/values.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ configmap:
5656
datadir: "/var/lib/proxysql"
5757
errorlog: "/var/lib/proxysql/proxysql.log"
5858
admin_variables:
59-
admin_credentials: ""
6059
mysql_ifaces: "0.0.0.0:6032"
6160
mysql_variables:
6261
threads: "8"
@@ -69,8 +68,7 @@ configmap:
6968
default_schema: "information_schema"
7069
stacksize: "1048576"
7170
server_version: "5.7"
72-
monitor_username: ""
73-
monitor_password: ""
71+
monitor_username: "proxysqlmonitor"
7472
monitor_history: "600000"
7573
monitor_connect_interval: "60000"
7674
monitor_ping_interval: "10000"
@@ -92,3 +90,4 @@ configmap:
9290
mysql_query_rules: {}
9391
scheduler: {}
9492
mysql_replication_hostgroups: {}
93+

0 commit comments

Comments
 (0)