From b57318fc3d6a8849215e846948efdce9e901e70e Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Mon, 15 Mar 2021 07:27:09 -0500 Subject: [PATCH] Download kubectl to /opt/kops/bin on Flatcar OS Also add it to protokube's PATH. Our flatcar job is currently failing because channels arent being applied. A newly added error log reports that kubectl isn't in protokube's PATH. This adds the kubectl's location (/opt/bin) to protokube's PATH. See https://storage.googleapis.com/kubernetes-jenkins/logs/e2e-kops-aws-distro-imageflatcar/1371379886664454144/artifacts/54.206.100.130/protokube.log --- nodeup/pkg/model/context.go | 2 +- nodeup/pkg/model/protokube.go | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/nodeup/pkg/model/context.go b/nodeup/pkg/model/context.go index accc03258a..3bfa929c45 100644 --- a/nodeup/pkg/model/context.go +++ b/nodeup/pkg/model/context.go @@ -398,7 +398,7 @@ func (c *NodeupModelContext) UseSecureKubelet() bool { func (c *NodeupModelContext) KubectlPath() string { kubeletCommand := "/usr/local/bin" if c.Distribution == distributions.DistributionFlatcar { - kubeletCommand = "/opt/bin" + kubeletCommand = "/opt/kops/bin" } if c.Distribution == distributions.DistributionContainerOS { kubeletCommand = "/home/kubernetes/bin" diff --git a/nodeup/pkg/model/protokube.go b/nodeup/pkg/model/protokube.go index f8eb3ebd36..56df7c32b3 100644 --- a/nodeup/pkg/model/protokube.go +++ b/nodeup/pkg/model/protokube.go @@ -461,6 +461,11 @@ func (t *ProtokubeBuilder) buildEnvFile() (*nodetasks.File, error) { envVars[envVar.Name] = envVar.Value } + switch t.Distribution { + case distributions.DistributionFlatcar: + envVars["PATH"] = fmt.Sprintf("/opt/kops/bin:%v", os.Getenv("PATH")) + } + var sysconfig = "" for key, value := range envVars { sysconfig += key + "=" + value + "\n"