From b5c8ea0e1398c5df510297145232d4dea9f6bac8 Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Wed, 13 Nov 2019 16:29:17 +0800 Subject: [PATCH] Update prometheus chart version from 7.1.0 to 9.3.0 (#1389) --- charts/README.md | 3 ++- charts/fission-all/requirements.lock | 6 +++--- charts/fission-all/requirements.yaml | 4 ++-- charts/fission-all/templates/_helpers.tpl | 4 +++- charts/fission-all/values.yaml | 10 ++++++++-- charts/fission-core/requirements.lock | 6 +++--- charts/fission-core/requirements.yaml | 4 ++-- charts/fission-core/templates/_helpers.tpl | 4 +++- charts/fission-core/values.yaml | 10 ++++++++-- pkg/canaryconfigmgr/canaryConfigMgr.go | 8 ++++++-- 10 files changed, 40 insertions(+), 19 deletions(-) diff --git a/charts/README.md b/charts/README.md index af45c208..245b171c 100644 --- a/charts/README.md +++ b/charts/README.md @@ -62,7 +62,8 @@ Parameter | Description | Default `pruneInterval` | The frequency of archive pruner (in minutes) | `60` `preUpgradeChecksImage` | Fission pre-install/pre-upgrade checks live in this image | `fission/pre-upgrade-checks` `debugEnv` | If there are any pod specialization errors when a function is triggered and this flag is set to true, the error summary is returned as part of http response | `true` -`prometheusDeploy` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core` +`prometheus.enabled` | Set to true if prometheus needs to be deployed along with fission | `true` in `fission-all`, `false` in `fission-core` +`prometheus.serviceEndpoint` | If prometheus.enabled is false, please assign the prometheus service URL that is accessible by components. | `nil` `canaryDeployment.enabled` | Set to true if you need canary deployment feature | `true` in `fission-all`, `false` in `fission-core` `extraCoreComponentPodConfig` | Extend the container specs for the core fission pods. Can be used to add things like affinty/tolerations/nodeSelectors/etc. | None `router.deployAsDaemonSet` | Deploy router as DaemonSet instead of Deployment | `false` diff --git a/charts/fission-all/requirements.lock b/charts/fission-all/requirements.lock index 7d1a8b06..f0c82809 100644 --- a/charts/fission-all/requirements.lock +++ b/charts/fission-all/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: prometheus repository: https://kubernetes-charts.storage.googleapis.com - version: 7.1.0 -digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe -generated: 2019-01-03T16:29:53.158684+01:00 + version: 9.3.1 +digest: sha256:33395db6ac17f57dab0e60a47a3e029c59aa4a58fb1695c73b8ea6f0754eaf0c +generated: 2019-11-09T02:56:08.384381+08:00 diff --git a/charts/fission-all/requirements.yaml b/charts/fission-all/requirements.yaml index daa0c3bd..ca606186 100644 --- a/charts/fission-all/requirements.yaml +++ b/charts/fission-all/requirements.yaml @@ -1,5 +1,5 @@ dependencies: - name: prometheus - version: 7.1.0 + version: 9.3.1 repository: https://kubernetes-charts.storage.googleapis.com - condition: prometheusDeploy \ No newline at end of file + condition: prometheus.enabled diff --git a/charts/fission-all/templates/_helpers.tpl b/charts/fission-all/templates/_helpers.tpl index f5834fae..cc024fd7 100644 --- a/charts/fission-all/templates/_helpers.tpl +++ b/charts/fission-all/templates/_helpers.tpl @@ -25,8 +25,10 @@ controller/config.go {{- define "config" -}} canary: enabled: {{ .Values.canaryDeployment.enabled }} - {{- if .Values.prometheusDeploy }} + {{- if .Values.prometheus.enabled }} prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}" + {{- else }} + prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }} {{- end }} {{- printf "\n" -}} {{- end -}} diff --git a/charts/fission-all/values.yaml b/charts/fission-all/values.yaml index 0fd8a716..4ceec430 100644 --- a/charts/fission-all/values.yaml +++ b/charts/fission-all/values.yaml @@ -214,8 +214,14 @@ preUpgradeChecksImage: fission/pre-upgrade-checks ## summary is returned as part of http response debugEnv: false -## set this flag to true if prometheus needs to be deployed along with fission -prometheusDeploy: true +## Prometheus for scrapping service metrics +prometheus: + ## set this flag to true if prometheus needs to be deployed along with fission + enabled: true + + ## If enabled is false, please assign the prometheus service URL + ## that is accessible by components. + serviceEndpoint: "" ## set this flag to false if you dont need canary deployment feature canaryDeployment: diff --git a/charts/fission-core/requirements.lock b/charts/fission-core/requirements.lock index 3658e159..56599cbb 100644 --- a/charts/fission-core/requirements.lock +++ b/charts/fission-core/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: prometheus repository: https://kubernetes-charts.storage.googleapis.com - version: 7.1.0 -digest: sha256:867c8666d4dee6ae36b0e418f132f3187fd189bcbb36875f2c06e3fbe2402cfe -generated: 2019-06-03T10:47:50.335101619Z + version: 9.3.1 +digest: sha256:33395db6ac17f57dab0e60a47a3e029c59aa4a58fb1695c73b8ea6f0754eaf0c +generated: 2019-11-09T02:56:58.282692+08:00 diff --git a/charts/fission-core/requirements.yaml b/charts/fission-core/requirements.yaml index daa0c3bd..ca606186 100644 --- a/charts/fission-core/requirements.yaml +++ b/charts/fission-core/requirements.yaml @@ -1,5 +1,5 @@ dependencies: - name: prometheus - version: 7.1.0 + version: 9.3.1 repository: https://kubernetes-charts.storage.googleapis.com - condition: prometheusDeploy \ No newline at end of file + condition: prometheus.enabled diff --git a/charts/fission-core/templates/_helpers.tpl b/charts/fission-core/templates/_helpers.tpl index df5a27ee..395f8714 100644 --- a/charts/fission-core/templates/_helpers.tpl +++ b/charts/fission-core/templates/_helpers.tpl @@ -24,8 +24,10 @@ controller/config.go {{- define "config" -}} canary: enabled: {{ .Values.canaryDeployment.enabled }} - {{- if .Values.prometheusDeploy }} + {{- if .Values.prometheus.enabled }} prometheusSvc: "http://{{ .Release.Name }}-prometheus-server.{{ .Release.Namespace }}" + {{- else }} + prometheusSvc: {{ .Values.prometheus.serviceEndpoint | default "" | quote }} {{- end }} {{- printf "\n" -}} {{- end -}} diff --git a/charts/fission-core/values.yaml b/charts/fission-core/values.yaml index 2e5bfbad..3dd4e5f9 100644 --- a/charts/fission-core/values.yaml +++ b/charts/fission-core/values.yaml @@ -155,8 +155,14 @@ preUpgradeChecksImage: fission/pre-upgrade-checks ## summary is returned as part of http response debugEnv: false -## set this flag to true if prometheus needs to be deployed along with fission -prometheusDeploy: false +## Prometheus for scrapping service metrics +prometheus: + ## set this flag to true if prometheus needs to be deployed along with fission + enabled: true + + ## If enabled is false, please assign the prometheus service URL + ## that is accessible by components. + serviceEndpoint: "" ## set this flag to false if you dont need canary deployment feature canaryDeployment: diff --git a/pkg/canaryconfigmgr/canaryConfigMgr.go b/pkg/canaryconfigmgr/canaryConfigMgr.go index dfe6417e..8ceecca5 100644 --- a/pkg/canaryconfigmgr/canaryConfigMgr.go +++ b/pkg/canaryconfigmgr/canaryConfigMgr.go @@ -67,17 +67,21 @@ func MakeCanaryConfigMgr(logger *zap.Logger, fissionClient *crd.FissionClient, k } else if strings.Contains(envVar, "PROMETHEUS_SERVER_SERVICE_PORT") { prometheusSvcPort = getEnvValue(envVar) } - if len(prometheusSvcHost) > 0 && len(prometheusSvcPort) > 0 { break } } + if len(prometheusSvcHost) == 0 && len(prometheusSvcPort) == 0 { + return nil, errors.New("unable to get prometheus service url") + } prometheusSvc = fmt.Sprintf("http://%v:%v", prometheusSvcHost, prometheusSvcPort) } + logger.Info("try to start canary config manager with prometheus service url", zap.String("prometheus", prometheusSvc)) + _, err := url.Parse(prometheusSvc) if err != nil { - return nil, fmt.Errorf("prometheus service url not found/invalid, cant create canary config manager: %v", prometheusSvc) + return nil, errors.Errorf("prometheus service url not found/invalid, cant create canary config manager: %v", prometheusSvc) } promClient, err := MakePrometheusClient(logger, prometheusSvc)