-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresources.ps1
More file actions
72 lines (61 loc) · 1.89 KB
/
Copy pathresources.ps1
File metadata and controls
72 lines (61 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function New-MariaDBNamespace([string] $namespace,
[switch] $resourceFileOnly) {
if (-not $resourceFileOnly -and (Test-Namespace $namespace)) {
return
}
New-NamespaceResource $namespace -useGitOps:$resourceFileOnly
}
function New-MariaDBCredentialSecret([string] $namespace,
[string] $name,
[string] $rootPwd,
[string] $replicatorPwd,
[switch] $resourceFileOnly) {
$credentials = @{
'mariadb-root-password' = $rootPwd
}
if ('' -ne $replicatorPwd) {
$credentials['mariadb-replication-password'] = $replicatorPwd
}
New-GenericSecretResource $namespace $name -keyValues $credentials -useGitOps:$resourceFilesOnly
}
function New-MariaDBOptionConfigMap([string] $namespace,
[string] $name,
[string] $characterSet,
[string] $collation,
[int] $lowerCaseTableNames,
[int] $binaryLogExpirationSeconds,
[switch] $resourceFileOnly) {
$dbConfig = @'
[mysqld]
skip-name-resolve
explicit_defaults_for_timestamp
basedir=/opt/bitnami/mariadb
plugin_dir=/opt/bitnami/mariadb/plugin
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
tmpdir=/opt/bitnami/mariadb/tmp
max_allowed_packet=16M
bind-address=*
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
log-error=/opt/bitnami/mariadb/logs/mysqld.log
slow_query_log=0
slow_query_log_file=/opt/bitnami/mariadb/logs/mysqld.log
long_query_time=10.0
character-set-server={0}
collation-server={1}
lower_case_table_names={2}
binlog_expire_logs_seconds={3}
[client]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
default-character-set=UTF8
plugin_dir=/opt/bitnami/mariadb/plugin
[manager]
port=3306
socket=/opt/bitnami/mariadb/tmp/mysql.sock
pid-file=/opt/bitnami/mariadb/tmp/mysqld.pid
'@
$dbConfigFile = 'db.cnf'
$dbConfig -f $characterSet,$collation,$lowerCaseTableNames,$binaryLogExpirationSeconds | out-file $dbConfigFile -Encoding ascii -Force
New-ConfigMapResource $namespace $name -fileKeyValues @{ 'my.cnf' = $dbConfigFile } -useGitOps:$resourceFileOnly
}