Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: generate docs versions var #994

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add hack/vars.rst to .gitignore?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


# 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])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to generate OCP channels list (e.g. stable,v24.4.1) too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use this one for OpenShift installation via CLI where we need a single channel, not a list:
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cant we always specify default here ? then install specific operator version ?

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.15.6
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 }}

Loading