Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
KubeOperator
Commits
c3aba310
Commit
c3aba310
authored
3 years ago
by
ssongliu
Browse files
Options
Download
Email Patches
Plain Diff
fix(tool): grafana 安装配置调整
parent
9e14abb9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
migration/110_upgrade_tools.up.sql
+2
-2
migration/110_upgrade_tools.up.sql
pkg/service/cluster/tools/grafana.go
+17
-20
pkg/service/cluster/tools/grafana.go
with
19 additions
and
22 deletions
+19
-22
migration/110_upgrade_tools.up.sql
+
2
-
2
View file @
c3aba310
...
...
@@ -68,7 +68,7 @@ VALUES
'6.19.0'
,
'all'
,
NULL
,
'{"grafana_image_name":"grafana/grafana","grafana_image_tag":"8.3.1","b
ats
_image_name":"
bats/bats","bats_image_tag":"v1.4.1","busybox_image_name":"
busybox","busybox_image_tag":"1.31.1","curl_image_name":"curlimages/curl","curl_image_tag":"7.73.0"}'
,
'{"grafana_image_name":"grafana/grafana","grafana_image_tag":"8.3.1","b
usybox
_image_name":"
kubeoperator/
busybox","busybox_image_tag":"1.31.1","curl_image_name":"curlimages/curl","curl_image_tag":"7.73.0"}'
,
date_add
(
now
(),
interval
8
HOUR
),
date_add
(
now
(),
interval
8
HOUR
)
);
...
...
@@ -76,7 +76,7 @@ VALUES
UPDATE
`ko`
.
`ko_cluster_tool_detail`
SET
vars
=
'{"grafana_image_name":"grafana/grafana","grafana_image_tag":"7.3.3","
bats_image_name":"bats/bats","bats_image_tag":"v1.1.0","
busybox_image_name":"kubeoperator/busybox","busybox_image_tag":"1.28","curl_image_name":"curlimages/curl","curl_image_tag":"7.73.0"}'
vars
=
'{"grafana_image_name":"grafana/grafana","grafana_image_tag":"7.3.3","busybox_image_name":"kubeoperator/busybox","busybox_image_tag":"1.28","curl_image_name":"curlimages/curl","curl_image_tag":"7.73.0"}'
WHERE
name
=
'grafana'
AND
version
=
'v7.3.3'
;
...
...
This diff is collapsed.
Click to expand it.
pkg/service/cluster/tools/grafana.go
+
17
-
20
View file @
c3aba310
...
...
@@ -42,37 +42,34 @@ func (g Grafana) setDefaultValue(toolDetail model.ClusterToolDetail, isInstall b
values
[
"initChownData.image.tag"
]
=
imageMap
[
"busybox_image_tag"
]
values
[
"downloadDashboardsImage.repository"
]
=
fmt
.
Sprintf
(
"%s:%d/%s"
,
g
.
LocalHostName
,
g
.
LocalRepositoryPort
,
imageMap
[
"curl_image_name"
])
values
[
"downloadDashboardsImage.tag"
]
=
imageMap
[
"curl_image_tag"
]
values
[
"testFramework.image"
]
=
fmt
.
Sprintf
(
"%s:%d/%s"
,
g
.
LocalHostName
,
g
.
LocalRepositoryPort
,
imageMap
[
"bats_image_name"
])
values
[
"testFramework.tag"
]
=
imageMap
[
"bats_image_tag"
]
if
isInstall
{
values
[
"grafana
\\
.ini.server.root_url"
]
=
"%(protocol)s://%(domain)s:%(http_port)s/proxy/grafana/"
+
g
.
Cluster
.
Name
+
"/"
values
[
"grafana
\\
.ini.server.serve_from_sub_path"
]
=
true
values
[
"datasources.
'
datasources
\\
.yaml
'
.apiVersion"
]
=
1
values
[
"datasources.datasources
\\
.yaml.apiVersion"
]
=
1
if
len
(
g
.
prometheusNs
)
!=
0
{
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[0].name"
]
=
"MYDS_Prometheus"
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[0].type"
]
=
"prometheus"
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[0].url"
]
=
"http://prometheus-server."
+
g
.
prometheusNs
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[0].access"
]
=
"proxy"
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[0].isDefault"
]
=
true
values
[
"datasources.datasources
\\
.yaml.datasources[0].name"
]
=
"MYDS_Prometheus"
values
[
"datasources.datasources
\\
.yaml.datasources[0].type"
]
=
"prometheus"
values
[
"datasources.datasources
\\
.yaml.datasources[0].url"
]
=
"http://prometheus-server."
+
g
.
prometheusNs
values
[
"datasources.datasources
\\
.yaml.datasources[0].access"
]
=
"proxy"
values
[
"datasources.datasources
\\
.yaml.datasources[0].isDefault"
]
=
true
}
if
len
(
g
.
lokiNs
)
!=
0
{
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[1].name"
]
=
"Loki"
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[1].type"
]
=
"loki"
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[1].url"
]
=
"http://loki."
+
g
.
lokiNs
+
":3100"
values
[
"datasources.
'
datasources
\\
.yaml
'
.datasources[1].access"
]
=
"proxy"
values
[
"datasources.datasources
\\
.yaml.datasources[1].name"
]
=
"Loki"
values
[
"datasources.datasources
\\
.yaml.datasources[1].type"
]
=
"loki"
values
[
"datasources.datasources
\\
.yaml.datasources[1].url"
]
=
"http://loki."
+
g
.
lokiNs
+
":3100"
values
[
"datasources.datasources
\\
.yaml.datasources[1].access"
]
=
"proxy"
}
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.apiVersion"
]
=
1
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].name"
]
=
"default"
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].orgId"
]
=
1
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].folder"
]
=
""
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].type"
]
=
"file"
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].disableDeletion"
]
=
false
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].editable"
]
=
true
values
[
"dashboardProviders.'dashboardproviders
\\
.yaml'.providers[0].options.path"
]
=
"/var/lib/grafana/dashboards/default"
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.apiVersion"
]
=
1
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.providers[0].name"
]
=
"default"
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.providers[0].orgId"
]
=
1
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.providers[0].type"
]
=
"file"
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.providers[0].disableDeletion"
]
=
false
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.providers[0].editable"
]
=
true
values
[
"dashboardProviders.dashboardproviders
\\
.yaml.providers[0].options.path"
]
=
"/var/lib/grafana/dashboards/default"
values
[
"dashboards.default.custom-dashboard.file"
]
=
"dashboards/custom-dashboard.json"
if
_
,
ok
:=
values
[
"persistence.size"
];
ok
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment