prevent user from using crio on unsupported hardware
parent
1bc841108f
commit
8304e52539
|
@ -1121,25 +1121,7 @@ func validateFlags(cmd *cobra.Command, drvName string) {
|
||||||
if cmd.Flags().Changed(containerRuntime) {
|
if cmd.Flags().Changed(containerRuntime) {
|
||||||
runtime := strings.ToLower(viper.GetString(containerRuntime))
|
runtime := strings.ToLower(viper.GetString(containerRuntime))
|
||||||
|
|
||||||
validOptions := cruntime.ValidRuntimes()
|
validateContainerRuntime(runtime, drvName)
|
||||||
// `crio` is accepted as an alternative spelling to `cri-o`
|
|
||||||
validOptions = append(validOptions, constants.CRIO)
|
|
||||||
|
|
||||||
var validRuntime bool
|
|
||||||
for _, option := range validOptions {
|
|
||||||
if runtime == option {
|
|
||||||
validRuntime = true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert `cri-o` to `crio` as the K8s config uses the `crio` spelling
|
|
||||||
if runtime == "cri-o" {
|
|
||||||
viper.Set(containerRuntime, constants.CRIO)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !validRuntime {
|
|
||||||
exit.Message(reason.Usage, `Invalid Container Runtime: "{{.runtime}}". Valid runtimes are: {{.validOptions}}`, out.V{"runtime": runtime, "validOptions": strings.Join(cruntime.ValidRuntimes(), ", ")})
|
|
||||||
}
|
|
||||||
|
|
||||||
validateCNI(cmd, runtime)
|
validateCNI(cmd, runtime)
|
||||||
}
|
}
|
||||||
|
@ -1206,6 +1188,42 @@ func validateFlags(cmd *cobra.Command, drvName string) {
|
||||||
validateInsecureRegistry()
|
validateInsecureRegistry()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func validateContainerRuntime(runtime string, drvName string) {
|
||||||
|
validOptions := cruntime.ValidRuntimes()
|
||||||
|
// `crio` is accepted as an alternative spelling to `cri-o`
|
||||||
|
validOptions = append(validOptions, constants.CRIO)
|
||||||
|
|
||||||
|
var validRuntime bool
|
||||||
|
for _, option := range validOptions {
|
||||||
|
if runtime == option {
|
||||||
|
validRuntime = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert `cri-o` to `crio` as the K8s config uses the `crio` spelling
|
||||||
|
if runtime == "cri-o" {
|
||||||
|
viper.Set(containerRuntime, constants.CRIO)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !validRuntime {
|
||||||
|
exit.Message(reason.Usage, `Invalid Container Runtime: "{{.runtime}}". Valid runtimes are: {{.validOptions}}`, out.V{"runtime": runtime, "validOptions": strings.Join(cruntime.ValidRuntimes(), ", ")})
|
||||||
|
}
|
||||||
|
|
||||||
|
// cri-o runtime only supports amd64 & arm64 if kicbase driver is used
|
||||||
|
if runtime != "cri-o" && runtime != constants.CRIO {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !driver.IsKIC(drvName) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
arch := detect.RuntimeArch()
|
||||||
|
if arch != "amd64" && arch != "arm64" {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
exit.Message(reason.Usage, `Invalid Container Runtime: "{{.runtime}}". When using a kicbase driver (docker & podman), {{.runtime}} is only supported on amd64 & arm64, use docker or containerd instead.`, out.V{"runtime": runtime})
|
||||||
|
}
|
||||||
|
|
||||||
// if container runtime is not docker, check that cni is not disabled
|
// if container runtime is not docker, check that cni is not disabled
|
||||||
func validateCNI(cmd *cobra.Command, runtime string) {
|
func validateCNI(cmd *cobra.Command, runtime string) {
|
||||||
if runtime == "docker" {
|
if runtime == "docker" {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
CRIO_BIN_VERSION = v1.22.0
|
CRIO_BIN_VERSION = v1.22.0
|
||||||
CRIO_BIN_COMMIT = 6becad23eadd7dfdd25fd8df386bf3b706cf7758
|
CRIO_BIN_COMMIT = 6becad23eadd7dfdd25fd8df386bf3b706cf7758
|
||||||
CRIO_BIN_SITE = https://github.com/cri-o/cri-o/archive/
|
CRIO_BIN_SITE = https://github.com/cri-o/cri-o/archive
|
||||||
CRIO_BIN_SOURCE = $(CRIO_BIN_VERSION).tar.gz
|
CRIO_BIN_SOURCE = $(CRIO_BIN_VERSION).tar.gz
|
||||||
CRIO_BIN_DEPENDENCIES = host-go libgpgme
|
CRIO_BIN_DEPENDENCIES = host-go libgpgme
|
||||||
CRIO_BIN_GOPATH = $(@D)/_output
|
CRIO_BIN_GOPATH = $(@D)/_output
|
||||||
|
|
|
@ -32,7 +32,6 @@ FROM ubuntu:focal-20210401
|
||||||
ARG BUILDKIT_VERSION="v0.9.0"
|
ARG BUILDKIT_VERSION="v0.9.0"
|
||||||
ARG FUSE_OVERLAYFS_VERSION="v1.7.1"
|
ARG FUSE_OVERLAYFS_VERSION="v1.7.1"
|
||||||
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION="1.0.3"
|
ARG CONTAINERD_FUSE_OVERLAYFS_VERSION="1.0.3"
|
||||||
ARG CRIO_VERSION="1.22"
|
|
||||||
|
|
||||||
# copy in static files (configs, scripts)
|
# copy in static files (configs, scripts)
|
||||||
COPY deploy/kicbase/10-network-security.conf /etc/sysctl.d/10-network-security.conf
|
COPY deploy/kicbase/10-network-security.conf /etc/sysctl.d/10-network-security.conf
|
||||||
|
|
Loading…
Reference in New Issue