diff options
| author | chrislu <chris.lu@gmail.com> | 2023-03-08 01:48:30 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-03-08 01:48:30 -0800 |
| commit | 7111c08289e9e6f673ae252c8e0fda1e86294390 (patch) | |
| tree | e9131e0d91c2de415befc1a42d005b09702004b4 | |
| parent | c589e9837cad8e856d98991444a4ac3dc479bdd9 (diff) | |
| parent | 244385bf0d5ed9be2554619005fb1e469980632c (diff) | |
| download | seaweedfs-7111c08289e9e6f673ae252c8e0fda1e86294390.tar.xz seaweedfs-7111c08289e9e6f673ae252c8e0fda1e86294390.zip | |
Merge branch 'master' of https://github.com/seaweedfs/seaweedfs
| -rw-r--r-- | k8s/charts/seaweedfs/templates/filer-statefulset.yaml | 6 | ||||
| -rw-r--r-- | k8s/charts/seaweedfs/values.yaml | 12 | ||||
| -rw-r--r-- | weed/stats/metrics.go | 12 |
3 files changed, 28 insertions, 2 deletions
diff --git a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml index 4b616fde1..b7227f934 100644 --- a/k8s/charts/seaweedfs/templates/filer-statefulset.yaml +++ b/k8s/charts/seaweedfs/templates/filer-statefulset.yaml @@ -97,6 +97,12 @@ spec: value: {{ $value | quote }} {{- end }} {{- end }} + {{- if .Values.filer.secretExtraEnvironmentVars }} + {{- range $key, $value := .Values.filer.secretExtraEnvironmentVars }} + - name: {{ $key }} + valueFrom: {{ toYaml $value | nindent 16 }} + {{- end }} + {{- end }} command: - "/bin/sh" - "-ec" diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml index 520a00307..1e2801e42 100644 --- a/k8s/charts/seaweedfs/values.yaml +++ b/k8s/charts/seaweedfs/values.yaml @@ -407,6 +407,18 @@ filer: # directories under this folder will be automatically creating a separate bucket WEED_FILER_BUCKETS_FOLDER: "/buckets" + + # secret env variables + secretExtraEnvironmentVars: [] + # WEED_POSTGRES_USERNAME: + # secretKeyRef: + # name: postgres-credentials + # key: username + # WEED_POSTGRES_PASSWORD: + # secretKeyRef: + # name: postgres-credentials + # key: password + s3: enabled: true port: 8333 diff --git a/weed/stats/metrics.go b/weed/stats/metrics.go index a9a24ce31..454b35d7a 100644 --- a/weed/stats/metrics.go +++ b/weed/stats/metrics.go @@ -1,7 +1,6 @@ package stats import ( - "fmt" "log" "net" "net/http" @@ -282,12 +281,21 @@ func LoopPushingMetric(name, instance, addr string, intervalSeconds int) { } } +func JoinHostPort(host string, port int) string { + portStr := strconv.Itoa(port) + if strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]") { + return host + ":" + portStr + } + return net.JoinHostPort(host, portStr) +} + + func StartMetricsServer(ip string, port int) { if port == 0 { return } http.Handle("/metrics", promhttp.HandlerFor(Gather, promhttp.HandlerOpts{})) - log.Fatal(http.ListenAndServe(fmt.Sprintf("%s:%d", ip, port), nil)) + log.Fatal(http.ListenAndServe(JoinHostPort(ip, port), nil)) } func SourceName(port uint32) string { |
