mirror of https://github.com/kubernetes/kops.git
Creaate kubeconfig for the root user on Ubuntu
This commit is contained in:
parent
a700e1b771
commit
6a51577cb0
|
@ -20,12 +20,16 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kops/upup/pkg/fi"
|
"k8s.io/kops/upup/pkg/fi"
|
||||||
|
"k8s.io/kops/util/pkg/distributions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestKubectlBuilder(t *testing.T) {
|
func TestKubectlBuilder(t *testing.T) {
|
||||||
RunGoldenTest(t, "tests/golden/minimal", "kubectl", func(nodeupModelContext *NodeupModelContext, target *fi.ModelBuilderContext) error {
|
RunGoldenTest(t, "tests/golden/minimal", "kubectl", func(nodeupModelContext *NodeupModelContext, target *fi.ModelBuilderContext) error {
|
||||||
nodeupModelContext.Assets = fi.NewAssetStore("")
|
nodeupModelContext.Assets = fi.NewAssetStore("")
|
||||||
nodeupModelContext.Assets.AddForTest("kubectl", "/path/to/kubectl/asset", "testing kubectl content")
|
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}
|
builder := KubectlBuilder{NodeupModelContext: nodeupModelContext}
|
||||||
return builder.Build(target)
|
return builder.Build(target)
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,7 +3,7 @@ contents:
|
||||||
AssetPath: /path/to/kubectl/asset
|
AssetPath: /path/to/kubectl/asset
|
||||||
Key: kubectl
|
Key: kubectl
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
path: /usr/local/bin/kubectl
|
path: /opt/kops/bin/kubectl
|
||||||
type: file
|
type: file
|
||||||
---
|
---
|
||||||
contents:
|
contents:
|
||||||
|
|
|
@ -76,7 +76,7 @@ func (d *Distribution) DefaultUsers() ([]string, error) {
|
||||||
case "debian":
|
case "debian":
|
||||||
return []string{"admin", "root"}, nil
|
return []string{"admin", "root"}, nil
|
||||||
case "ubuntu":
|
case "ubuntu":
|
||||||
return []string{"ubuntu"}, nil
|
return []string{"ubuntu", "root"}, nil
|
||||||
case "centos":
|
case "centos":
|
||||||
return []string{"centos"}, nil
|
return []string{"centos"}, nil
|
||||||
case "rhel", "amazonlinux2":
|
case "rhel", "amazonlinux2":
|
||||||
|
|
Loading…
Reference in New Issue