1
0
mirror of https://github.com/rancher/rke.git synced 2025-08-07 09:54:18 +00:00

Handle upgrade from metrics server 0.2.x to 0.3.x

This commit is contained in:
moelsayed 2018-10-04 23:42:01 +02:00 committed by Alena Prokharchyk
parent 496d1a46a5
commit 22dc19205f
2 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,7 @@ type MetricsServerOptions struct {
RBACConfig string RBACConfig string
Options map[string]string Options map[string]string
MetricsServerImage string MetricsServerImage string
Version string
} }
type addonError struct { type addonError struct {
@ -204,10 +205,14 @@ func (c *Cluster) deployKubeDNS(ctx context.Context) error {
func (c *Cluster) deployMetricServer(ctx context.Context) error { func (c *Cluster) deployMetricServer(ctx context.Context) error {
log.Infof(ctx, "[addons] Setting up Metrics Server") log.Infof(ctx, "[addons] Setting up Metrics Server")
s := strings.Split(c.SystemImages.MetricsServer, ":")
versionTag := s[len(s)-1]
MetricsServerConfig := MetricsServerOptions{ MetricsServerConfig := MetricsServerOptions{
MetricsServerImage: c.SystemImages.MetricsServer, MetricsServerImage: c.SystemImages.MetricsServer,
RBACConfig: c.Authorization.Mode, RBACConfig: c.Authorization.Mode,
Options: c.Monitoring.Options, Options: c.Monitoring.Options,
Version: getTagMajorVersion(versionTag),
} }
metricsYaml, err := addons.GetMetricsServerManifest(MetricsServerConfig) metricsYaml, err := addons.GetMetricsServerManifest(MetricsServerConfig)
if err != nil { if err != nil {

View File

@ -113,7 +113,13 @@ spec:
imagePullPolicy: Always imagePullPolicy: Always
command: command:
- /metrics-server - /metrics-server
{{- if eq .Version "v0.3" }}
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP
- --logtostderr
{{- else }}
- --source=kubernetes.summary_api:https://kubernetes.default.svc?kubeletHttps=true&kubeletPort=10250&useServiceAccount=true&insecure=true - --source=kubernetes.summary_api:https://kubernetes.default.svc?kubeletHttps=true&kubeletPort=10250&useServiceAccount=true&insecure=true
{{- end }}
{{ range $k,$v := .Options }} {{ range $k,$v := .Options }}
- --{{ $k }}={{ $v }} - --{{ $k }}={{ $v }}
{{ end }} {{ end }}