Skip to content

Commit

Permalink
Merge pull request #897 from fao89/oc
Browse files Browse the repository at this point in the history
Use oc kustomize instead of kustomize to build the docs
  • Loading branch information
openshift-merge-bot[bot] authored Oct 21, 2024
2 parents c43c0f2 + a95786d commit 01e2318
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,8 @@ docs-clean:
rm -r docs_build

.PHONY: docs-examples
docs-kustomize-examples: export KUSTOMIZE_VERSION=v5.0.1
docs-kustomize-examples: yq kustomize ## Generate updated docs from examples using kustomize
KUSTOMIZE=$(KUSTOMIZE) LOCALBIN=$(LOCALBIN) ./docs/kustomize_to_docs.sh
docs-kustomize-examples: oc yq ## Generate updated docs from examples using kustomize
LOCALBIN=$(LOCALBIN) ./docs/kustomize_to_docs.sh

##@ General

Expand Down Expand Up @@ -276,6 +275,7 @@ CONTROLLER_TOOLS_VERSION ?= v0.11.1
CRD_MARKDOWN_VERSION ?= v0.0.3
KUTTL_VERSION ?= 0.17.0
GOTOOLCHAIN_VERSION ?= go1.21.0
OC_VERSION ?= 4.14.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -369,11 +369,17 @@ endif
endif

.PHONY: yq
yq: ## Download and install yq in local env
yq: $(LOCALBIN) ## Download and install yq in local env
test -s $(LOCALBIN)/yq || ( cd $(LOCALBIN) &&\
wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64.tar.gz -O - |\
tar xz && mv yq_linux_amd64 $(LOCALBIN)/yq )

.PHONY: oc
oc: $(LOCALBIN) ## Download and install oc in local env
test -s $(LOCALBIN)/oc || ( cd $(LOCALBIN) &&\
wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/$(OC_VERSION)/openshift-client-linux-$(OC_VERSION).tar.gz -O - |\
tar xz)

# Build make variables to export for shell
MAKE_ENV := $(shell echo '$(.VARIABLES)' | awk -v RS=' ' '/^(IMAGE)|.*?(REGISTRY)$$/')
SHELL_EXPORT = $(foreach v,$(MAKE_ENV),$(v)='$($(v))')
Expand Down
4 changes: 2 additions & 2 deletions docs/kustomize_to_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BAREMETAL=docs/assemblies/ref_example-OpenStackDataPlaneNodeSet-CR-for-bare-meta
FOOTER=$(sed '0,/----/d' $BAREMETAL | sed -e '0,/----/d')
sed -i '/----/q' $BAREMETAL
sed -i 's/preprovisioned/baremetal/' config/samples/dataplane/no_vars_from/kustomization.yaml
$KUSTOMIZE --load-restrictor LoadRestrictionsNone build config/samples/dataplane/no_vars_from | $LOCALBIN/yq ' select(.kind == "OpenStackDataPlaneNodeSet")' >> $BAREMETAL
$LOCALBIN/oc kustomize --load-restrictor LoadRestrictionsNone config/samples/dataplane/no_vars_from | $LOCALBIN/yq ' select(.kind == "OpenStackDataPlaneNodeSet")' >> $BAREMETAL
sed -i 's/\/baremetal/\/preprovisioned/' config/samples/dataplane/no_vars_from/kustomization.yaml
echo -e "----\n$FOOTER" >> $BAREMETAL

Expand All @@ -32,7 +32,7 @@ done
PREPROVISIONED=docs/assemblies/ref_example-OpenStackDataPlaneNodeSet-CR-for-preprovisioned-nodes.adoc
FOOTER=$(sed '0,/----/d' $PREPROVISIONED | sed -e '0,/----/d')
sed -i '/----/q' $PREPROVISIONED
$KUSTOMIZE --load-restrictor LoadRestrictionsNone build config/samples/dataplane/no_vars_from | $LOCALBIN/yq ' select(.kind == "OpenStackDataPlaneNodeSet")' >> $PREPROVISIONED
$LOCALBIN/oc kustomize --load-restrictor LoadRestrictionsNone config/samples/dataplane/no_vars_from | $LOCALBIN/yq ' select(.kind == "OpenStackDataPlaneNodeSet")' >> $PREPROVISIONED
echo -e "----\n$FOOTER" >> $PREPROVISIONED

COUNT=1
Expand Down

0 comments on commit 01e2318

Please sign in to comment.