Skip to content

Commit

Permalink
chore: generate docs versions var
Browse files Browse the repository at this point in the history
Generate documentation var files to be used
in network-operator-docs repo.

Signed-off-by: Fred Rolland <[email protected]>
  • Loading branch information
rollandf committed Jul 23, 2024
1 parent 6800708 commit be5e1c4
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ testbin
test
build
hack/manifests

hack/vars.rst
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ release-build:
cd hack && $(GO) run release.go --templateDir ./templates/values/ --outputDir ../deployment/network-operator/
cd hack && $(GO) run release.go --templateDir ./templates/config/manager --outputDir ../config/manager/

.PHONY: generate-docs-versions-var
generate-docs-versions-var:
cd hack && $(GO) run release.go --templateDir ./templates/docs-versions-var/ --outputDir .
mv hack/vars.yaml hack/vars.rst

# dev environment

MINIKUBE_CLUSTER_NAME = net-op-dev
Expand Down
7 changes: 7 additions & 0 deletions hack/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type SHA256ImageRef struct {

// Release contains versions for operator release templates.
type Release struct {
OcpDefaulChannel string
HelmChartVersion string
NetworkOperator *ReleaseImageSpec
NetworkOperatorInitContainer *ReleaseImageSpec
SriovNetworkOperator *ReleaseImageSpec
Expand All @@ -75,6 +77,7 @@ type Release struct {
DOCATelemetryService *ReleaseImageSpec
OVSCni *ReleaseImageSpec
RDMACni *ReleaseImageSpec
Nfd *ReleaseImageSpec
}

func readDefaults(releaseDefaults string) Release {
Expand Down Expand Up @@ -136,6 +139,10 @@ func main() {
if *retrieveSha {
resolveImagesSha(&release)
}
parts := strings.Split(release.NetworkOperator.Version, ".")
release.OcpDefaulChannel = fmt.Sprintf("%s.%s", parts[0], parts[1])
release.HelmChartVersion = strings.TrimPrefix(release.NetworkOperator.Version, "v")

var files []string
err := filepath.Walk(*templateDir, func(path string, info os.FileInfo, err error) error {
// Error during traversal
Expand Down
3 changes: 3 additions & 0 deletions hack/release.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
NetworkOperator:
image: network-operator
repository: nvcr.io/nvstaging/mellanox
version: v24.7.0-beta.2
NetworkOperatorInitContainer:
image: network-operator-init-container
repository: ghcr.io/mellanox
Expand Down Expand Up @@ -77,3 +78,5 @@ rdmaCni:
image: rdma-cni
repository: ghcr.io/k8snetworkplumbingwg
version: v1.2.0
Nfd:
version: v0.13.2
21 changes: 21 additions & 0 deletions hack/templates/docs-versions-var/vars.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.. |network-operator-version| replace:: {{ .NetworkOperator.Version }}
.. |helm-chart-version| replace:: {{ .HelmChartVersion }}
.. |ocp-channel| replace:: {{ .OcpDefaulChannel }}
.. |mofed-version| replace:: {{ .Mofed.Version }}
.. |mofed-init-container-version| replace:: {{ .NetworkOperatorInitContainer.Version }}
.. |sriov-device-plugin-version| replace:: {{ .SriovDevicePlugin.Version }}
.. |k8s-rdma-shared-dev-plugin-version| replace:: {{ .RdmaSharedDevicePlugin.Version }}
.. |ib-kubernetes-version| replace:: {{ .IbKubernetes.Version }}
.. |cni-plugins-version| replace:: {{ .CniPlugins.Version }}
.. |multus-version| replace:: {{ .Multus.Version }}
.. |ipoib-cni-version| replace:: {{ .Ipoib.Version }}
.. |whereabouts-version| replace:: {{ .IpamPlugin.Version }}
.. |nvidia-ipam-version| replace:: {{ .NvIPAM.Version }}
.. |nic-feature-discovery-version| replace:: {{ .NicFeatureDiscovery.Version }}
.. |sriovnetop-version| replace:: {{ .SriovNetworkOperator.Version }}
.. |sriovnetop-sriov-cni-version| replace:: {{ .SriovCni.Version }}
.. |sriovnetop-ib-sriov-cni-version| replace:: {{ .SriovIbCni.Version }}
.. |sriovnetop-sriov-device-plugin-version| replace:: {{ .SriovDevicePlugin.Version }}
.. |doca-telemetry-version| replace:: {{ .DOCATelemetryService.Version }}
.. |node-feature-discovery-version| replace:: {{ .Nfd.Version }}

0 comments on commit be5e1c4

Please sign in to comment.