Skip to content

Commit a139564

Browse files
yevgeny-shnaidmanybettan
authored andcommitted
adding public API for additional labels
adding public API that can be used by KMM's user: 1. API to get the module version label format 2. API to get the module version ready label format
1 parent 1c0d9ff commit a139564

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

docs/mkdocs/documentation/ordered_upgrade.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,15 @@ Steps 3, 4 and 5 are then unified into one step: update the
5050
`kmm.node.kubernetes.io/version-module.<module-namespace>.<module-name>` label value to new `$moduleVersion` as set in
5151
the `Module`.
5252

53+
It is strongly recommended to use `GetModuleVersionLabelName` function from the `labels` package in order to construct the correct label used in the step 1
54+
of the upgrade flow
55+
5356
### Indicator that the new version is ready to be used
5457

5558
The operator will label the node with a "version.ready" label to indicate that the new version of the kernel module is loaded
5659
and ready to be used:
5760
`kmm.node.kubernetes.io/<module-namespace>.<module-name>.version.ready=<module-version>`
61+
It is strongly recommended to use `GetKernelModuleVersionReadyNodeLabel` function from the `labels` package in order to construct the correct label
5862

5963
## Implementation details
6064

pkg/labels/labels.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ func GetKernelModuleReadyNodeLabel(namespace, moduleName string) string {
1111
func GetDevicePluginNodeLabel(namespace, moduleName string) string {
1212
return utils.GetDevicePluginNodeLabel(namespace, moduleName)
1313
}
14+
15+
func GetModuleVersionLabelName(namespace, name string) string {
16+
return utils.GetModuleVersionLabelName(namespace, name)
17+
}
18+
19+
func GetKernelModuleVersionReadyNodeLabel(namespace, moduleName string) string {
20+
return utils.GetKernelModuleVersionReadyNodeLabel(namespace, moduleName)
21+
}

pkg/labels/labels_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,15 @@ var _ = Describe("GetModuleReadyAndDevicePluginReadyLabels", func() {
1515
res := GetDevicePluginNodeLabel("some-namespace", "some-module")
1616
Expect(res).To(Equal("kmm.node.kubernetes.io/some-namespace.some-module.device-plugin-ready"))
1717
})
18+
19+
It("module version label", func() {
20+
res := GetModuleVersionLabelName("some-namespace", "some-module")
21+
Expect(res).To(Equal("kmm.node.kubernetes.io/version-module.some-namespace.some-module"))
22+
})
23+
24+
It("module version ready label", func() {
25+
res := GetKernelModuleVersionReadyNodeLabel("some-namespace", "some-module")
26+
Expect(res).To(Equal("kmm.node.kubernetes.io/some-namespace.some-module.version.ready"))
27+
})
28+
1829
})

0 commit comments

Comments
 (0)