Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func NewKubeletVersionSkewController(
apiServerVersion: semver.MustParse(status.VersionForOperandFromEnv()),
minSupportedSkew: minSupportedKubeletSkewForOpenShiftVersion(openShiftVersion),
minSupportedSkewNextVersion: minSupportedKubeletSkewForOpenShiftVersion(nextOpenShiftVersion),
nextOpenShiftVersion: nextOpenShiftVersion,
}
c.Controller = factory.New().
WithSync(c.sync).
Expand All @@ -85,6 +86,7 @@ type kubeletVersionSkewController struct {
apiServerVersion semver.Version
minSupportedSkew int
minSupportedSkewNextVersion int
nextOpenShiftVersion semver.Version
}

func (c *kubeletVersionSkewController) sync(ctx context.Context, _ factory.SyncContext) error {
Expand Down Expand Up @@ -181,22 +183,22 @@ func (c *kubeletVersionSkewController) sync(ctx context.Context, _ factory.SyncC
condition.Status = operatorv1.ConditionFalse
switch len(skewedLimit) {
case 1:
condition.Message = fmt.Sprintf("Kubelet minor version (%v) on node %s will not be supported in the next OpenShift minor version upgrade.", skewedLimit.version(), skewedLimit.nodes())
condition.Message = fmt.Sprintf("Kubelet minor version (%v) on node %s will not be supported in the next OpenShift minor version upgrade to %d.%d.", skewedLimit.version(), skewedLimit.nodes(), c.nextOpenShiftVersion.Major, c.nextOpenShiftVersion.Minor)
case 2, 3:
condition.Message = fmt.Sprintf("Kubelet minor versions on nodes %s will not be supported in the next OpenShift minor version upgrade.", skewedLimit.nodes())
condition.Message = fmt.Sprintf("Kubelet minor versions on nodes %s will not be supported in the next OpenShift minor version upgrade to %d.%d.", skewedLimit.nodes(), c.nextOpenShiftVersion.Major, c.nextOpenShiftVersion.Minor)
default:
condition.Message = fmt.Sprintf("Kubelet minor versions on %d nodes will not be supported in the next OpenShift minor version upgrade.", len(skewedLimit))
condition.Message = fmt.Sprintf("Kubelet minor versions on %d nodes will not be supported in the next OpenShift minor version upgrade to %d.%d.", len(skewedLimit), c.nextOpenShiftVersion.Major, c.nextOpenShiftVersion.Minor)
}
case len(skewedButOK) > 0:
condition.Reason = KubeletMinorVersionSupportedNextUpgradeReason
condition.Status = operatorv1.ConditionTrue
switch len(skewedButOK) {
case 1:
condition.Message = fmt.Sprintf("Kubelet minor version (%v) on node %s is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade.", skewedButOK.version(), skewedButOK.nodes())
condition.Message = fmt.Sprintf("Kubelet minor version (%v) on node %s is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade to %d.%d.", skewedButOK.version(), skewedButOK.nodes(), c.nextOpenShiftVersion.Major, c.nextOpenShiftVersion.Minor)
case 2, 3:
condition.Message = fmt.Sprintf("Kubelet minor versions on nodes %s are behind the expected API server version; nevertheless, they will continue to be supported in the next OpenShift minor version upgrade.", skewedButOK.nodes())
condition.Message = fmt.Sprintf("Kubelet minor versions on nodes %s are behind the expected API server version; nevertheless, they will continue to be supported in the next OpenShift minor version upgrade to %d.%d.", skewedButOK.nodes(), c.nextOpenShiftVersion.Major, c.nextOpenShiftVersion.Minor)
default:
condition.Message = fmt.Sprintf("Kubelet minor versions on %d nodes are behind the expected API server version; nevertheless, they will continue to be supported in the next OpenShift minor version upgrade.", len(skewedButOK))
condition.Message = fmt.Sprintf("Kubelet minor versions on %d nodes are behind the expected API server version; nevertheless, they will continue to be supported in the next OpenShift minor version upgrade to %d.%d.", len(skewedButOK), c.nextOpenShiftVersion.Major, c.nextOpenShiftVersion.Minor)
}
default:
condition.Reason = KubeletMinorVersionSyncedReason
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func Test_kubeletVersionSkewController_Sync(t *testing.T) {
kubeletVersions: skewedKubeletVersions(0, -1, 0),
expectedStatus: operatorv1.ConditionFalse,
expectedReason: KubeletMinorVersionUnsupportedNextUpgradeReason,
expectedMsgLines: "Kubelet minor version (1.20.1) on node test001 will not be supported in the next OpenShift minor version upgrade.",
expectedMsgLines: "Kubelet minor version (1.20.1) on node test001 will not be supported in the next OpenShift minor version upgrade to 4.9.",
},
{
name: "UnsupportedNextUpgrade/Odd",
Expand All @@ -81,23 +81,23 @@ func Test_kubeletVersionSkewController_Sync(t *testing.T) {
kubeletVersions: skewedKubeletVersions(0, -1, -1),
expectedStatus: operatorv1.ConditionFalse,
expectedReason: KubeletMinorVersionUnsupportedNextUpgradeReason,
expectedMsgLines: "Kubelet minor versions on nodes test001 and test002 will not be supported in the next OpenShift minor version upgrade.",
expectedMsgLines: "Kubelet minor versions on nodes test001 and test002 will not be supported in the next OpenShift minor version upgrade to 4.9.",
},
{
name: "ThreeNodesNotSynced",
ocpVersion: evenOpenShiftVersion,
kubeletVersions: skewedKubeletVersions(0, -1, -1, -1),
expectedStatus: operatorv1.ConditionFalse,
expectedReason: KubeletMinorVersionUnsupportedNextUpgradeReason,
expectedMsgLines: "Kubelet minor versions on nodes test001, test002, and test003 will not be supported in the next OpenShift minor version upgrade.",
expectedMsgLines: "Kubelet minor versions on nodes test001, test002, and test003 will not be supported in the next OpenShift minor version upgrade to 4.9.",
},
{
name: "ManyNodesNotSynced",
ocpVersion: evenOpenShiftVersion,
kubeletVersions: skewedKubeletVersions(0, -1, -1, -1, -1, -1, 0, 0),
expectedStatus: operatorv1.ConditionFalse,
expectedReason: KubeletMinorVersionUnsupportedNextUpgradeReason,
expectedMsgLines: "Kubelet minor versions on 5 nodes will not be supported in the next OpenShift minor version upgrade.",
expectedMsgLines: "Kubelet minor versions on 5 nodes will not be supported in the next OpenShift minor version upgrade to 4.9.",
},
{
name: "SkewedUnsupported/Even",
Expand All @@ -121,7 +121,7 @@ func Test_kubeletVersionSkewController_Sync(t *testing.T) {
kubeletVersions: skewedKubeletVersions(-1, 0, 0),
expectedStatus: operatorv1.ConditionTrue,
expectedReason: KubeletMinorVersionSupportedNextUpgradeReason,
expectedMsgLines: "Kubelet minor version (1.20.0) on node test000 is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade.",
expectedMsgLines: "Kubelet minor version (1.20.0) on node test000 is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade 4.10.",
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix the missing "to" preposition.

The test expectation is missing "to" before "4.10". The actual message format in line 197 of kubelet_version_skew_controller.go includes "upgrade to %d.%d", so this test expectation should match.

Apply this diff to fix the test expectation:

-			expectedMsgLines: "Kubelet minor version (1.20.0) on node test000 is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade 4.10.",
+			expectedMsgLines: "Kubelet minor version (1.20.0) on node test000 is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade to 4.10.",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
expectedMsgLines: "Kubelet minor version (1.20.0) on node test000 is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade 4.10.",
expectedMsgLines: "Kubelet minor version (1.20.0) on node test000 is behind the expected API server version; nevertheless, it will continue to be supported in the next OpenShift minor version upgrade to 4.10.",
🤖 Prompt for AI Agents
In
pkg/operator/kubeletversionskewcontroller/kubelet_version_skew_controller_test.go
around line 124, the expected message string is missing the preposition "to"
before the OpenShift version; update the expectedMsgLines value to include "to"
so it matches the actual message format ("upgrade to %d.%d") used in
kubelet_version_skew_controller.go.

},
{
name: "Unsupported",
Expand Down