Skip to content

Commit

Permalink
GA: adapt to SC, NC and KC APIs graduating to v1
Browse files Browse the repository at this point in the history
The following API types have been graduated to v1:

- NC Receiver
- KC Kustomization
- SC GitRepository

In addition to that we want the API navigation entries 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 <mail@makk.es>
  • Loading branch information
makkes committed Apr 5, 2023
1 parent 40a4b91 commit 3d32a85
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion content/en/flux/components/kustomize/.gitignore
@@ -1,2 +1,2 @@
api.md
api/v*.md
kustomization.md
5 changes: 5 additions & 0 deletions content/en/flux/components/kustomize/api/_index.md
@@ -0,0 +1,5 @@
---
title: API Reference
linkTitle: API Reference
weight: 1000
---
2 changes: 1 addition & 1 deletion content/en/flux/components/kustomize/options.md
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
2 changes: 1 addition & 1 deletion content/en/flux/components/notification/.gitignore
@@ -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
@@ -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
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
2 changes: 1 addition & 1 deletion content/en/flux/components/source/.gitignore
@@ -1,4 +1,4 @@
api.md
api/v*.md
buckets.md
gitrepositories.md
helmcharts.md
Expand Down
5 changes: 5 additions & 0 deletions content/en/flux/components/source/api/_index.md
@@ -0,0 +1,5 @@
---
title: API Reference
linkTitle: API Reference
weight: 1000
---
2 changes: 1 addition & 1 deletion content/en/flux/components/source/options.md
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
23 changes: 16 additions & 7 deletions hack/import-flux2-assets.sh
Expand Up @@ -66,7 +66,7 @@ controller_version() {
cat /tmp/releases
exit 1
fi
jq -r '.[] | .tag_name' < /tmp/releases | grep -v '^v1' | sort -V | tail -n 1
jq -r '.[] | .tag_name' < /tmp/releases | sort -V | tail -n 1
}

gen_crd_doc() {
Expand Down 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 All @@ -115,9 +121,11 @@ gen_crd_doc() {
{
# source-controller CRDs
SOURCE_VER="$(controller_version source-controller)"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/api/source.md" "$COMPONENTS_DIR/source/api.md" "HUGETABLE"
SOURCE_CRD_VER="v1beta2"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/api/v1/source.md" "$COMPONENTS_DIR/source/api/v1.md" "HUGETABLE"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/api/v1beta2/source.md" "$COMPONENTS_DIR/source/api/v1beta2.md" "HUGETABLE"
SOURCE_CRD_VER="v1"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/$SOURCE_CRD_VER/gitrepositories.md" "$COMPONENTS_DIR/source/gitrepositories.md"
SOURCE_CRD_VER="v1beta2"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/$SOURCE_CRD_VER/ocirepositories.md" "$COMPONENTS_DIR/source/ocirepositories.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/$SOURCE_CRD_VER/helmrepositories.md" "$COMPONENTS_DIR/source/helmrepositories.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/source-controller/$SOURCE_VER/docs/spec/$SOURCE_CRD_VER/helmcharts.md" "$COMPONENTS_DIR/source/helmcharts.md"
Expand All @@ -127,8 +135,8 @@ gen_crd_doc() {
{
# kustomize-controller CRDs
KUSTOMIZE_VER="$(controller_version kustomize-controller)"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/api/kustomize.md" "$COMPONENTS_DIR/kustomize/api.md" "HUGETABLE"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/spec/v1beta2/kustomization.md" "$COMPONENTS_DIR/kustomize/kustomization.md"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/api/v1/kustomize.md" "$COMPONENTS_DIR/kustomize/api/v1.md" "HUGETABLE"
gen_crd_doc "https://raw.githubusercontent.com/fluxcd/kustomize-controller/$KUSTOMIZE_VER/docs/spec/v1/kustomization.md" "$COMPONENTS_DIR/kustomize/kustomization.md"
}

{
Expand All @@ -141,11 +149,12 @@ 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"
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 3d32a85

Please sign in to comment.