mirror of
https://github.com/dsx-ai-factory/nvke.git
synced 2026-12-07 04:35:58 +08:00
`nvkectl generate sitespec` wrote k8sVersion "1.34.2", the oldest of the three Kubernetes versions the node image stages (os-image/packages/kubeadm-distro/Makefile sets K8S_VERSIONS ?= v1.36.3 v1.35.3 v1.34.2). A management cluster is set once at bootstrap and does not upgrade itself, so the default decides what a new site runs for its whole life. 1.36.3 is the newest staged version and the minor every stream in release/policy.yaml targets. Move the default, the two bundled site-spec examples and the docs that state it. The NICo release examples move with it: a ClusterRelease or NodePoolRelease annotated machine-init-kubernetes-version "1.34.2" with -injected "false" is only a candidate for a 1.34.2 cluster (controller/internal/machinerelease/upgrade.go rejects a mismatch), so leaving them behind would have made the bundled NICo example set inconsistent with the site spec beside it. cli/examples/capd-cluster.yaml stays on 1.34.2 deliberately. CAPD runs on kindest/node, pinned to v1.34.8 by controller/hack/capd-kindest-node/build-image.sh, so that example has to track the 1.34 line rather than the node image. Verified: gmake -C cli test, gmake -C cli lint, gmake docs-check. Signed-off-by: Terry Howe <thowe@nvidia.com>
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package operator_test
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/dsx-ai-factory/nvke/cli/internal/operator"
|
|
)
|
|
|
|
// TestExamplesDecode keeps the shipped example documents valid: they are what
|
|
// an operator copies first, so one that nvkectl itself rejects is a bug.
|
|
func TestExamplesDecode(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
examples := map[string]operator.Kind{
|
|
"machineimage.yaml": operator.KindMachineImage,
|
|
"clusterrelease.yaml": operator.KindClusterRelease,
|
|
"nodepoolrelease.yaml": operator.KindNodePoolRelease,
|
|
}
|
|
for file, kind := range examples {
|
|
t.Run(file, func(t *testing.T) {
|
|
t.Parallel()
|
|
data, err := os.ReadFile(filepath.Join("..", "..", "examples", file))
|
|
require.NoError(t, err)
|
|
|
|
got, err := operator.Decode(kind, data)
|
|
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "example-ubuntu-24.04-amd64", got.Metadata.Name)
|
|
if kind != operator.KindMachineImage {
|
|
assert.Equal(t, map[string]string{
|
|
"internal.nvke.nvidia.com/machine-init-kubernetes-version": "1.36.3",
|
|
"internal.nvke.nvidia.com/machine-init-kubernetes-version-injected": "false",
|
|
}, got.Metadata.Annotations, "a release example carries the Kubernetes version annotations")
|
|
}
|
|
})
|
|
}
|
|
}
|