Skip to content

Commit 0bb5998

Browse files
authored
Merge pull request #1453 from saswatamcode/add-mdox
2 parents aef8515 + 7e94f21 commit 0bb5998

25 files changed

+1178
-205
lines changed

.github/workflows/ci.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ jobs:
2222
with:
2323
go-version: ${{ env.golang-version }}
2424
- run: make --always-make generate validate && git diff --exit-code
25+
check-docs:
26+
runs-on: ubuntu-latest
27+
name: Check Documentation formatting and links
28+
steps:
29+
- uses: actions/checkout@v2
30+
with:
31+
persist-credentials: false
32+
- uses: actions/setup-go@v2
33+
with:
34+
go-version: ${{ env.golang-version }}
35+
- run: make check-docs
2536
lint:
2637
runs-on: ubuntu-latest
2738
name: Jsonnet linter

.mdox.validate.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: 1
2+
3+
validators:
4+
# Ignore localhost links.
5+
- regex: 'localhost'
6+
type: "ignore"
7+
# Ignore release links.
8+
- regex: 'https:\/\/github\.com\/prometheus-operator\/kube-prometheus\/releases'
9+
type: "ignore"

Makefile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,39 @@ SHELL=/bin/bash -o pipefail
22

33
BIN_DIR?=$(shell pwd)/tmp/bin
44

5-
EMBEDMD_BIN=$(BIN_DIR)/embedmd
5+
MDOX_BIN=$(BIN_DIR)/mdox
66
JB_BIN=$(BIN_DIR)/jb
77
GOJSONTOYAML_BIN=$(BIN_DIR)/gojsontoyaml
88
JSONNET_BIN=$(BIN_DIR)/jsonnet
99
JSONNETLINT_BIN=$(BIN_DIR)/jsonnet-lint
1010
JSONNETFMT_BIN=$(BIN_DIR)/jsonnetfmt
1111
KUBECONFORM_BIN=$(BIN_DIR)/kubeconform
12-
TOOLING=$(EMBEDMD_BIN) $(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN) $(JSONNETLINT_BIN) $(JSONNETFMT_BIN) $(KUBECONFORM_BIN)
12+
TOOLING=$(JB_BIN) $(GOJSONTOYAML_BIN) $(JSONNET_BIN) $(JSONNETLINT_BIN) $(JSONNETFMT_BIN) $(KUBECONFORM_BIN) $(MDOX_BIN)
1313

1414
JSONNETFMT_ARGS=-n 2 --max-blank-lines 2 --string-style s --comment-style s
1515

16-
all: generate fmt test
16+
MDOX_VALIDATE_CONFIG?=.mdox.validate.yaml
17+
MD_FILES_TO_FORMAT=$(shell find docs developer-workspace examples experimental jsonnet manifests -name "*.md") $(shell ls *.md)
18+
19+
all: generate fmt test docs
1720

1821
.PHONY: clean
1922
clean:
2023
# Remove all files and directories ignored by git.
2124
git clean -Xfd .
2225

23-
.PHONY: generate
24-
generate: manifests **.md
26+
.PHONY: docs
27+
docs: $(MDOX_BIN) $(shell find examples) build.sh example.jsonnet
28+
@echo ">> formatting and local/remote links"
29+
$(MDOX_BIN) fmt --soft-wraps -l --links.localize.address-regex="https://prometheus-operator.dev/.*" --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)
2530

26-
**.md: $(EMBEDMD_BIN) $(shell find examples) build.sh example.jsonnet
27-
$(EMBEDMD_BIN) -w `find . -name "*.md" | grep -v vendor`
31+
.PHONY: check-docs
32+
check-docs: $(MDOX_BIN) $(shell find examples) build.sh example.jsonnet
33+
@echo ">> checking formatting and local/remote links"
34+
$(MDOX_BIN) fmt --soft-wraps --check -l --links.localize.address-regex="https://prometheus-operator.dev/.*" --links.validate.config-file=$(MDOX_VALIDATE_CONFIG) $(MD_FILES_TO_FORMAT)
35+
36+
.PHONY: generate
37+
generate: manifests
2838

2939
manifests: examples/kustomize.jsonnet $(GOJSONTOYAML_BIN) vendor
3040
./build.sh $<

README.md

Lines changed: 41 additions & 43 deletions
Large diffs are not rendered by default.

RELEASE.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Kube-prometheus has a somehow predictable release schedule, releases were
44
historically cut in sync with OpenShift releases as per downstream needs. So
55
far there hasn't been any problem with this schedule since it is also in sync
66
with Kubernetes releases. So for every new Kubernetes release, there is a new
7-
release of kube-prometheus, although it tends to happen later.
7+
release of kube-prometheus, although it tends to happen later.
88

99
# How to cut a new release
1010

1111
> This guide is strongly based on the [prometheus-operator release
12-
instructions](https://github.com/prometheus-operator/prometheus-operator/blob/master/RELEASE.md).
12+
> instructions](https://github.com/prometheus-operator/prometheus-operator/blob/master/RELEASE.md).
1313
1414
## Branch management and versioning strategy
1515

@@ -53,19 +53,19 @@ failed or because the main branch was already up-to-date.
5353
The main branch of kube-prometheus should support the last 2 versions of
5454
Kubernetes. We need to make sure that the CI on the main branch is testing the
5555
kube-prometheus configuration against both of these versions by updating the [CI
56-
worklow](/.github/workflows/ci.yaml) to include the latest kind version and the
56+
worklow](.github/workflows/ci.yaml) to include the latest kind version and the
5757
2 latest images versions that are attached to the kind release. Once that is
58-
done, the [compatibility matrix](/README.md#kubernetes-compatibility-matrix) in
58+
done, the [compatibility matrix](README.md#kubernetes-compatibility-matrix) in
5959
the README should also be updated to reflect the CI changes.
6060

6161
## Create pull request to cut the release
6262

6363
### Pin Jsonnet dependencies
6464

6565
Pin jsonnet dependencies in
66-
[jsonnetfile.json](/jsonnet/kube-prometheus/jsonnetfile.json). Each dependency
66+
[jsonnetfile.json](jsonnet/kube-prometheus/jsonnetfile.json). Each dependency
6767
should be pinned to the latest release branch or if it doesn't have one, pinned
68-
to the latest commit.
68+
to the latest commit.
6969

7070
### Start with a fresh environment
7171

@@ -87,14 +87,14 @@ make generate
8787

8888
### Update the compatibility matrix
8989

90-
Update the [compatibility matrix](/README.md#kubernetes-compatibility-matrix) in
90+
Update the [compatibility matrix](README.md#kubernetes-compatibility-matrix) in
9191
the README, by adding the new release based on the `main` branch compatibility
9292
and removing the oldest release branch to only keep the latest 5 branches in the
9393
matrix.
9494

9595
### Update changelog
9696

97-
Iterate over the PRs that were merged between the latest release of kube-prometheus and the HEAD and add the changelog entries to the [CHANGELOG](/CHANGELOG.md).
97+
Iterate over the PRs that were merged between the latest release of kube-prometheus and the HEAD and add the changelog entries to the [CHANGELOG](CHANGELOG.md).
9898

9999
## Create release branch
100100

@@ -111,10 +111,10 @@ the main branch to be in sync with the latest changes of its dependencies.
111111

112112
### Update CI workflow
113113

114-
Update the [versions workflow](/.github/workflows/versions.yaml) to include the latest release branch and remove the oldest one to reflect the list of supported releases.
114+
Update the [versions workflow](.github/workflows/versions.yaml) to include the latest release branch and remove the oldest one to reflect the list of supported releases.
115115

116116
### Update Kubernetes versions used by kubeconform
117117

118118
Update the versions of Kubernetes used when validating manifests with
119-
kubeconform in the [Makefile](/Makefile) to align with the compatibility
119+
kubeconform in the [Makefile](Makefile) to align with the compatibility
120120
matrix.

code-of-conduct.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ This code of conduct applies both within project spaces and in public spaces
3333
when an individual is representing the project or its community.
3434

3535
Instances of abusive, harassing, or otherwise unacceptable behavior may be
36-
reported by contacting a project maintainer listed in
37-
https://github.com/prometheus-operator/prometheus-operator/blob/master/MAINTAINERS.md.
36+
reported by contacting a project maintainer listed in
37+
https://github.com/prometheus-operator/prometheus-operator/blob/master/MAINTAINERS.md.
3838

3939
This Code of Conduct is adapted from the Contributor Covenant
4040
(http://contributor-covenant.org), version 1.2.0, available at

developer-workspace/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ After your workspace start, you can deploy a kube-prometheus inside a Kind clust
2020

2121
If you are reviewing a PR, you'll have a fully-functional kubernetes cluster, generating real monitoring data that can be used to review if the proposed changes works as described.
2222

23-
If you are working on new features/bug fixes, you can regenerate kube-prometheus's YAML manifests with `make generate` and deploy it again with `make deploy`.
23+
If you are working on new features/bug fixes, you can regenerate kube-prometheus's YAML manifests with `make generate` and deploy it again with `make deploy`.
2424

2525
## Gitpod
2626

2727
Gitpod is already available to everyone to use for free. It can also run commands that we speficy in the `.gitpod.yml` file located in the root directory of the git repository, so even the cluster creation can be fully automated.
2828

29-
You can use the same workflow as mentioned in the [Codespaces](#Codespaces) section, however Gitpod doesn't have native support for any kubernetes distribution. The workaround is to create a full QEMU Virtual Machine and deploy [k3s](https://github.com/k3s-io/k3s) inside this VM. Don't worry, this whole process is already fully automated, but due to the workaround the whole workspace may be very slow.
29+
You can use the same workflow as mentioned in the [Codespaces](#codespaces) section, however Gitpod doesn't have native support for any kubernetes distribution. The workaround is to create a full QEMU Virtual Machine and deploy [k3s](https://github.com/k3s-io/k3s) inside this VM. Don't worry, this whole process is already fully automated, but due to the workaround the whole workspace may be very slow.
3030

3131
To open up a workspace with Gitpod, you can install the [Google Chrome extension](https://www.gitpod.io/docs/browser-extension/) to add a new button to Github UI and use it on PRs or from the main page. Or by directly typing in the browser `http://gitpod.io/#https://github.com/prometheus-operator/kube-prometheus/pull/<Pull Request Number>` or just `http://gitpod.io/#https://github.com/prometheus-operator/kube-prometheus`
3232

3333
![image](https://user-images.githubusercontent.com/24193764/135534546-4f6bf0e5-57cd-4e35-ad80-88bd47d64276.png)
34-

docs/EKS-cni-support.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ AWS EKS uses [CNI](https://github.com/aws/amazon-vpc-cni-k8s) networking plugin
44

55
One fatal issue that can occur is that you run out of IP addresses in your eks cluster. (Generally happens due to error configs where pods keep scheduling).
66

7-
You can monitor the `awscni` using kube-promethus with :
8-
[embedmd]:# (../examples/eks-cni-example.jsonnet)
9-
```jsonnet
7+
You can monitor the `awscni` using kube-promethus with :
8+
9+
```jsonnet mdox-exec="cat examples/eks-cni-example.jsonnet"
1010
local kp = (import 'kube-prometheus/main.libsonnet') + {
1111
values+:: {
1212
common+: {

docs/GKE-cadvisor-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ authentication. Until it does, Prometheus must use HTTP (not HTTPS)
55
for scraping.
66

77
You can configure this behavior through kube-prometheus with:
8+
89
```
910
local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') +
1011
(import 'kube-prometheus/kube-prometheus-insecure-kubelet.libsonnet') +

docs/blackbox-exporter.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
title: "Blackbox Exporter"
3-
description: "Generated API docs for the Prometheus Operator"
4-
lead: "This Document documents the types introduced by the Prometheus Operator to be consumed by users."
5-
date: 2021-03-08T08:49:31+00:00
6-
lastmod: 2021-03-08T08:49:31+00:00
7-
draft: false
8-
images: []
9-
menu:
10-
docs:
11-
parent: "kube"
122
weight: 630
133
toc: true
4+
title: Blackbox Exporter
5+
menu:
6+
docs:
7+
parent: kube
8+
lead: This Document documents the types introduced by the Prometheus Operator to be consumed by users.
9+
lastmod: "2021-03-08T08:49:31+00:00"
10+
images: []
11+
draft: false
12+
description: Generated API docs for the Prometheus Operator
13+
date: "2021-03-08T08:49:31+00:00"
1414
---
1515

1616
# Setting up a blackbox exporter
@@ -21,6 +21,7 @@ The `prometheus-operator` defines a `Probe` resource type that can be used to de
2121

2222
1. Override blackbox-related configuration parameters as needed.
2323
2. Add the following to the list of renderers to render the blackbox exporter manifests:
24+
2425
```
2526
{ ['blackbox-exporter-' + name]: kp.blackboxExporter[name] for name in std.objectFields(kp.blackboxExporter) }
2627
```

0 commit comments

Comments
 (0)