@@ -50,7 +50,24 @@ public-network = "{{ .Network }}"
50
50
{{if .SSHAuthorizedKeys}}ssh_authorized_keys:{{range .SSHAuthorizedKeys}}
51
51
- "{{.}}"{{end}}{{end}}
52
52
53
+ runcmd:
54
+ - [hostname, {{HostNameLookup}}]
55
+
53
56
write_files:
57
+ - path: /etc/hostname
58
+ owner: root:root
59
+ permissions: 0644
60
+ content: |
61
+ {{ HostNameLookup }}
62
+
63
+ - path: /etc/hosts
64
+ owner: root:root
65
+ permissions: 0644
66
+ content: |
67
+ ::1 ipv6-localhost ipv6-loopback
68
+ 127.0.0.1 localhost
69
+ 127.0.0.1 {{HostNameLookup}}
70
+
54
71
- path: /etc/kubernetes/pki/ca.crt
55
72
encoding: "base64"
56
73
owner: root:root
@@ -132,7 +149,24 @@ kubeadm:
132
149
{{if .SSHAuthorizedKeys}}ssh_authorized_keys:{{range .SSHAuthorizedKeys}}
133
150
- "{{.}}"{{end}}{{end}}
134
151
152
+ runcmd:
153
+ - [hostname, {{HostNameLookup}}]
154
+
135
155
write_files:
156
+ - path: /etc/hostname
157
+ owner: root:root
158
+ permissions: 0644
159
+ content: |
160
+ {{ HostNameLookup }}
161
+
162
+ - path: /etc/hosts
163
+ owner: root:root
164
+ permissions: 0644
165
+ content: |
166
+ ::1 ipv6-localhost ipv6-loopback
167
+ 127.0.0.1 localhost
168
+ 127.0.0.1 {{HostNameLookup}}
169
+
136
170
- path: /etc/kubernetes/pki/ca.crt
137
171
encoding: "base64"
138
172
owner: root:root
@@ -310,12 +344,7 @@ func NewControlPlane(input *ControlPlaneInput) (string, error) {
310
344
return "" , errors .Wrapf (err , "ControlPlaneInput is invalid" )
311
345
}
312
346
313
- fMap := map [string ]interface {}{
314
- "Base64Encode" : templateBase64Encode ,
315
- "Indent" : templateYAMLIndent ,
316
- }
317
-
318
- userData , err := generateWithFuncs ("controlplane" , controlPlaneCloudInit , funcMap (fMap ), input )
347
+ userData , err := generateWithFuncs ("controlplane" , controlPlaneCloudInit , defaultFuncMap (), input )
319
348
if err != nil {
320
349
return "" , errors .Wrapf (err , "failed to generate user data for new control plane machine" )
321
350
}
@@ -331,12 +360,7 @@ func JoinControlPlane(input *ContolPlaneJoinInput) (string, error) {
331
360
return "" , errors .Wrapf (err , "ControlPlaneInput is invalid" )
332
361
}
333
362
334
- fMap := map [string ]interface {}{
335
- "Base64Encode" : templateBase64Encode ,
336
- "Indent" : templateYAMLIndent ,
337
- }
338
-
339
- userData , err := generateWithFuncs ("controlplane" , controlPlaneJoinCloudInit , funcMap (fMap ), input )
363
+ userData , err := generateWithFuncs ("controlplane" , controlPlaneJoinCloudInit , defaultFuncMap (), input )
340
364
if err != nil {
341
365
return "" , errors .Wrapf (err , "failed to generate user data for machine joining control plane" )
342
366
}
0 commit comments