Skip to content

Commit 9865423

Browse files
authored
Merge pull request #71 from chrroberts-pure/make_containter_tokens
v1.0.8 - Add token support in the default docker image
2 parents a55f93f + 7b48df9 commit 9865423

File tree

5 files changed

+42
-17
lines changed

5 files changed

+42
-17
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ GOTEST=$(GOCMD) test
44
GOVET=$(GOCMD) vet
55
BINARY_NAME=pure-fa-om-exporter
66
MODULE_NAME=purestorage/fa-openmetrics-exporter
7-
VERSION?=1.0.7
7+
VERSION?=1.0.8
88
SERVICE_PORT?=9490
99
DOCKER_REGISTRY?= quay.io/purestorage/
1010
EXPORT_RESULT?=false # for CI please set EXPORT_RESULT to true

README.md

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ OpenMetrics exporter for Pure Storage FlashArray.
77
This exporter is provided under Best Efforts support by the Pure Portfolio Solutions Group, Open Source Integrations team.
88
For feature requests and bugs please use GitHub Issues.
99
We will address these as soon as we can, but there are no specific SLAs.
10-
##
1110

1211
### Overview
1312

@@ -51,19 +50,23 @@ git clone [email protected]:PureStorage-OpenConnect/pure-fa-openmetrics-exporter.gi
5150
cd pure-fa-openmetrics-exporter
5251
...
5352
make build
54-
5553
```
5654

5755
The newly built exporter executable can be found in the <kbd>./out/bin</kbd> directory.
5856

59-
### Docker image
57+
### Docker Image
6058

6159
The provided dockerfile can be used to generate a docker image of the exporter. The image can be built using docker as follows
6260

6361
```shell
64-
6562
VERSION=<version>
6663
docker build -t pure-fa-ome:$VERSION .
64+
65+
# You can also use the make file to build a docker-image
66+
67+
cd pure-fa-openmetrics-exporter
68+
...
69+
make docker-build
6770
```
6871

6972

@@ -110,6 +113,8 @@ The array token configuration file must have to following syntax:
110113
```
111114
When the array token configuration file is used, the <kbd>array_id</kbd> key must be used as the <kbd>endpoint</kbd> argument for the scraped URL.
112115

116+
For usage a usage example of how to use this feature with a Docker container, see Docker Usage Examples below.
117+
113118
### Scraping endpoints
114119

115120
The exporter uses a RESTful API schema to provide Prometheus scraping endpoints.
@@ -192,7 +197,7 @@ In a typical production scenario, it is recommended to use a visual frontend for
192197

193198
To spin up a very basic set of those containers, use the following commands:
194199
```bash
195-
# Pure exporter
200+
# Pure Storage OpenMetrics Exporter
196201
docker run -d -p 9490:9490 --name pure-fa-om-exporter quay.io/purestorage/pure-fa-om-exporter:<version>
197202

198203
# Prometheus with config via bind-volume (create config first!)
@@ -201,6 +206,21 @@ docker run -d -p 9090:9090 --name=prometheus -v /tmp/prometheus-pure.yml:/etc/pr
201206
# Grafana
202207
docker run -d -p 3000:3000 --name=grafana -v /tmp/grafana-data:/var/lib/grafana grafana/grafana
203208
```
209+
210+
#### Docker: Passing tokens.yaml file to the container
211+
On starting the container, the Dockerfile will create an empty `/etc/pure-fa-om-exporter/tokens.yaml` file whether the users requires it or not. If the file is blank, the container will successfully start. If the container has a volume attached to the `/etc/pure-fa-om-exporter/` directory containing a valid `tokens.yaml` file the container will utilize the contents.
212+
213+
```bash
214+
# Pure Storage OpenMetrics Exporter container with authentication tokens
215+
docker run -d -p 9490:9490 --name pure-fa-om-exporter --volume /hostpathtofile/tokens.yaml:/etc/pure-fa-om-exporter/tokens.yaml quay.io/purestorage/pure-fa-om-exporter:<version>
216+
```
217+
218+
Changes to the tokens.yaml file can be reloaded by restarting the Docker container.
219+
220+
```bash
221+
docker restart pure-fa-om-exporter
222+
```
223+
204224
Please have a look at the documentation of each image/application for adequate configuration examples.
205225

206226
#### Kubernetes

build/docker/Dockerfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM golang:alpine as build
2-
#version should set to development unless another build arg is passed
2+
# version should set to development unless another build arg is passed
33
ARG VERSION=development
44

55
WORKDIR /usr/src/app
@@ -11,9 +11,14 @@ RUN go mod download && go mod verify
1111
COPY . .
1212
RUN CGO_ENABLED=1 go build -a -tags 'netgo osusergo static_build' -ldflags="-X main.version=v$VERSION" -v -o /usr/local/bin/pure-fa-om-exporter cmd/fa-om-exporter/main.go
1313

14+
1415
# alpine is used here as it seems to be the minimal image that passes quay.io vulnerability scan
1516
FROM alpine
1617
COPY --from=build /usr/local/bin/pure-fa-om-exporter /pure-fa-om-exporter
18+
19+
# create an empty tokens file for use with volumes if required. You can use a mounted volume to /etc/pure-fa-om-exporter/ to pass the `tokens.yaml` file. File must be named `tokens.yaml`.
20+
RUN mkdir /etc/pure-fa-om-exporter && touch /etc/pure-fa-om-exporter/tokens.yaml
21+
1722
EXPOSE 9490
1823
ENTRYPOINT ["/pure-fa-om-exporter"]
19-
CMD ["--address", "0.0.0.0", "--port", "9490"]
24+
CMD ["--address", "0.0.0.0", "--port", "9490", "--tokens", "/etc/pure-fa-om-exporter/tokens.yaml"]

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ require (
1818
github.com/kr/text v0.2.0 // indirect
1919
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
2020
github.com/prometheus/common v0.44.0 // indirect
21-
github.com/prometheus/procfs v0.11.0 // indirect
22-
golang.org/x/net v0.11.0 // indirect
23-
golang.org/x/sys v0.9.0 // indirect
21+
github.com/prometheus/procfs v0.11.1 // indirect
22+
golang.org/x/net v0.13.0 // indirect
23+
golang.org/x/sys v0.10.0 // indirect
2424
google.golang.org/protobuf v1.31.0 // indirect
2525
)

go.sum

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUo
2626
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
2727
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
2828
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
29-
github.com/prometheus/procfs v0.11.0 h1:5EAgkfkMl659uZPbe9AS2N68a7Cc1TJbPEuGzFuRbyk=
30-
github.com/prometheus/procfs v0.11.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
29+
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
30+
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
3131
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
3232
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
33-
golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU=
34-
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
33+
golang.org/x/net v0.13.0 h1:Nvo8UFsZ8X3BhAC9699Z1j7XQ3rsZnUUm7jfBEk1ueY=
34+
golang.org/x/net v0.13.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
3535
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
3636
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3737
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
38-
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
39-
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
38+
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
39+
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
4040
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
4141
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
4242
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

0 commit comments

Comments
 (0)