@@ -17,6 +17,7 @@ import (
17
17
"github.com/siderolabs/talos/internal/pkg/tui/components"
18
18
"github.com/siderolabs/talos/pkg/images"
19
19
machineapi "github.com/siderolabs/talos/pkg/machinery/api/machine"
20
+ "github.com/siderolabs/talos/pkg/machinery/config/encoder"
20
21
"github.com/siderolabs/talos/pkg/machinery/config/machine"
21
22
"github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1"
22
23
"github.com/siderolabs/talos/pkg/machinery/constants"
@@ -103,12 +104,12 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta
103
104
networkConfigItems := []* components.Item {
104
105
components .NewItem (
105
106
"Hostname" ,
106
- v1alpha1 .NetworkConfigDoc . Describe ("hostname" , true ),
107
+ describe [ v1alpha1.NetworkConfig ] ("hostname" , true ),
107
108
& opts .MachineConfig .NetworkConfig .Hostname ,
108
109
),
109
110
components .NewItem (
110
111
"DNS Domain" ,
111
- v1alpha1 .ClusterNetworkConfigDoc . Describe ("dnsDomain" , true ),
112
+ describe [ v1alpha1.ClusterNetworkConfig ] ("dnsDomain" , true ),
112
113
& opts .ClusterConfig .ClusterNetwork .DnsDomain ,
113
114
),
114
115
}
@@ -148,10 +149,10 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta
148
149
149
150
if ! conn .ExpandingCluster () {
150
151
networkConfigItems = append (networkConfigItems ,
151
- components .NewSeparator (v1alpha1 .ClusterNetworkConfigDoc . Describe ("cni" , true )),
152
+ components .NewSeparator (describe [ v1alpha1.ClusterNetworkConfig ] ("cni" , true )),
152
153
components .NewItem (
153
154
"Type" ,
154
- v1alpha1 .ClusterNetworkConfigDoc . Describe ("cni" , true ),
155
+ describe [ v1alpha1.ClusterNetworkConfig ] ("cni" , true ),
155
156
& state .cni ,
156
157
components .NewTableHeaders ("CNI" , "description" ),
157
158
constants .FlannelCNI , "CNI used by Talos by default" ,
@@ -164,11 +165,11 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta
164
165
NewPage ("Installer Params" ,
165
166
components .NewItem (
166
167
"Image" ,
167
- v1alpha1 .InstallConfigDoc . Describe ("image" , true ),
168
+ describe [ v1alpha1.InstallConfig ] ("image" , true ),
168
169
& opts .MachineConfig .InstallConfig .InstallImage ,
169
170
),
170
171
components .NewSeparator (
171
- v1alpha1 .InstallConfigDoc . Describe ("disk" , true ),
172
+ describe [ v1alpha1.InstallConfig ] ("disk" , true ),
172
173
),
173
174
components .NewItem (
174
175
"Install Disk" ,
@@ -180,18 +181,18 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta
180
181
NewPage ("Machine Config" ,
181
182
components .NewItem (
182
183
"Machine Type" ,
183
- v1alpha1 .MachineConfigDoc . Describe ("type" , true ),
184
+ describe [ v1alpha1.MachineConfig ] ("type" , true ),
184
185
& opts .MachineConfig .Type ,
185
186
machineTypes ... ,
186
187
),
187
188
components .NewItem (
188
189
"Cluster Name" ,
189
- v1alpha1 .ClusterConfigDoc . Describe ("clusterName" , true ),
190
+ describe [ v1alpha1.ClusterConfig ] ("clusterName" , true ),
190
191
& opts .ClusterConfig .Name ,
191
192
),
192
193
components .NewItem (
193
194
"Control Plane Endpoint" ,
194
- v1alpha1 .ControlPlaneConfigDoc . Describe ("endpoint" , true ),
195
+ describe [ v1alpha1.ControlPlaneConfig ] ("endpoint" , true ),
195
196
& opts .ClusterConfig .ControlPlane .Endpoint ,
196
197
),
197
198
components .NewItem (
@@ -201,7 +202,7 @@ func NewState(ctx context.Context, installer *Installer, conn *Connection) (*Sta
201
202
),
202
203
components .NewItem (
203
204
"Allow Scheduling on Control Planes" ,
204
- v1alpha1 .ClusterConfigDoc . Describe ("allowSchedulingOnControlPlanes" , true ),
205
+ describe [ v1alpha1.ClusterConfig ] ("allowSchedulingOnControlPlanes" , true ),
205
206
& opts .ClusterConfig .AllowSchedulingOnControlPlanes ,
206
207
),
207
208
),
@@ -268,27 +269,27 @@ func configureAdapter(installer *Installer, opts *machineapi.GenerateConfigurati
268
269
items := []* components.Item {
269
270
components .NewItem (
270
271
"Use DHCP" ,
271
- v1alpha1 .DeviceDoc . Describe ("dhcp" , true ),
272
+ describe [ v1alpha1.Device ] ("dhcp" , true ),
272
273
& adapterSettings .Dhcp ,
273
274
),
274
275
components .NewItem (
275
276
"Ignore" ,
276
- v1alpha1 .DeviceDoc . Describe ("ignore" , true ),
277
+ describe [ v1alpha1.Device ] ("ignore" , true ),
277
278
& adapterSettings .Ignore ,
278
279
),
279
280
components .NewItem (
280
281
"CIDR" ,
281
- v1alpha1 .DeviceDoc . Describe ("cidr" , true ),
282
+ describe [ v1alpha1.Device ] ("cidr" , true ),
282
283
& adapterSettings .Cidr ,
283
284
),
284
285
components .NewItem (
285
286
"MTU" ,
286
- v1alpha1 .DeviceDoc . Describe ("mtu" , true ),
287
+ describe [ v1alpha1.Device ] ("mtu" , true ),
287
288
& adapterSettings .Mtu ,
288
289
),
289
290
components .NewItem (
290
291
"Route Metric" ,
291
- v1alpha1 .DeviceDoc . Describe ("dhcpOptions" , true ),
292
+ describe [ v1alpha1.Device ] ("dhcpOptions" , true ),
292
293
& adapterSettings .DhcpOptions .RouteMetric ,
293
294
),
294
295
}
@@ -339,3 +340,13 @@ func configureAdapter(installer *Installer, opts *machineapi.GenerateConfigurati
339
340
})
340
341
}
341
342
}
343
+
344
+ type documentable interface {
345
+ Doc () * encoder.Doc
346
+ }
347
+
348
+ func describe [T documentable ](field string , short bool ) string {
349
+ var zeroT T
350
+
351
+ return zeroT .Doc ().Describe (field , short )
352
+ }
0 commit comments