Skip to content

Commit e0ac2e8

Browse files
authored
Allow passing volumes & volumeMounts in values (#95)
* Allow passing `volumes` & `volumeMounts` in values * Format YAML * Updates to CI
1 parent ead21da commit e0ac2e8

File tree

6 files changed

+121
-148
lines changed

6 files changed

+121
-148
lines changed

.github/workflows/go.yaml

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,56 @@ name: Go
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
pull_request:
7-
branches: [ master ]
7+
branches: [master]
88

99
jobs:
10-
verify:
10+
staticcheck:
1111
runs-on: ubuntu-22.04
1212
steps:
13-
- uses: actions/checkout@v4
13+
- uses: actions/checkout@v4
1414

15-
- name: Set up Go
16-
uses: actions/setup-go@v4
17-
with:
18-
go-version: '>=1.21.0'
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: 1.21
1919

20-
- name: Check Formating
21-
run: make checkfmt
22-
- name: Format Code
23-
run: make fmt
24-
- name: Go Vet
25-
run: make vet
26-
- name: Go Race
27-
run: make race
28-
- name: Gocyclo
29-
run: make gocyclo
30-
- name: Lint
31-
run: make lint
32-
- name: Ineffassign
33-
run: make ineffassign
34-
- name: Misspell
35-
run: make misspell
36-
- name: Helm Lint
37-
run: make helm_lint
20+
- name: Lint
21+
run: make lint
22+
- name: Go Vet
23+
run: make vet
24+
- name: Helm Lint
25+
run: make helm_lint
3826

3927
test:
4028
runs-on: ubuntu-22.04
4129
steps:
42-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version: 1.21
36+
37+
- name: Test
38+
run: make test
39+
- name: Race
40+
run: make race
41+
- name: Benchmark
42+
run: make benchmark
43+
- name: Coverage
44+
run: make coverage
4345

44-
- name: Set up Go
45-
uses: actions/setup-go@v4
46-
with:
47-
go-version: '>=1.21.0'
48-
49-
- name: Test
50-
run: make test
51-
- name: Benchmark
52-
run: make benchmark
53-
- name: Coverage
54-
run: make coverage
55-
5646
build:
5747
runs-on: ubuntu-22.04
5848
steps:
59-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v4
50+
51+
- name: Set up Go
52+
uses: actions/setup-go@v5
53+
with:
54+
go-version: ">=1.21.0"
6055

61-
- name: Set up Go
62-
uses: actions/setup-go@v4
63-
with:
64-
go-version: '>=1.21.0'
65-
66-
- name: Compile
67-
run: make
56+
- name: Compile
57+
run: make

.github/workflows/release.yaml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ name: Release
33
on:
44
push:
55
tags:
6-
- "v*"
6+
- "v*"
77
branches:
8-
- "master"
8+
- "master"
99

1010
env:
1111
REGISTRY: ghcr.io
@@ -15,60 +15,60 @@ jobs:
1515
helm:
1616
runs-on: ubuntu-22.04
1717
steps:
18-
- uses: actions/checkout@v4
19-
with:
20-
fetch-depth: 0
21-
22-
- name: Configure Git
23-
run: |
24-
git config user.name "$GITHUB_ACTOR"
25-
git config user.email "[email protected]"
26-
27-
- name: Install Helm
28-
uses: azure/setup-helm@v1
29-
with:
30-
version: v3.4.0
31-
32-
- name: Run chart-releaser
33-
uses: helm/chart-releaser-action@v1.2.0
34-
env:
35-
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
36-
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Configure Git
23+
run: |
24+
git config user.name "$GITHUB_ACTOR"
25+
git config user.email "[email protected]"
26+
27+
- name: Install Helm
28+
uses: azure/setup-helm@v3
29+
with:
30+
version: v3.13.3
31+
32+
- name: Run chart-releaser
33+
uses: helm/chart-releaser-action@v1.6.0
34+
env:
35+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
36+
3737
releases:
3838
if: startsWith(github.ref, 'refs/tags/v')
3939
runs-on: ubuntu-22.04
4040
steps:
41-
- uses: actions/checkout@v4
42-
43-
- name: Set up Go
44-
uses: actions/setup-go@v4
45-
with:
46-
go-version: '>=1.21.0'
47-
48-
- name: Build Binaries
49-
run: |
50-
# Linux
51-
GOOS=linux GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-linux-amd64 make
52-
GOOS=linux GOARCH=arm BUILDPATH=./bin/node-cert-exporter-linux-arm make
53-
GOOS=linux GOARCH=arm64 BUILDPATH=./bin/node-cert-exporter-linux-arm64 make
54-
GOOS=linux GOARCH=386 BUILDPATH=./bin/node-cert-exporter-linux-386 make
55-
# Windows
56-
GOOS=windows GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-windows-amd64.exe make
57-
GOOS=windows GOARCH=arm BUILDPATH=./bin/node-cert-exporter-windows-arm.exe make
58-
GOOS=windows GOARCH=386 BUILDPATH=./bin/node-cert-exporter-windows-386.exe make
59-
# Darwin
60-
GOOS=darwin GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-darwin-amd64 make
61-
GOOS=darwin GOARCH=arm64 BUILDPATH=./bin/node-cert-exporter-darwin-arm64 make
62-
# Freebsd
63-
GOOS=freebsd GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-freebsd-amd64 make
64-
GOOS=freebsd GOARCH=386 BUILDPATH=./bin/node-cert-exporter-freebsd-386 make
65-
GOOS=freebsd GOARCH=arm BUILDPATH=./bin/node-cert-exporter-freebsd-arm make
66-
67-
- name: Create Release
68-
uses: ncipollo/release-action@v1
69-
with:
70-
draft: true
71-
artifacts: "./bin/*"
41+
- uses: actions/checkout@v4
42+
43+
- name: Set up Go
44+
uses: actions/setup-go@v5
45+
with:
46+
go-version: ">=1.21.0"
47+
48+
- name: Build Binaries
49+
run: |
50+
# Linux
51+
GOOS=linux GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-linux-amd64 make
52+
GOOS=linux GOARCH=arm BUILDPATH=./bin/node-cert-exporter-linux-arm make
53+
GOOS=linux GOARCH=arm64 BUILDPATH=./bin/node-cert-exporter-linux-arm64 make
54+
GOOS=linux GOARCH=386 BUILDPATH=./bin/node-cert-exporter-linux-386 make
55+
# Windows
56+
GOOS=windows GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-windows-amd64.exe make
57+
GOOS=windows GOARCH=arm BUILDPATH=./bin/node-cert-exporter-windows-arm.exe make
58+
GOOS=windows GOARCH=386 BUILDPATH=./bin/node-cert-exporter-windows-386.exe make
59+
# Darwin
60+
GOOS=darwin GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-darwin-amd64 make
61+
GOOS=darwin GOARCH=arm64 BUILDPATH=./bin/node-cert-exporter-darwin-arm64 make
62+
# Freebsd
63+
GOOS=freebsd GOARCH=amd64 BUILDPATH=./bin/node-cert-exporter-freebsd-amd64 make
64+
GOOS=freebsd GOARCH=386 BUILDPATH=./bin/node-cert-exporter-freebsd-386 make
65+
GOOS=freebsd GOARCH=arm BUILDPATH=./bin/node-cert-exporter-freebsd-arm make
66+
67+
- name: Create Release
68+
uses: ncipollo/release-action@v1
69+
with:
70+
draft: true
71+
artifacts: "./bin/*"
7272

7373
packages:
7474
if: startsWith(github.ref, 'refs/tags/v')

Makefile

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,45 +47,18 @@ $(INTDIR):
4747
@mkdir -p $@
4848
$(TBIN)/%: | $(TBIN) ; $(info $(M) building $(PACKAGE))
4949
$Q tmp=$$(mktemp -d); \
50-
env GO111MODULE=off GOPATH=$$tmp GOBIN=$(TBIN) $(GO) get $(PACKAGE) \
50+
env GOBIN=$(TBIN) $(GO) install $(PACKAGE) \
5151
|| ret=$$?; \
52-
rm -rf $$tmp ; exit $$ret
52+
#rm -rf $$tmp ; exit $$ret
5353

54-
GOLINT = $(TBIN)/golint
55-
$(BIN)/golint: PACKAGE=golang.org/x/lint/golint
56-
57-
GOCYCLO = $(TBIN)/gocyclo
58-
$(TBIN)/gocyclo: PACKAGE=github.com/fzipp/gocyclo/cmd/gocyclo
59-
60-
INEFFASSIGN = $(TBIN)/ineffassign
61-
$(TBIN)/ineffassign: PACKAGE=github.com/gordonklaus/ineffassign
62-
63-
MISSPELL = $(TBIN)/misspell
64-
$(TBIN)/misspell: PACKAGE=github.com/client9/misspell/cmd/misspell
65-
66-
GOLINT = $(TBIN)/golint
67-
$(TBIN)/golint: PACKAGE=golang.org/x/lint/golint
68-
69-
GOCOV = $(TBIN)/gocov
70-
$(TBIN)/gocov: PACKAGE=github.com/axw/gocov/...
54+
GOCILINT = $(TBIN)/golangci-lint
55+
$(TBIN)/golangci-lint: PACKAGE=github.com/golangci/golangci-lint/cmd/[email protected]
7156

7257
# Tests
7358

7459
.PHONY: lint
75-
lint: | $(GOLINT) ; $(info $(M) running golint) @ ## Runs the golint command
76-
$Q $(GOLINT) -set_exit_status $(PKGS)
77-
78-
.PHONY: gocyclo
79-
gocyclo: | $(GOCYCLO) ; $(info $(M) running gocyclo) @ ## Calculates cyclomatic complexities of functions in Go source code
80-
$Q $(GOCYCLO) -over 25 .
81-
82-
.PHONY: ineffassign
83-
ineffassign: | $(INEFFASSIGN) ; $(info $(M) running ineffassign) @ ## Detects ineffectual assignments in Go code
84-
$Q $(INEFFASSIGN) ./...
85-
86-
.PHONY: misspell
87-
misspell: | $(MISSPELL) ; $(info $(M) running misspell) @ ## Finds commonly misspelled English words
88-
$Q $(MISSPELL) .
60+
lint: | $(GOCILINT) ; $(info $(M) running golangci-lint) @ ## Runs static code analysis using golangci-lint
61+
$Q $(GOCILINT) run --timeout=5m
8962

9063
.PHONY: test
9164
test: ; $(info $(M) running go test) @ ## Runs unit tests
@@ -117,7 +90,7 @@ checkfmt: ; $(info $(M) running checkfmt) @ ## Checks if code is formatted with
11790
@test "$(shell $(SRC_FILES) gofmt -l)" = "" \
11891
|| { echo "Code not formatted, please run 'make fmt'"; exit 2; }
11992

120-
.PHONY: checkfmt
93+
.PHONY: integration-test
12194
integration-test: | $(INTDIR) docker_build ; $(info $(M) running integration tests) @ ## Run integration tests
12295
mkdir -p ${INTDIR}/ssl
12396
openssl req -new -newkey rsa:1024 -days 365 -nodes -x509 \
@@ -169,4 +142,4 @@ version: ## Print version information
169142
clean: ; $(info $(M) cleaning) @ ## Cleanup everything
170143
@rm -rfv $(BIN)
171144
@rm -rfv $(TBIN)
172-
@rm -rfv $(CURDIR)/test
145+
@rm -rfv $(CURDIR)/test

charts/node-cert-exporter/Chart.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: node-cert-exporter
33
description: A Helm chart for node-cert-exporter - An SSL certificate Prometheus exporter
44
home: https://github.com/amimof/node-cert-exporter
55
maintainers:
6-
- name: amimof
7-
url: https://github.com/amimof
6+
- name: amimof
7+
url: https://github.com/amimof
88
# A chart can be either an 'application' or a 'library' chart.
99
#
1010
# Application charts are a collection of templates that can be packaged into versioned archives
@@ -18,11 +18,11 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 1.1.6
21+
version: 1.1.7
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to
2525
# follow Semantic Versioning. They should reflect the version the application is using.
2626
appVersion: "1.1.6"
2727
sources:
28-
- https://github.com/amimof/node-cert-exporter
28+
- https://github.com/amimof/node-cert-exporter

charts/node-cert-exporter/templates/daemonset.yaml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,17 @@ spec:
4242
protocol: TCP
4343
resources:
4444
{{- toYaml .Values.resources | nindent 12 }}
45+
{{- with .Values.volumeMounts }}
4546
volumeMounts:
46-
- mountPath: /host/etc
47-
name: etc
48-
readOnly: true
47+
{{- toYaml . | nindent 12 }}
48+
{{- end }}
4949
{{- with .Values.tolerations }}
5050
tolerations:
5151
{{- toYaml . | nindent 8 }}
5252
{{- end }}
53+
{{- with .Values.volumes }}
5354
volumes:
54-
- hostPath:
55-
path: /etc
56-
type: ""
57-
name: etc
55+
{{- toYaml . | nindent 8 }}
56+
{{- end }}
5857
updateStrategy:
59-
type: RollingUpdate
58+
type: RollingUpdate

charts/node-cert-exporter/values.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ paths:
1212
- /host/etc/kubernetes/pki/
1313

1414
podAnnotations:
15-
prometheus.io/scrape: 'true'
16-
prometheus.io/port: '9117'
15+
prometheus.io/scrape: "true"
16+
prometheus.io/port: "9117"
1717

1818
tolerations:
1919
# Allow running on masters:
@@ -30,3 +30,14 @@ resources:
3030
requests:
3131
cpu: 100m
3232
memory: 128Mi
33+
34+
volumes:
35+
- hostPath:
36+
path: /etc
37+
type: ""
38+
name: etc
39+
40+
volumeMounts:
41+
- mountPath: /host/etc
42+
name: etc
43+
readOnly: true

0 commit comments

Comments
 (0)