Skip to content

Commit

Permalink
Merge pull request #161 from PureStorage-OpenConnect/hsts_support
Browse files Browse the repository at this point in the history
HSTS support + v.1.0.23
  • Loading branch information
sdodsley authored Sep 3, 2024
2 parents eb4c18c + 8d8cb28 commit f0eef14
Show file tree
Hide file tree
Showing 16 changed files with 274 additions and 116 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GOVET=$(GOCMD) vet
BINARY_NAME=pure-fa-om-exporter
MODULE_NAME=purestorage/fa-openmetrics-exporter
UserAgentBase=Pure_FA_OpenMetrics_exporter
VERSION?=1.0.22
VERSION?=1.0.23
SERVICE_PORT?=9490
DOCKER_REGISTRY?= quay.io/purestorage/
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true
Expand Down
2 changes: 1 addition & 1 deletion build/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:alpine as build
ARG VERSION=1.0.22
ARG VERSION=1.0.23
ARG UserAgentBase=Pure_FA_OpenMetrics_exporter

WORKDIR /usr/src/app
Expand Down
66 changes: 47 additions & 19 deletions cmd/fa-om-exporter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,6 @@ func main() {
addr := fmt.Sprintf("%s:%d", *host, *port)
log.Printf("Start Pure FlashArray exporter %s on %s", version, addr)

http.HandleFunc("/", index)
http.HandleFunc("/metrics/volumes", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/hosts", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/pods", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/directories", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/array", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
if isFile(*cert) && isFile(*key) {

cfg := &tls.Config{
Expand All @@ -126,8 +107,55 @@ func main() {
Addr: addr,
}

http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
index(w, r)
})
http.HandleFunc("/metrics/volumes", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
metricsHandler(w, r)
})
http.HandleFunc("/metrics/hosts", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
metricsHandler(w, r)
})
http.HandleFunc("/metrics/pods", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
metricsHandler(w, r)
})
http.HandleFunc("/metrics/directories", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
metricsHandler(w, r)
})
http.HandleFunc("/metrics/array", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
metricsHandler(w, r)
})
http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Strict-Transport-Security", "max-age=63072000; includeSubDomains")
metricsHandler(w, r)
})
log.Fatal(srv.ListenAndServeTLS(*cert, *key))
} else {
http.HandleFunc("/", index)
http.HandleFunc("/metrics/volumes", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/hosts", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/pods", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/directories", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics/array", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
http.HandleFunc("/metrics", func(w http.ResponseWriter, r *http.Request) {
metricsHandler(w, r)
})
log.Fatal(http.ListenAndServe(addr, nil))
}
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/akamensky/argparse v1.4.0
github.com/go-resty/resty/v2 v2.14.0
github.com/google/go-cmp v0.6.0
github.com/prometheus/client_golang v1.20.0
github.com/prometheus/client_golang v1.20.2
github.com/prometheus/client_model v0.6.1
gopkg.in/yaml.v3 v3.0.1
)
Expand All @@ -17,7 +17,7 @@ require (
github.com/klauspost/compress v1.17.9 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/common v0.58.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/sys v0.24.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI=
github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg=
github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8=
github.com/prometheus/common v0.58.0 h1:N+N8vY4/23r6iYfD3UQZUoJPnUYAo7v6LG5XZxjZTXo=
github.com/prometheus/common v0.58.0/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 7 additions & 7 deletions vendor/github.com/prometheus/common/expfmt/decode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions vendor/github.com/prometheus/common/expfmt/encode.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 30 additions & 23 deletions vendor/github.com/prometheus/common/expfmt/expfmt.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/prometheus/common/expfmt/text_create.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f0eef14

Please sign in to comment.