Skip to content

Commit

Permalink
- Remove hostname command from prekubeadm commands
Browse files Browse the repository at this point in the history
- Add capv user to Administrators groupPR updates
  • Loading branch information
Gab Satchi committed Jan 29, 2021
1 parent 9aa42ad commit 7957fbb
Showing 1 changed file with 35 additions and 13 deletions.
48 changes: 35 additions & 13 deletions packaging/flavorgen/flavors/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,16 @@ func defaultVirtualMachineCloneSpec() infrav1.VirtualMachineCloneSpec {
},
},
CustomVMXKeys: defaultCustomVMXKeys(),
CloneMode: infrav1.LinkedClone,
NumCPUs: defaultNumCPUs,
DiskGiB: defaultDiskGiB,
MemoryMiB: defaultMemoryMiB,
Template: vSphereTemplateVar,
Server: vSphereServerVar,
ResourcePool: vSphereResourcePoolVar,
Datastore: vSphereDatastoreVar,
Folder: vSphereFolderVar,
OS: infrav1.Linux,
CloneMode: infrav1.LinkedClone,
NumCPUs: defaultNumCPUs,
DiskGiB: defaultDiskGiB,
MemoryMiB: defaultMemoryMiB,
Template: vSphereTemplateVar,
Server: vSphereServerVar,
ResourcePool: vSphereResourcePoolVar,
Datastore: vSphereDatastoreVar,
Folder: vSphereFolderVar,
OS: infrav1.Linux,
}
}

Expand Down Expand Up @@ -369,8 +369,8 @@ func newWindowsKubeadmConfigTemplate() bootstrapv1.KubeadmConfigTemplate {
JoinConfiguration: &kubeadmv1beta1.JoinConfiguration{
NodeRegistration: windowsNodeRegistrationOptions(),
},
Users: defaultUsers(),
PreKubeadmCommands: defaultPreKubeadmCommands(),
Users: defaultWindowsUsers(),
PreKubeadmCommands: defaultWindowsPreKubeadmCommands(),
},
},
},
Expand All @@ -389,7 +389,7 @@ func windowsNodeRegistrationOptions() kubeadmv1beta1.NodeRegistrationOptions {
return kubeadmv1beta1.NodeRegistrationOptions{
Name: "{{ ds.meta_data.hostname }}",
KubeletExtraArgs: defaultExtraArgs(),
Taints: []v1.Taint{{Key: "windows", Value: "2019", Effect: v1.TaintEffectNoSchedule}},
Taints: []v1.Taint{{Key: "windows", Value: "2019", Effect: v1.TaintEffectNoSchedule}},
}
}

Expand All @@ -405,6 +405,19 @@ func defaultUsers() []bootstrapv1.User {
}
}

func defaultWindowsUsers() []bootstrapv1.User {
return []bootstrapv1.User{
{
Name: "capv",
Groups: pointer.StringPtr("Administrators"),
Sudo: pointer.StringPtr("ALL=(ALL) NOPASSWD:ALL"),
SSHAuthorizedKeys: []string{
vSphereSSHAuthorizedKeysVar,
},
},
}
}

func defaultControlPlaneComponent() kubeadmv1beta1.ControlPlaneComponent {
return kubeadmv1beta1.ControlPlaneComponent{
ExtraArgs: defaultExtraArgs(),
Expand All @@ -431,6 +444,15 @@ func defaultPreKubeadmCommands() []string {
}
}

func defaultWindowsPreKubeadmCommands() []string {
return []string{
"echo \"::1 ipv6-localhost ipv6-loopback\" >/etc/hosts",
"echo \"127.0.0.1 localhost\" >>/etc/hosts",
"echo \"127.0.0.1 {{ ds.meta_data.hostname }}\" >>/etc/hosts",
"echo \"{{ ds.meta_data.hostname }}\" >/etc/hostname",
}
}

func kubeVIPPod() string {
hostPathType := v1.HostPathFileOrCreate
pod := &v1.Pod{
Expand Down

0 comments on commit 7957fbb

Please sign in to comment.