Skip to content

Commit

Permalink
Use oc kustomize instead of kustomize to build the docs
Browse files Browse the repository at this point in the history
For not mixing the kustomize versions (CRDs and docs), use oc kustomize for docs

Signed-off-by: Fabricio Aguiar <[email protected]>
  • Loading branch information
fao89 committed Jul 22, 2024
1 parent d662542 commit e6e32f7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 25 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 @@ -268,6 +267,7 @@ KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.11.1
CRD_MARKDOWN_VERSION ?= v0.0.3
KUTTL_VERSION ?= 0.17.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 @@ -361,11 +361,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
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ spec:
- description: TLS - overrides tls parameters for public endpoint
displayName: TLS
path: horizon.apiOverride.tls
- description: Enabled - Whether Horizon services should be deployed and managed
displayName: Enabled
path: horizon.enabled
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: Template - Overrides to use when creating the Horizon services
displayName: Template
path: horizon.template
Expand Down Expand Up @@ -573,6 +578,13 @@ spec:
path: addCertMounts
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
- description: DeployOnAllNodeSets - should the service be deploy across all
nodesets This will override default target of a service play, setting it
to 'all'.
displayName: Deploy On All Node Sets
path: deployOnAllNodeSets
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:booleanSwitch
statusDescriptors:
- description: Conditions
displayName: Conditions
Expand Down
43 changes: 29 additions & 14 deletions docs/assemblies/ctlplane_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,11 @@ CinderSection defines the desired state of Cinder service
| APIOverride, provides the ability to override the generated manifest of several child resources.
| <<override,Override>>
| false
| uniquePodNames
| UniquePodNames - Use a unique prefix for cinder CRs to have unique pod names. Convenient to avoid podname (and thus hostname) collision between different deployments. Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
| bool
| true
|===
<<custom-resources,Back to Custom Resources>>
Expand Down Expand Up @@ -852,6 +857,11 @@ GlanceSection defines the desired state of Glance service
| APIOverride, provides the ability to override the generated manifest of several child resources.
| map[string]<<override,Override>>
| false
| uniquePodNames
| UniquePodNames - Use a unique prefix for glance CRs to have unique pod names. Convenient to avoid podname (and thus hostname) collision between different deployments. Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
| bool
| true
|===
<<custom-resources,Back to Custom Resources>>
Expand Down Expand Up @@ -9376,6 +9386,11 @@ GaleraSpec defines the desired state of Galera
| When TLS is configured, only allow connections to the DB over TLS
| bool
| false
| logToDisk
| Log Galera pod's output to disk
| bool
| true
|===
<<custom-resources,Back to Custom Resources>>
Expand Down Expand Up @@ -9777,7 +9792,7 @@ NeutronAPISpecCore -
| false
| defaultConfigOverwrite
| ConfigOverwrite - interface to overwrite default config files like e.g. logging.conf or policy.json. But can also be used to add additional files. Those get added to the service config dir in /etc/+++<service>+++.+++</service>+++
| DefaultConfigOverwrite - interface to overwrite default config files like policy.yaml
| map[string]string
| false
Expand Down Expand Up @@ -14825,9 +14840,9 @@ AutoscalingSpecBase -
| int32
| false
| prometheusTLS
| If TLS should be used for user deployed prometheus
| *bool
| prometheusTLSCaCertSecret
| If defined, specifies which CA certificate to use for user deployed prometheus
| *corev1.SecretKeySelector
| false
| heatInstance
Expand Down Expand Up @@ -15279,6 +15294,16 @@ MetricStorageSpec defines the desired state of MetricStorage
|===
| Field | Description | Scheme | Required
| dashboardsEnabled
| DashboardsEnabled allows to enable or disable dashboards and related artifacts
| bool
| true
| dataplaneNetwork
| DataplaneNetwork defines the network that will be used to scrape dataplane node_exporter endpoints
| infranetworkv1.NetNameStr
| true
| monitoringStack
| MonitoringStack allows to define a metric storage with options supported by Red Hat
| *<<monitoringstack,MonitoringStack>>
Expand Down Expand Up @@ -15336,21 +15361,11 @@ MonitoringStack defines the options for a Red Hat supported metric storage
| bool
| true
| dashboardsEnabled
| DashboardsEnabled allows to enable or disable dashboards and related artifacts
| bool
| true
| scrapeInterval
| ScrapeInterval sets the interval between scrapes
| string
| true
| dataplaneNetwork
| DataplaneNetwork defines the network that will be used to scrape dataplane node_exporter endpoints
| infranetworkv1.NetNameStr
| true
| storage
| Storage allows to define options for how to store metrics
| <<storage,Storage>>
Expand Down
5 changes: 0 additions & 5 deletions docs/assemblies/dataplane_resources.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,6 @@ NodeSection defines the top level attributes inherited by nodes in the CR.
|===
| Field | Description | Scheme | Required
| extraMounts
| ExtraMounts containing files which can be mounted into an Ansible Execution Pod
| []storage.VolMounts
| false
| networks
| Networks - Instance networks
| []infranetworkv1.IPSetNetwork
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 e6e32f7

Please sign in to comment.