@@ -28,7 +28,24 @@ const (
28
28
{{if .SSHAuthorizedKeys}}ssh_authorized_keys:{{range .SSHAuthorizedKeys}}
29
29
- "{{.}}"{{end}}{{end}}
30
30
31
+ runcmd:
32
+ - [hostname, {{HostNameLookup}}]
33
+
31
34
write_files:
35
+ - path: /etc/hostname
36
+ owner: root:root
37
+ permissions: 0644
38
+ content: |
39
+ {{ HostNameLookup }}
40
+
41
+ - path: /etc/hosts
42
+ owner: root:root
43
+ permissions: 0644
44
+ content: |
45
+ ::1 ipv6-localhost ipv6-loopback
46
+ 127.0.0.1 localhost
47
+ 127.0.0.1 {{HostNameLookup}}
48
+
32
49
- path: /etc/kubernetes/pki/ca.crt
33
50
encoding: "base64"
34
51
owner: root:root
@@ -110,7 +127,24 @@ kubeadm:
110
127
{{if .SSHAuthorizedKeys}}ssh_authorized_keys:{{range .SSHAuthorizedKeys}}
111
128
- "{{.}}"{{end}}{{end}}
112
129
130
+ runcmd:
131
+ - [hostname, {{HostNameLookup}}]
132
+
113
133
write_files:
134
+ - path: /etc/hostname
135
+ owner: root:root
136
+ permissions: 0644
137
+ content: |
138
+ {{ HostNameLookup }}
139
+
140
+ - path: /etc/hosts
141
+ owner: root:root
142
+ permissions: 0644
143
+ content: |
144
+ ::1 ipv6-localhost ipv6-loopback
145
+ 127.0.0.1 localhost
146
+ 127.0.0.1 {{HostNameLookup}}
147
+
114
148
- path: /etc/kubernetes/pki/ca.crt
115
149
encoding: "base64"
116
150
owner: root:root
@@ -275,12 +309,7 @@ func NewControlPlane(input *ControlPlaneInput) (string, error) {
275
309
return "" , errors .Wrapf (err , "ControlPlaneInput is invalid" )
276
310
}
277
311
278
- fMap := map [string ]interface {}{
279
- "Base64Encode" : templateBase64Encode ,
280
- "Indent" : templateYAMLIndent ,
281
- }
282
-
283
- userData , err := generateWithFuncs ("controlplane" , controlPlaneCloudInit , funcMap (fMap ), input )
312
+ userData , err := generateWithFuncs ("controlplane" , controlPlaneCloudInit , defaultFuncMap (), input )
284
313
if err != nil {
285
314
return "" , errors .Wrapf (err , "failed to generate user data for new control plane machine" )
286
315
}
@@ -296,12 +325,7 @@ func JoinControlPlane(input *ContolPlaneJoinInput) (string, error) {
296
325
return "" , errors .Wrapf (err , "ControlPlaneInput is invalid" )
297
326
}
298
327
299
- fMap := map [string ]interface {}{
300
- "Base64Encode" : templateBase64Encode ,
301
- "Indent" : templateYAMLIndent ,
302
- }
303
-
304
- userData , err := generateWithFuncs ("controlplane" , controlPlaneJoinCloudInit , funcMap (fMap ), input )
328
+ userData , err := generateWithFuncs ("controlplane" , controlPlaneJoinCloudInit , defaultFuncMap (), input )
305
329
if err != nil {
306
330
return "" , errors .Wrapf (err , "failed to generate user data for machine joining control plane" )
307
331
}
0 commit comments