chore: fix provision tests after changes to build-container
CNI was removed from build-container which works fine for `talosctl cluster create` clusters as it installs its own CNI, but fails for upgrade tests as they were never updated for the CNI bundle. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
parent
4aae924c68
commit
ca8a5596c7
3
Makefile
3
Makefile
@ -281,7 +281,8 @@ provision-tests-track-%:
|
|||||||
INTEGRATION_TEST_RUN="TestIntegration/.+-TR$*" \
|
INTEGRATION_TEST_RUN="TestIntegration/.+-TR$*" \
|
||||||
INTEGRATION_TEST_TRACK="$*" \
|
INTEGRATION_TEST_TRACK="$*" \
|
||||||
CUSTOM_CNI_URL=$(CUSTOM_CNI_URL) \
|
CUSTOM_CNI_URL=$(CUSTOM_CNI_URL) \
|
||||||
REGISTRY=$(IMAGE_REGISTRY)
|
REGISTRY=$(IMAGE_REGISTRY) \
|
||||||
|
ARTIFACTS=$(ARTIFACTS)
|
||||||
|
|
||||||
# Assets for releases
|
# Assets for releases
|
||||||
|
|
||||||
|
@ -40,4 +40,8 @@ case "${CUSTOM_CNI_URL:-false}" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
"${INTEGRATION_TEST}" -test.v -talos.talosctlpath "${TALOSCTL}" -talos.provision.mtu 1450 ${INTEGRATION_TEST_FLAGS}
|
"${INTEGRATION_TEST}" -test.v \
|
||||||
|
-talos.talosctlpath "${TALOSCTL}" \
|
||||||
|
-talos.provision.mtu 1450 \
|
||||||
|
-talos.provision.cni-bundle-url ${ARTIFACTS}/talosctl-cni-bundle-'${ARCH}'.tar.gz \
|
||||||
|
${INTEGRATION_TEST_FLAGS}
|
||||||
|
@ -147,6 +147,7 @@ func init() {
|
|||||||
flag.StringVar(&provision_test.DefaultSettings.TargetInstallImageRegistry, "talos.provision.target-installer-registry",
|
flag.StringVar(&provision_test.DefaultSettings.TargetInstallImageRegistry, "talos.provision.target-installer-registry",
|
||||||
provision_test.DefaultSettings.TargetInstallImageRegistry, "image registry for target installer image (provision tests only)")
|
provision_test.DefaultSettings.TargetInstallImageRegistry, "image registry for target installer image (provision tests only)")
|
||||||
flag.StringVar(&provision_test.DefaultSettings.CustomCNIURL, "talos.provision.custom-cni-url", provision_test.DefaultSettings.CustomCNIURL, "custom CNI URL for the cluster (provision tests only)")
|
flag.StringVar(&provision_test.DefaultSettings.CustomCNIURL, "talos.provision.custom-cni-url", provision_test.DefaultSettings.CustomCNIURL, "custom CNI URL for the cluster (provision tests only)")
|
||||||
|
flag.StringVar(&provision_test.DefaultSettings.CNIBundleURL, "talos.provision.cni-bundle-url", provision_test.DefaultSettings.CNIBundleURL, "URL to download CNI bundle from")
|
||||||
|
|
||||||
allSuites = append(allSuites, api.GetAllSuites()...)
|
allSuites = append(allSuites, api.GetAllSuites()...)
|
||||||
allSuites = append(allSuites, cli.GetAllSuites()...)
|
allSuites = append(allSuites, cli.GetAllSuites()...)
|
||||||
|
@ -8,9 +8,14 @@
|
|||||||
package provision
|
package provision
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/talos-systems/talos/internal/integration/base"
|
"github.com/talos-systems/talos/internal/integration/base"
|
||||||
|
"github.com/talos-systems/talos/pkg/machinery/constants"
|
||||||
|
"github.com/talos-systems/talos/pkg/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var allSuites []suite.TestingSuite
|
var allSuites []suite.TestingSuite
|
||||||
@ -45,6 +50,8 @@ type Settings struct {
|
|||||||
CustomCNIURL string
|
CustomCNIURL string
|
||||||
// Enable crashdump on failure.
|
// Enable crashdump on failure.
|
||||||
CrashdumpEnabled bool
|
CrashdumpEnabled bool
|
||||||
|
// CNI bundle for QEMU provisioner.
|
||||||
|
CNIBundleURL string
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultSettings filled in by test runner.
|
// DefaultSettings filled in by test runner.
|
||||||
@ -57,4 +64,10 @@ var DefaultSettings = Settings{
|
|||||||
MasterNodes: 3,
|
MasterNodes: 3,
|
||||||
WorkerNodes: 1,
|
WorkerNodes: 1,
|
||||||
TargetInstallImageRegistry: "ghcr.io",
|
TargetInstallImageRegistry: "ghcr.io",
|
||||||
|
CNIBundleURL: fmt.Sprintf("https://github.com/talos-systems/talos/releases/download/%s/talosctl-cni-bundle-%s.tar.gz", trimVersion(version.Tag), constants.ArchVariable),
|
||||||
|
}
|
||||||
|
|
||||||
|
func trimVersion(version string) string {
|
||||||
|
// remove anything extra after semantic version core, `v0.3.2-1-abcd` -> `v0.3.2`
|
||||||
|
return regexp.MustCompile(`(-\d+-g[0-9a-f]+)$`).ReplaceAllString(version, "")
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -79,20 +78,7 @@ const (
|
|||||||
currentK8sVersion = "1.20.4"
|
currentK8sVersion = "1.20.4"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var defaultNameservers = []net.IP{net.ParseIP("8.8.8.8"), net.ParseIP("1.1.1.1")}
|
||||||
defaultNameservers = []net.IP{net.ParseIP("8.8.8.8"), net.ParseIP("1.1.1.1")}
|
|
||||||
defaultCNIBinPath = []string{"/opt/cni/bin"}
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
defaultCNIConfDir = "/etc/cni/conf.d"
|
|
||||||
defaultCNICacheDir = "/var/lib/cni"
|
|
||||||
)
|
|
||||||
|
|
||||||
func trimVersion(version string) string {
|
|
||||||
// remove anything extra after semantic version core, `v0.3.2-1-abcd` -> `v0.3.2`
|
|
||||||
return regexp.MustCompile(`(-\d+-g[0-9a-f]+)$`).ReplaceAllString(version, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
// upgradeBetweenTwoLastReleases upgrades between two last releases of Talos.
|
// upgradeBetweenTwoLastReleases upgrades between two last releases of Talos.
|
||||||
func upgradeBetweenTwoLastReleases() upgradeSpec {
|
func upgradeBetweenTwoLastReleases() upgradeSpec {
|
||||||
@ -224,6 +210,7 @@ type UpgradeSuite struct {
|
|||||||
ctxCancel context.CancelFunc
|
ctxCancel context.CancelFunc
|
||||||
|
|
||||||
stateDir string
|
stateDir string
|
||||||
|
cniDir string
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetupSuite ...
|
// SetupSuite ...
|
||||||
@ -279,6 +266,7 @@ func (suite *UpgradeSuite) setupCluster() {
|
|||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
|
|
||||||
suite.stateDir = filepath.Join(defaultStateDir, "clusters")
|
suite.stateDir = filepath.Join(defaultStateDir, "clusters")
|
||||||
|
suite.cniDir = filepath.Join(defaultStateDir, "cni")
|
||||||
|
|
||||||
clusterName := suite.spec.ShortName
|
clusterName := suite.spec.ShortName
|
||||||
|
|
||||||
@ -309,9 +297,11 @@ func (suite *UpgradeSuite) setupCluster() {
|
|||||||
MTU: DefaultSettings.MTU,
|
MTU: DefaultSettings.MTU,
|
||||||
Nameservers: defaultNameservers,
|
Nameservers: defaultNameservers,
|
||||||
CNI: provision.CNIConfig{
|
CNI: provision.CNIConfig{
|
||||||
BinPath: defaultCNIBinPath,
|
BinPath: []string{filepath.Join(suite.cniDir, "bin")},
|
||||||
ConfDir: defaultCNIConfDir,
|
ConfDir: filepath.Join(suite.cniDir, "conf.d"),
|
||||||
CacheDir: defaultCNICacheDir,
|
CacheDir: filepath.Join(suite.cniDir, "cache"),
|
||||||
|
|
||||||
|
BundleURL: DefaultSettings.CNIBundleURL,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user