Skip to content

Commit

Permalink
Enable "nosniff" for each endpoint, update helm values comment (NVIDI…
Browse files Browse the repository at this point in the history
  • Loading branch information
glowkey authored Jun 7, 2023
1 parent 1fd386d commit 8438790
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion deployment/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ image:
# for the image tag, e.g:
tag: 3.1.8-3.1.5-ubuntu20.04

# Comment the following line to stop profiling metrics from DCGM
# Change the following reference to "/etc/dcgm-exporter/default-counters.csv"
# to stop profiling metrics from DCGM
arguments: ["-f", "/etc/dcgm-exporter/dcp-metrics-included.csv"]
# NOTE: in general, add any command line arguments to arguments above
# and they will be passed through.
Expand Down
3 changes: 3 additions & 0 deletions pkg/dcgmexporter/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ func NewMetricsServer(c *Config, metrics chan string) (*MetricsServer, func(), e
}

router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-Content-Type-Options", "nosniff")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`<html>
<head><title>GPU Exporter</title></head>
<body>
Expand Down Expand Up @@ -99,6 +101,7 @@ func (s *MetricsServer) Metrics(w http.ResponseWriter, r *http.Request) {

func (s *MetricsServer) Health(w http.ResponseWriter, r *http.Request) {
if s.getMetrics() == "" {
w.Header().Set("X-Content-Type-Options", "nosniff")
w.WriteHeader(http.StatusServiceUnavailable)
w.Write([]byte("KO"))
} else {
Expand Down

0 comments on commit 8438790

Please sign in to comment.