Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
097ae84
feat: [pod autosharding] transition from labelselector to fieldselector
pkoutsovasilis Mar 21, 2024
3fc9535
docs: reorganize documentation directory structure
ovidiutirla Apr 3, 2024
66601c2
chore: fix doccheck to lookup recursively
ovidiutirla Apr 3, 2024
1669ae6
test: lookup recursively for docs in e2e test
ovidiutirla Apr 3, 2024
d4ae486
Merge pull request #2360 from kubernetes/release-2.12
k8s-ci-robot Apr 3, 2024
7aa1659
chore: Replace VERSION file with data.yaml
mrueg Apr 3, 2024
2089503
Merge pull request #2361 from mrueg/template-more
k8s-ci-robot Apr 4, 2024
071c523
chore: update log message
ovidiutirla Apr 4, 2024
ea8a7f8
Merge pull request #2358 from ovidiutirla/reorg-docs
k8s-ci-robot Apr 4, 2024
b72faf3
chore: use string verb to format logging messages in tests
ovidiutirla Apr 4, 2024
d7d561f
Merge pull request #2363 from ovidiutirla/fix-ci-after-docs-reorg
mrueg Apr 4, 2024
fd2a1f8
chore: Build with go 1.22
mrueg Apr 3, 2024
851c01d
chore: Bump markdownlint-cli2 to 0.13.0
mrueg Apr 4, 2024
0c03042
chore: Update prometheus to 2.51.1
mrueg Apr 4, 2024
07364ba
build(deps): Bump github.com/prometheus/client_model from 0.6.0 to 0.6.1
dependabot[bot] Apr 8, 2024
6239529
Merge pull request #2364 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Apr 8, 2024
e8a9bcf
build(deps): Bump github.com/prometheus/common from 0.51.1 to 0.52.2
dependabot[bot] Apr 8, 2024
1be8daf
Merge pull request #2365 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Apr 8, 2024
9e85514
Merge pull request #2362 from mrueg/go-1.22
k8s-ci-robot Apr 8, 2024
ff78ed0
build(deps): Bump github.com/prometheus/common from 0.52.2 to 0.52.3
dependabot[bot] Apr 15, 2024
ba23b77
Merge pull request #2369 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Apr 15, 2024
a40944b
feat: add kube_persistentvolume_volume_mode metric
ricardoapl Apr 15, 2024
610918e
fixup! feat: add kube_persistentvolume_volume_mode metric
ricardoapl Apr 15, 2024
ef4fcea
refactor: reduce cyclomatic complexity
ricardoapl Apr 17, 2024
b1b8d24
refactor: remove unused var
ricardoapl Apr 17, 2024
8684667
build(deps): Bump github.com/prometheus/common from 0.52.3 to 0.53.0
dependabot[bot] Apr 22, 2024
8b8c93c
Merge pull request #2378 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Apr 22, 2024
6d8f757
feat: Support k8s 1.30
mrueg Apr 22, 2024
9e6e70d
Merge pull request #2370 from ricardoapl/kube_persistentvolume_volume…
k8s-ci-robot Apr 22, 2024
a0f5ebe
ci: generate sbom on release
ricardoapl Apr 24, 2024
7fc6c5d
ci: fetch tag name on release
ricardoapl Apr 25, 2024
2a23510
ci: trigger on release but not on pre-release
ricardoapl Apr 25, 2024
2b8eea4
Merge pull request #2379 from mrueg/k8s-1.30.0
k8s-ci-robot May 2, 2024
a5e168f
build: bump deps to fix CVEs
jwilder May 1, 2024
93e8d99
build(deps): Bump github.com/prometheus/client_golang
dependabot[bot] May 13, 2024
63a7bc9
Merge pull request #2389 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot May 13, 2024
fa083b5
Merge pull request #2385 from jwilder/jwilder/cves
k8s-ci-robot May 13, 2024
2b2d1dc
build(deps): Bump the k8s-dependencies group with 5 updates
dependabot[bot] May 20, 2024
7caed23
Merge pull request #2394 from kubernetes/dependabot/go_modules/k8s-de…
k8s-ci-robot May 20, 2024
8867e6e
Restrict permissions for GITHUB_TOKEN
ricardoapl May 22, 2024
b983ed5
Pin dependencies in GitHub Actions by hash
ricardoapl May 22, 2024
b6697e5
ci: rename asset to pass CLOMonitor checks
ricardoapl May 24, 2024
d8dd6e0
Merge pull request #2396 from ricardoapl/pin-github-actions
k8s-ci-robot May 24, 2024
d01fb79
build(deps): Bump amannn/action-semantic-pull-request
dependabot[bot] May 27, 2024
85762cd
Merge pull request #2401 from kubernetes/dependabot/github_actions/am…
k8s-ci-robot May 27, 2024
8c75a8b
docs: add policy for consuming and upgrading dependencies
ricardoapl May 27, 2024
9917008
docs: lint markdown
ricardoapl May 28, 2024
bb0a33c
build(deps): Bump github.com/hairyhenderson/gomplate/v3 in /tools
dependabot[bot] Jun 3, 2024
c38f24b
build(deps): Bump github.com/spf13/viper from 1.18.2 to 1.19.0
dependabot[bot] Jun 3, 2024
ab03a29
Merge pull request #2409 from kubernetes/dependabot/go_modules/tools/…
k8s-ci-robot Jun 3, 2024
a4ddfe6
Merge pull request #2410 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Jun 3, 2024
f28abc9
Merge pull request #2347 from pkoutsovasilis/pkoutsovasilis/autoshard…
k8s-ci-robot Jun 4, 2024
7995d5f
Merge pull request #2402 from ricardoapl/add-dependencies-policy
k8s-ci-robot Jun 4, 2024
738e6be
Add SSF Best practices badge and community section
mrueg Jun 4, 2024
e97933b
fix(server): Add read and write timeouts
Pokom Jun 5, 2024
b4f032e
Add additional flags for IdleTimeouts
Pokom Jun 6, 2024
28dbd26
Create variables for default values of new flags
Pokom Jun 7, 2024
ee39139
Update docs/developer/cli-arguments.md
Pokom Jun 7, 2024
698f76a
build(deps): Bump github.com/prometheus/common from 0.53.0 to 0.54.0
dependabot[bot] Jun 10, 2024
3a81bf3
Merge pull request #2416 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Jun 10, 2024
669b501
Merge pull request #2381 from ricardoapl/generate-sbom-workflow
k8s-ci-robot Jun 10, 2024
cd460fe
Update cli-arguments.md
Pokom Jun 11, 2024
89f0db6
Merge pull request #2395 from ricardoapl/fix-github-token-permissions
k8s-ci-robot Jun 14, 2024
8760088
build(deps): Bump the k8s-dependencies group with 6 updates
dependabot[bot] Jun 17, 2024
9f61037
build(deps): Bump github.com/spf13/cobra from 1.8.0 to 1.8.1
dependabot[bot] Jun 17, 2024
dba6d4d
build(deps): Bump actions/checkout from 4.1.3 to 4.1.7
dependabot[bot] Jun 17, 2024
5d387b0
Merge pull request #2422 from kubernetes/dependabot/go_modules/k8s-de…
k8s-ci-robot Jun 17, 2024
124117f
Merge pull request #2412 from grafana/fix/add-server-timeouts
k8s-ci-robot Jun 17, 2024
f954f30
Merge pull request #2423 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Jun 17, 2024
c99e26a
Merge pull request #2425 from kubernetes/dependabot/github_actions/ac…
k8s-ci-robot Jun 17, 2024
5ac3eff
build(deps): Bump kubernetes-sigs/release-actions from 0.1.4 to 0.2.0
dependabot[bot] Jun 17, 2024
9dfddac
Publish OpenVEX data on release
ricardoapl May 23, 2024
2bd0b60
Avoid trigger OpenVEX on pre-release
ricardoapl May 23, 2024
fba4a75
Fix permissions for uploading to release
ricardoapl Jun 17, 2024
4269ab1
Apply consistent format across workflow files
ricardoapl Jun 17, 2024
2aa41ee
Merge pull request #2426 from kubernetes/dependabot/github_actions/ku…
k8s-ci-robot Jun 18, 2024
086af0c
Merge pull request #2398 from ricardoapl/publish-openvex-on-release
k8s-ci-robot Jun 18, 2024
1483f22
build(deps): Bump k8s.io/klog/v2 in the k8s-dependencies group
dependabot[bot] Jun 24, 2024
f4ab888
Merge pull request #2430 from kubernetes/dependabot/go_modules/k8s-de…
k8s-ci-robot Jun 25, 2024
eb80c09
enhancement: add `livez` endpoint
rexagod Jun 12, 2024
6f8f7d1
fixup! enhancement: add `livez` endpoint
rexagod Jun 25, 2024
d862cac
Merge pull request #2418 from rexagod/livez
k8s-ci-robot Jun 25, 2024
dc86ade
Merge pull request #2411 from mrueg/clomonitor-readme
k8s-ci-robot Jun 28, 2024
f6c5a4b
build(deps): Bump amannn/action-semantic-pull-request
dependabot[bot] Jul 1, 2024
d01ed2f
build(deps): Bump github.com/prometheus/common from 0.54.0 to 0.55.0
dependabot[bot] Jul 1, 2024
6e1ca99
Merge pull request #2437 from kubernetes/dependabot/github_actions/am…
k8s-ci-robot Jul 1, 2024
85d1423
Merge pull request #2438 from kubernetes/dependabot/go_modules/github…
k8s-ci-robot Jul 1, 2024
dae1f06
fix: add `readyz` endpoint
rexagod Jul 3, 2024
b980579
fixup! fix: add `readyz` endpoint
rexagod Jul 5, 2024
b954ff6
build(deps): Bump actions/setup-go from 5.0.1 to 5.0.2
dependabot[bot] Jul 15, 2024
a1fb0ce
Merge pull request #2448 from kubernetes/dependabot/github_actions/ac…
k8s-ci-robot Jul 15, 2024
dbb0276
fixup! fixup! fix: add `readyz` endpoint
rexagod Jul 8, 2024
f7618df
Merge pull request #2442 from rexagod/readyz
k8s-ci-robot Jul 15, 2024
eea0524
Add automatic detection of memory limits
SuperQ Jul 12, 2024
5972617
Merge pull request #2447 from SuperQ/auto_memlimit
k8s-ci-robot Jul 16, 2024
2e4b3e4
chore: add kustomization to standard example
sanadhis Jul 10, 2024
7104d57
Merge pull request #2444 from sanadhis/chore-add-kustomization
k8s-ci-robot Jul 16, 2024
b4f4dff
Bump dependencies
mrueg Jun 14, 2024
b8c1166
*: Cut 2.13.0
mrueg Jun 14, 2024
76c5888
Merge pull request #2419 from mrueg/prep-2.13.0
k8s-ci-robot Jul 19, 2024
25476b4
Merge tag 'refs/tags/v2.13.0'
github-actions[bot] Jul 30, 2024
fcf9f02
[bot] add VERSION file with 2.13.0
github-actions[bot] Jul 30, 2024
69dadfe
[bot] remove dependabot config
github-actions[bot] Jul 30, 2024
414a9fa
[bot] vendor: revendor
github-actions[bot] Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
18 changes: 0 additions & 18 deletions .github/dependabot.yml

This file was deleted.

38 changes: 19 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ env:
E2E_SETUP_KIND: yes
E2E_SETUP_KUBECTL: yes
SUDO: sudo
GO_VERSION: "^1.20"
GOLANGCI_LINT_VERSION: "v1.54.2"
GO_VERSION: "^1.22"
GOLANGCI_LINT_VERSION: "v1.56.2"

jobs:
ci-go-lint:
name: ci-go-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -51,10 +51,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -72,10 +72,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -93,10 +93,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -114,10 +114,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -135,7 +135,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup promtool
run: |
Expand All @@ -150,10 +150,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -171,10 +171,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand All @@ -192,10 +192,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
id: go
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- cron: '0 0 * * 1'

env:
GO_VERSION: "^1.20"
GO_VERSION: "^1.22"

permissions:
contents: read
Expand All @@ -15,10 +15,10 @@ jobs:
ci-security-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
name: Checkout code
- name: Set up Go 1.x
uses: actions/setup-go@v5
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ env.GO_VERSION }}
- name: Install govulncheck binary
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/openvex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,35 @@ name: openvex
on:
workflow_dispatch:
release:
types: [published]
types:
- released

permissions:
contents: read

jobs:
vexctl:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set environment variables
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- uses: openvex/generate-vex@c59881b41451d7ccba5c3b74cd195382b8971fcd
# Refer: https://github.com/openvex/vexctl#operational-model
name: Run vexctl
with:
product: pkg:golang/k8s.io/kube-state-metrics/v2@${{ env.RELEASE_VERSION }}
file: kube-state-metrics.openvex.json

- name: Upload OpenVEX document to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ env.RELEASE_VERSION }} kube-state-metrics.openvex.json
41 changes: 41 additions & 0 deletions .github/workflows/sbom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Generate SBOM with Kubernetes BOM

on:
release:
types:
- released

permissions:
contents: read

jobs:
sbom:
runs-on: ubuntu-latest

permissions:
contents: write

env:
OUTPUT: sbom.spdx
TAG: ${{ github.event.release.tag_name }}

steps:
- name: Fetch source code into GITHUB_WORKSPACE
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Install Kubernetes BOM
uses: kubernetes-sigs/release-actions/setup-bom@2f8b9ec22aedc9ce15039b6c7716aa6c2907df1c # v0.2.0

- name: Generate SBOM
run: |
bom generate \
--dirs=. \
--image=registry.k8s.io/kube-state-metrics/kube-state-metrics:$TAG \
--namespace=https://github.com/kubernetes/kube-state-metrics/releases/download/$TAG/$OUTPUT
--output=$OUTPUT

- name: Upload SBOM to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload $TAG $OUTPUT
2 changes: 1 addition & 1 deletion .github/workflows/semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
name: Validate PR title for semantic commit message
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
deadline: 5m
deadline: 10m

linters:
disable-all: true
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## v2.13.0 / 2024-07-18

### Note

* This release builds with Golang `v1.22.5`.
* This release builds with `k8s.io/client-go`: `v0.30.3`.
* This release adds read and write timeouts for requests. The defaults might have an impact on scrapes that take a long time.

* [BUGFIX] Pod autosharding: transition from labelselector to fieldselector by @pkoutsovasilis in <https://github.com/kubernetes/kube-state-metrics/pull/2347>
* [ENHANCEMENT] Add automatic detection of memory limits by @SuperQ in <https://github.com/kubernetes/kube-state-metrics/pull/2447>
* [FEATURE] Add `readyz` endpoint by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2442>
* [FEATURE] Add `livez` endpoint by @rexagod in <https://github.com/kubernetes/kube-state-metrics/pull/2418>
* [FEATURE] Add kube_persistentvolume_volume_mode metric by @ricardoapl in <https://github.com/kubernetes/kube-state-metrics/pull/2370>
* [FEATURE] Add read and write timeouts by @Pokom in <https://github.com/kubernetes/kube-state-metrics/pull/2412>

## v2.12.0 / 2024-04-02

### Note
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG GOVERSION=1.20
ARG GOVERSION=1.22
ARG GOARCH
FROM golang:${GOVERSION} as builder
ARG GOARCH
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FLAGS =
TESTENVVAR =
REGISTRY ?= gcr.io/k8s-staging-kube-state-metrics
TAG_PREFIX = v
VERSION = $(shell cat VERSION)
VERSION = $(shell gomplate -d config=./data.yaml --in '{{ (datasource "config").version }}')
TAG ?= $(TAG_PREFIX)$(VERSION)
LATEST_RELEASE_BRANCH := release-$(shell grep -ohE "[0-9]+.[0-9]+" VERSION)
LATEST_RELEASE_BRANCH := release-$(shell echo $(VERSION) | grep -ohE "[0-9]+.[0-9]+")
BRANCH = $(strip $(shell git rev-parse --abbrev-ref HEAD))
DOCKER_CLI ?= docker
PROMTOOL_CLI ?= promtool
Expand All @@ -15,13 +15,13 @@ GIT_COMMIT ?= $(shell git rev-parse --short HEAD)
OS ?= $(shell uname -s | tr A-Z a-z)
ALL_ARCH = amd64 arm arm64 ppc64le s390x
PKG = github.com/prometheus/common
PROMETHEUS_VERSION = 2.46.0
GO_VERSION = 1.21.8
PROMETHEUS_VERSION = 2.53.1
GO_VERSION = 1.22.5
IMAGE = $(REGISTRY)/kube-state-metrics
MULTI_ARCH_IMG = $(IMAGE)-$(ARCH)
USER ?= $(shell id -u -n)
HOST ?= $(shell hostname)
MARKDOWNLINT_CLI2_VERSION = 0.9.2
MARKDOWNLINT_CLI2_VERSION = 0.13.0


export DOCKER_CLI_EXPERIMENTAL=enabled
Expand All @@ -48,19 +48,19 @@ lint: shellcheck licensecheck lint-markdown-format

lint-fix: fix-markdown-format
golangci-lint run --fix -v


doccheck: generate validate-template
@echo "- Checking if the generated documentation is up to date..."
@git diff --exit-code
@echo "- Checking if the documentation is in sync with the code..."
@grep -hoE -d skip '\| kube_[^ |]+' docs/* --exclude=README.md | sed -E 's/\| //g' | sort -u > documented_metrics
@grep -rhoE '\| kube_[^ |]+' docs/metrics/* --exclude=README.md | sed -E 's/\| //g' | sort -u > documented_metrics
@find internal/store -type f -not -name '*_test.go' -exec sed -nE 's/.*"(kube_[^"]+)".*/\1/p' {} \; | sort -u > code_metrics
@diff -u0 code_metrics documented_metrics || (echo "ERROR: Metrics with - are present in code but missing in documentation, metrics with + are documented but not found in code."; exit 1)
@echo OK
@rm -f code_metrics documented_metrics
@echo "- Checking for orphan documentation files"
@cd docs; for doc in *.md; do if [ "$$doc" != "README.md" ] && ! grep -q "$$doc" *.md; then echo "ERROR: No link to documentation file $${doc} detected"; exit 1; fi; done
@cd docs; for doc in $$(find metrics/* -name '*.md' | sed 's/.*\///'); do if [ "$$doc" != "README.md" ] && ! grep -q "$$doc" *.md; then echo "ERROR: No link to documentation file $${doc} detected"; exit 1; fi; done
@echo OK

build-local:
Expand Down Expand Up @@ -151,17 +151,17 @@ examples/prometheus-alerting-rules/alerts.yaml: jsonnet $(shell find jsonnet | g

examples: examples/standard examples/autosharding examples/daemonsetsharding mixin

examples/standard: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/standard.jsonnet scripts/vendor VERSION
examples/standard: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/standard.jsonnet scripts/vendor
mkdir -p examples/standard
jsonnet -J scripts/vendor -m examples/standard --ext-str version="$(VERSION)" scripts/standard.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
find examples -type f ! -name '*.yaml' -delete

examples/autosharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/autosharding.jsonnet scripts/vendor VERSION
examples/autosharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/autosharding.jsonnet scripts/vendor
mkdir -p examples/autosharding
jsonnet -J scripts/vendor -m examples/autosharding --ext-str version="$(VERSION)" scripts/autosharding.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
find examples -type f ! -name '*.yaml' -delete

examples/daemonsetsharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/daemonsetsharding.jsonnet scripts/vendor VERSION
examples/daemonsetsharding: jsonnet $(shell find jsonnet | grep ".libsonnet") scripts/daemonsetsharding.jsonnet scripts/vendor
mkdir -p examples/daemonsetsharding
jsonnet -J scripts/vendor -m examples/daemonsetsharding --ext-str version="$(VERSION)" scripts/daemonsetsharding.jsonnet | xargs -I{} sh -c 'cat {} | gojsontoyaml > `echo {} | sed "s/\(.\)\([A-Z]\)/\1-\2/g" | tr "[:upper:]" "[:lower:]"`.yaml' -- {}
find examples -type f ! -name '*.yaml' -delete
Expand Down
Loading