Merge pull request #13553 from hakman/ubuntu_root

Creaate kubeconfig for the root user on Ubuntu
This commit is contained in:
Kubernetes Prow Robot 2022-04-24 19:55:39 -07:00 committed by GitHub
commit 9df1505cbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -20,12 +20,16 @@ import (
"testing"
"k8s.io/kops/upup/pkg/fi"
"k8s.io/kops/util/pkg/distributions"
)
func TestKubectlBuilder(t *testing.T) {
RunGoldenTest(t, "tests/golden/minimal", "kubectl", func(nodeupModelContext *NodeupModelContext, target *fi.ModelBuilderContext) error {
nodeupModelContext.Assets = fi.NewAssetStore("")
nodeupModelContext.Assets.AddForTest("kubectl", "/path/to/kubectl/asset", "testing kubectl content")
// NodeUp looks for the default user and group on the machine running the tests.
// Flatcar is unlikely to be used for such task, so tests results should be consistent.
nodeupModelContext.Distribution = distributions.DistributionFlatcar
builder := KubectlBuilder{NodeupModelContext: nodeupModelContext}
return builder.Build(target)
})

View File

@ -3,7 +3,7 @@ contents:
AssetPath: /path/to/kubectl/asset
Key: kubectl
mode: "0755"
path: /usr/local/bin/kubectl
path: /opt/kops/bin/kubectl
type: file
---
contents:

View File

@ -76,7 +76,7 @@ func (d *Distribution) DefaultUsers() ([]string, error) {
case "debian":
return []string{"admin", "root"}, nil
case "ubuntu":
return []string{"ubuntu"}, nil
return []string{"ubuntu", "root"}, nil
case "centos":
return []string{"centos"}, nil
case "rhel", "amazonlinux2":