Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
feat: Add support for custom runc deb URL (#4403)
Browse files Browse the repository at this point in the history
This helps enable testing new runc packages on aks-engine clusters.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
  • Loading branch information
cpuguy83 authored May 12, 2021
1 parent ed2cad6 commit 851c71a
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 1 deletion.
8 changes: 8 additions & 0 deletions parts/k8s/cloud-init/artifacts/cse_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ time_metric "installRunc" installRunc
dpkg_install 20 30 /tmp/${DEB} || exit {{GetCSEErrorCode "ERR_DEB_PKG_ADD_FAIL"}}
fi
{{end}}
{{- if HasLinuxRuncURL}}
LINUX_RUNC_URL={{GetLinuxRuncURL}}
if [[ -n "${LINUX_RUNC_URL:-}" ]]; then
DEB="${LINUX_RUNC_URL##*/}"
retrycmd_no_stats 120 5 25 curl -fsSL ${LINUX_RUNC_URL} >/tmp/${DEB} || exit {{GetCSEErrorCode "ERR_DEB_DOWNLOAD_TIMEOUT"}}
dpkg_install 20 30 /tmp/${DEB} || exit {{GetCSEErrorCode "ERR_DEB_PKG_ADD_FAIL"}}
fi
{{end}}
fi

if [[ -n ${MASTER_NODE} ]] && [[ -z ${COSMOS_URI} ]]; then
Expand Down
1 change: 1 addition & 0 deletions pkg/api/converterfromapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ func convertKubernetesConfigToVLabs(apiCfg *KubernetesConfig, vlabsCfg *vlabs.Ku
vlabsCfg.DockerBridgeSubnet = apiCfg.DockerBridgeSubnet
vlabsCfg.MobyVersion = apiCfg.MobyVersion
vlabsCfg.LinuxMobyURL = apiCfg.LinuxMobyURL
vlabsCfg.LinuxRuncURL = apiCfg.LinuxRuncURL
vlabsCfg.ContainerdVersion = apiCfg.ContainerdVersion
vlabsCfg.LinuxContainerdURL = apiCfg.LinuxContainerdURL
vlabsCfg.CloudProviderBackoff = apiCfg.CloudProviderBackoff
Expand Down
1 change: 1 addition & 0 deletions pkg/api/convertertoapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func convertVLabsKubernetesConfig(vlabs *vlabs.KubernetesConfig, api *Kubernetes
api.DockerBridgeSubnet = vlabs.DockerBridgeSubnet
api.MobyVersion = vlabs.MobyVersion
api.LinuxMobyURL = vlabs.LinuxMobyURL
api.LinuxRuncURL = vlabs.LinuxRuncURL
api.ContainerdVersion = vlabs.ContainerdVersion
api.LinuxContainerdURL = vlabs.LinuxContainerdURL
api.CloudProviderBackoff = vlabs.CloudProviderBackoff
Expand Down
1 change: 1 addition & 0 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ type KubernetesConfig struct {
DockerEngineVersion string `json:"dockerEngineVersion,omitempty"` // Deprecated
MobyVersion string `json:"mobyVersion,omitempty"`
LinuxMobyURL string `json:"linuxMobyURL,omitempty"`
LinuxRuncURL string `json:"linuxRuncURL,omitempty"`
ContainerdVersion string `json:"containerdVersion,omitempty"`
LinuxContainerdURL string `json:"linuxContainerdURL,omitempty"`
CustomCcmImage string `json:"customCcmImage,omitempty"` // Image for cloud-controller-manager
Expand Down
1 change: 1 addition & 0 deletions pkg/api/vlabs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ type KubernetesConfig struct {
DockerEngineVersion string `json:"dockerEngineVersion,omitempty"` // Deprecated
MobyVersion string `json:"mobyVersion,omitempty"`
LinuxMobyURL string `json:"linuxMobyURL,omitempty"`
LinuxRuncURL string `json:"linuxRuncURL,omitempty"`
ContainerdVersion string `json:"containerdVersion,omitempty"`
LinuxContainerdURL string `json:"linuxContainerdURL,omitempty"`
CustomCcmImage string `json:"customCcmImage,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions pkg/engine/template_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,12 @@ func getContainerServiceFuncMap(cs *api.ContainerService) template.FuncMap {
"GetLinuxContainerdURL": func() string {
return cs.Properties.OrchestratorProfile.KubernetesConfig.LinuxContainerdURL
},
"HasLinuxRuncURL": func() bool {
return cs.Properties.OrchestratorProfile.KubernetesConfig.LinuxRuncURL != ""
},
"GetLinuxRuncURL": func() string {
return cs.Properties.OrchestratorProfile.KubernetesConfig.LinuxRuncURL
},
"IsDockerContainerRuntime": func() bool {
return cs.Properties.OrchestratorProfile.KubernetesConfig.ContainerRuntime == api.Docker
},
Expand Down
14 changes: 14 additions & 0 deletions pkg/engine/template_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func TestGetTemplateFuncMap(t *testing.T) {
"GetLinuxContainerdURL",
"HasLinuxMobyURL",
"GetLinuxMobyURL",
"HasLinuxRuncURL",
"GetLinuxRuncURL",
// TODO validate that the remaining func strings in getTemplateFuncMap are thinly wrapped and unit tested
}

Expand Down Expand Up @@ -161,6 +163,18 @@ func TestGetTemplateFuncMap(t *testing.T) {
if ret[0].Interface() != "" {
t.Fatalf("Got unexpected GetLinuxMobyURL response")
}
case "HasLinuxRuncURL":
rargs := make([]reflect.Value, 0)
ret := v.Call(rargs)
if ret[0].Interface() != false {
t.Fatalf("Got unexpected HasLinuxRuncURL response")
}
case "GetinuxRuncURL":
rargs := make([]reflect.Value, 0)
ret := v.Call(rargs)
if ret[0].Interface() != "" {
t.Fatalf("Got unexpected GetLinuxRuncURL response")
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/e2e/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ docker run --rm \
-e LINUX_CONTAINERD_URL=${LINUX_CONTAINERD_URL} \
-e WINDOWS_CONTAINERD_URL=${WINDOWS_CONTAINERD_URL} \
-e LINUX_MOBY_URL=${LINUX_MOBY_URL} \
-e LINUX_RUNC_URL=${LINUX_RUNC_URL} \
-e VALIDATE_CPU_LOAD=${VALIDATE_CPU_LOAD} \
-e RUN_VMSS_NODE_PROTOTYPE=${RUN_VMSS_NODE_PROTOTYPE} \
-e KAMINO_VMSS_PROTOTYPE_LOCAL_CHART_PATH=${KAMINO_VMSS_PROTOTYPE_LOCAL_CHART_PATH} \
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/engine/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ type Config struct {
LinuxContainerdURL string `envconfig:"LINUX_CONTAINERD_URL"`
WindowsContainerdURL string `envconfig:"WINDOWS_CONTAINERD_URL"`
LinuxMobyURL string `envconfig:"LINUX_MOBY_URL"`
LinuxRuncURL string `envconfig:"LINUX_RUNC_URL"`
WindowsProvisioningScriptsURL string `envconfig:"WINDOWS_PROVISIONING_SCRIPTS_URL" default:""`
ArcClientID string `envconfig:"ARC_CLIENT_ID" default:""`
ArcClientSecret string `envconfig:"ARC_CLIENT_SECRET" default:""`
Expand Down Expand Up @@ -251,7 +252,7 @@ func Build(cfg *config.Config, masterSubnetID string, agentSubnetIDs []string, i
}
}
}

if config.ContainerRuntime != "" {
prop.OrchestratorProfile.KubernetesConfig.ContainerRuntime = config.ContainerRuntime
}
Expand Down Expand Up @@ -444,6 +445,9 @@ func Build(cfg *config.Config, masterSubnetID string, agentSubnetIDs []string, i
if config.LinuxMobyURL != "" {
prop.OrchestratorProfile.KubernetesConfig.LinuxMobyURL = config.LinuxMobyURL
}
if config.LinuxRuncURL != "" {
prop.OrchestratorProfile.KubernetesConfig.LinuxRuncURL = config.LinuxRuncURL
}

if config.Eth0MTU != 0 {
if prop.LinuxProfile == nil {
Expand Down

0 comments on commit 851c71a

Please sign in to comment.