Skip to content

Commit f0eef14

Browse files
authored
Merge pull request #161 from PureStorage-OpenConnect/hsts_support
HSTS support + v.1.0.23
2 parents eb4c18c + 8d8cb28 commit f0eef14

File tree

16 files changed

+274
-116
lines changed

16 files changed

+274
-116
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ GOVET=$(GOCMD) vet
55
BINARY_NAME=pure-fa-om-exporter
66
MODULE_NAME=purestorage/fa-openmetrics-exporter
77
UserAgentBase=Pure_FA_OpenMetrics_exporter
8-
VERSION?=1.0.22
8+
VERSION?=1.0.23
99
SERVICE_PORT?=9490
1010
DOCKER_REGISTRY?= quay.io/purestorage/
1111
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true

build/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM golang:alpine as build
2-
ARG VERSION=1.0.22
2+
ARG VERSION=1.0.23
33
ARG UserAgentBase=Pure_FA_OpenMetrics_exporter
44

55
WORKDIR /usr/src/app

cmd/fa-om-exporter/main.go

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,6 @@ func main() {
8888
addr := fmt.Sprintf("%s:%d", *host, *port)
8989
log.Printf("Start Pure FlashArray exporter %s on %s", version, addr)
9090

91-
http.HandleFunc("/", index)
92-
http.HandleFunc("/metrics/volumes", func(w http.ResponseWriter, r *http.Request) {
93-
metricsHandler(w, r)
94-
})
95-
http.HandleFunc("/metrics/hosts", func(w http.ResponseWriter, r *http.Request) {
96-
metricsHandler(w, r)
97-
})
98-
http.HandleFunc("/metrics/pods", func(w http.ResponseWriter, r *http.Request) {
99-
metricsHandler(w, r)
100-
})
101-
http.HandleFunc("/metrics/directories", func(w http.ResponseWriter, r *http.Request) {
102-
metricsHandler(w, r)
103-
})
104-
http.HandleFunc("/metrics/array", func(w http.ResponseWriter, r *http.Request) {
105-
metricsHandler(w, r)
106-
})
107-
http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
108-
metricsHandler(w, r)
109-
})
11091
if isFile(*cert) && isFile(*key) {
11192

11293
cfg := &tls.Config{
@@ -126,8 +107,55 @@ func main() {
126107
Addr: addr,
127108
}
128109

110+
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
111+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
112+
index(w, r)
113+
})
114+
http.HandleFunc("/metrics/volumes", func(w http.ResponseWriter, r *http.Request) {
115+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
116+
metricsHandler(w, r)
117+
})
118+
http.HandleFunc("/metrics/hosts", func(w http.ResponseWriter, r *http.Request) {
119+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
120+
metricsHandler(w, r)
121+
})
122+
http.HandleFunc("/metrics/pods", func(w http.ResponseWriter, r *http.Request) {
123+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
124+
metricsHandler(w, r)
125+
})
126+
http.HandleFunc("/metrics/directories", func(w http.ResponseWriter, r *http.Request) {
127+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
128+
metricsHandler(w, r)
129+
})
130+
http.HandleFunc("/metrics/array", func(w http.ResponseWriter, r *http.Request) {
131+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
132+
metricsHandler(w, r)
133+
})
134+
http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
135+
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
136+
metricsHandler(w, r)
137+
})
129138
log.Fatal(srv.ListenAndServeTLS(*cert, *key))
130139
} else {
140+
http.HandleFunc("/", index)
141+
http.HandleFunc("/metrics/volumes", func(w http.ResponseWriter, r *http.Request) {
142+
metricsHandler(w, r)
143+
})
144+
http.HandleFunc("/metrics/hosts", func(w http.ResponseWriter, r *http.Request) {
145+
metricsHandler(w, r)
146+
})
147+
http.HandleFunc("/metrics/pods", func(w http.ResponseWriter, r *http.Request) {
148+
metricsHandler(w, r)
149+
})
150+
http.HandleFunc("/metrics/directories", func(w http.ResponseWriter, r *http.Request) {
151+
metricsHandler(w, r)
152+
})
153+
http.HandleFunc("/metrics/array", func(w http.ResponseWriter, r *http.Request) {
154+
metricsHandler(w, r)
155+
})
156+
http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
157+
metricsHandler(w, r)
158+
})
131159
log.Fatal(http.ListenAndServe(addr, nil))
132160
}
133161
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ require (
66
github.com/akamensky/argparse v1.4.0
77
github.com/go-resty/resty/v2 v2.14.0
88
github.com/google/go-cmp v0.6.0
9-
github.com/prometheus/client_golang v1.20.0
9+
github.com/prometheus/client_golang v1.20.2
1010
github.com/prometheus/client_model v0.6.1
1111
gopkg.in/yaml.v3 v3.0.1
1212
)
@@ -17,7 +17,7 @@ require (
1717
github.com/klauspost/compress v1.17.9 // indirect
1818
github.com/kr/text v0.2.0 // indirect
1919
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
20-
github.com/prometheus/common v0.55.0 // indirect
20+
github.com/prometheus/common v0.58.0 // indirect
2121
github.com/prometheus/procfs v0.15.1 // indirect
2222
golang.org/x/net v0.28.0 // indirect
2323
golang.org/x/sys v0.24.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
1919
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
2020
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
2121
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
22-
github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI=
23-
github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
22+
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
23+
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
2424
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
2525
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
26-
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
27-
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
26+
github.com/prometheus/common v0.58.0 h1:N+N8vY4/23r6iYfD3UQZUoJPnUYAo7v6LG5XZxjZTXo=
27+
github.com/prometheus/common v0.58.0/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
2828
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
2929
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
3030
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=

vendor/github.com/prometheus/client_golang/prometheus/process_collector.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/prometheus/common/expfmt/decode.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/prometheus/common/expfmt/encode.go

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/prometheus/common/expfmt/expfmt.go

Lines changed: 30 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)