mirror of https://github.com/kubernetes/kops.git
azure: Use `kops` as the default admin user
This commit is contained in:
parent
8e83ad6dcd
commit
d08c94e54e
|
@ -103,10 +103,16 @@ func (b *KubectlBuilder) Build(c *fi.NodeupModelBuilderContext) error {
|
|||
|
||||
// findKubeconfigUser finds the default user for whom we should create a kubeconfig
|
||||
func (b *KubectlBuilder) findKubeconfigUser() (*fi.User, *fi.Group, error) {
|
||||
users, err := b.Distribution.DefaultUsers()
|
||||
if err != nil {
|
||||
klog.Warningf("won't write kubeconfig to homedir for distribution %v: %v", b.Distribution, err)
|
||||
return nil, nil, nil
|
||||
var users []string
|
||||
if b.RunningOnAzure() {
|
||||
users = append(users, b.NodeupConfig.AzureAdminUser)
|
||||
} else {
|
||||
defaultUsers, err := b.Distribution.DefaultUsers()
|
||||
if err != nil {
|
||||
klog.Warningf("won't write kubeconfig to homedir for distribution %v: %v", b.Distribution, err)
|
||||
return nil, nil, nil
|
||||
}
|
||||
users = append(users, defaultUsers...)
|
||||
}
|
||||
|
||||
for _, s := range users {
|
||||
|
|
|
@ -118,6 +118,8 @@ type Config struct {
|
|||
WarmPoolImages []string `json:"warmPoolImages,omitempty"`
|
||||
|
||||
// Azure-specific
|
||||
// AzureAdminUser is the admin user of VMs.
|
||||
AzureAdminUser string `json:",omitempty"`
|
||||
// AzureLocation is the location of the resource group that the cluster is deployed in.
|
||||
AzureLocation string `json:",omitempty"`
|
||||
// AzureSubscriptionID is the ID of the Azure Subscription that the cluster is deployed in.
|
||||
|
@ -280,6 +282,7 @@ func NewConfig(cluster *kops.Cluster, instanceGroup *kops.InstanceGroup) (*Confi
|
|||
config.AzureResourceGroup = cluster.AzureResourceGroupName()
|
||||
config.AzureRouteTableName = cluster.AzureRouteTableName()
|
||||
config.Networking.NetworkID = cluster.Spec.Networking.NetworkID
|
||||
config.AzureAdminUser = cluster.Spec.CloudProvider.Azure.AdminUser
|
||||
}
|
||||
|
||||
if cluster.Spec.CloudProvider.GCE != nil {
|
||||
|
|
|
@ -80,8 +80,7 @@ func (d *deployer) initialize() error {
|
|||
}
|
||||
d.SSHPublicKeyPath = publicKeyPath
|
||||
d.SSHPrivateKeyPath = privateKeyPath
|
||||
// TODO: Check if we can use "kops" as SSH user
|
||||
d.SSHUser = "ubuntu"
|
||||
d.SSHUser = "kops"
|
||||
case "digitalocean":
|
||||
if d.SSHPrivateKeyPath == "" {
|
||||
d.SSHPrivateKeyPath = os.Getenv("DO_SSH_PRIVATE_KEY_FILE")
|
||||
|
|
|
@ -195,8 +195,6 @@ func (d *deployer) createCluster(zones []string, adminAccess string, yes bool) e
|
|||
args = appendIfUnset(args, "--cloud-labels", "DO-NOT-DELETE=kOps")
|
||||
args = appendIfUnset(args, "--control-plane-size", "Standard_D4s_v3")
|
||||
args = appendIfUnset(args, "--node-size", "Standard_D2s_v3")
|
||||
// TODO: Check if we can use "kops" as SSH user
|
||||
args = appendIfUnset(args, "--azure-admin-user", "ubuntu")
|
||||
case "gce":
|
||||
if isArm {
|
||||
args = appendIfUnset(args, "--master-size", "t2a-standard-2")
|
||||
|
|
|
@ -176,6 +176,9 @@ func (o *NewClusterOptions) InitDefaults() {
|
|||
o.EtcdClusters = []string{"main", "events"}
|
||||
o.Networking = "cilium"
|
||||
o.InstanceManager = "cloudgroups"
|
||||
|
||||
// Azure-specific
|
||||
o.AzureAdminUser = "kops"
|
||||
}
|
||||
|
||||
type NewClusterResult struct {
|
||||
|
|
Loading…
Reference in New Issue