Skip to content

Commit

Permalink
GA: adapt to n-c Receiver API graduating to v1
Browse files Browse the repository at this point in the history
With fluxcd/notification-controller#498 we're graduating the Receiver
API group version to v1 and keeping all other kinds' version at
v1beta2. Therefore we need to publish API docs for both version.

In addition to that we want the API navigation entry to appear at the
bottom of the tree. To accomplish that the import script is now able
to parse a weight parameter from imported markdown specs and put it
into the front matter of the resulting file.

refs fluxcd/notification-controller#436

Signed-off-by: Max Jonas Werner <[email protected]>
  • Loading branch information
Max Jonas Werner committed Mar 23, 2023
1 parent e4abe38 commit d068deb
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion content/en/flux/components/notification/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
alert.md
api.md
api/v*.md
event.md
provider.md
receiver.md
Empty file.
5 changes: 5 additions & 0 deletions content/en/flux/components/notification/api/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: API Reference
linkTitle: API Reference
weight: 1000
---
2 changes: 1 addition & 1 deletion content/en/flux/components/notification/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Controller Options
linkTitle: Controller Options
description: "Controller command flags and defaults."
weight: 1000
weight: 1
---

To customise the controller options at install time,
Expand Down
13 changes: 10 additions & 3 deletions hack/import-flux2-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ gen_crd_doc() {
exit 1
fi

WEIGHT="$(grep -E '^<!-- menuweight:[[:digit:]]+ -->$' "$TMP" | cut -d' ' -f2|cut -d':' -f2)"
if [ -z "${WEIGHT}" ] ; then
WEIGHT=0
fi

if [ -n "$TITLE" ]; then
{
echo "---"
Expand All @@ -103,6 +108,7 @@ gen_crd_doc() {
if [ -n "$HUGETABLE" ]; then
echo "hugeTable: true"
fi
echo "weight: $WEIGHT"
echo "---"
} >> "$DEST"
grep -vE "^<!--" "$TMP" |sed '1d' >> "$DEST"
Expand Down Expand Up @@ -140,12 +146,13 @@ gen_crd_doc() {

{
# notification-controller CRDs
NOTIFICATION_VER="$(controller_version notification-controller)"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/api/notification.md" "$COMPONENTS_DIR/notification/api.md"
NOTIFICATION_VER="receiver-v1"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/api/v1/notification.md" "$COMPONENTS_DIR/notification/api/v1.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/api/v1beta2/notification.md" "$COMPONENTS_DIR/notification/api/v1beta2.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1beta2/events.md" "$COMPONENTS_DIR/notification/event.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1beta2/alerts.md" "$COMPONENTS_DIR/notification/alert.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1beta2/providers.md" "$COMPONENTS_DIR/notification/provider.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1beta2/receivers.md" "$COMPONENTS_DIR/notification/receiver.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/notification-controller/$NOTIFICATION_VER/docs/spec/v1/receivers.md" "$COMPONENTS_DIR/notification/receiver.md"
}

{
Expand Down

0 comments on commit d068deb

Please sign in to comment.