@@ -42,15 +42,15 @@ pub(crate) struct ClusterCustomizations {
4242 pub ( crate ) files : Vec < ConfigPath > ,
4343 pub ( crate ) cluster_rename : Option < ClusterNamesRename > ,
4444 pub ( crate ) hostname : Option < String > ,
45- pub ( crate ) ip : Option < String > ,
45+ pub ( crate ) ip_addresses : Vec < String > ,
4646 pub ( crate ) proxy : Option < Proxy > ,
4747 pub ( crate ) install_config : Option < String > ,
4848 pub ( crate ) kubeadmin_password_hash : Option < String > ,
4949 #[ serde( serialize_with = "redact" ) ]
5050 pub ( crate ) pull_secret : Option < String > ,
5151 pub ( crate ) user_ca_bundle : Option < String > ,
5252 pub ( crate ) proxy_trusted_ca_bundle : Option < ProxyAdditionalTrustBundle > ,
53- pub ( crate ) machine_network_cidr : Option < String > ,
53+ pub ( crate ) machine_network_cidrs : Vec < String > ,
5454 pub ( crate ) chrony_config : Option < String > ,
5555}
5656
@@ -155,12 +155,12 @@ impl RecertConfig {
155155 files : vec ! [ ] ,
156156 cluster_rename : None ,
157157 hostname : None ,
158- ip : None ,
158+ ip_addresses : vec ! [ ] ,
159159 kubeadmin_password_hash : None ,
160160 pull_secret : None ,
161161 proxy : None ,
162162 install_config : None ,
163- machine_network_cidr : None ,
163+ machine_network_cidrs : vec ! [ ] ,
164164 user_ca_bundle : None ,
165165 proxy_trusted_ca_bundle : None ,
166166 chrony_config : None ,
@@ -222,9 +222,22 @@ impl RecertConfig {
222222 Some ( value) => Some ( value. as_str ( ) . context ( "hostname must be a string" ) ?. to_string ( ) ) ,
223223 None => None ,
224224 } ;
225- let ip = match value. remove ( "ip" ) {
226- Some ( value) => Some ( value. as_str ( ) . context ( "ip must be a string" ) ?. to_string ( ) ) ,
227- None => None ,
225+ let ip_addresses: Vec < String > = match value. remove ( "ip" ) {
226+ Some ( serde_json:: Value :: Array ( array) ) => {
227+ ensure ! ( array. len( ) <= 2 , "ip array must up to 2 elements" ) ;
228+ array
229+ . iter ( )
230+ . map ( |v| -> Result < String , anyhow:: Error > {
231+ Ok ( v. as_str ( ) . context ( "ip array element must be a string" ) ?. to_string ( ) )
232+ } )
233+ . collect :: < Result < Vec < _ > , _ > > ( ) ?
234+ }
235+ Some ( serde_json:: Value :: String ( single_ip) ) => {
236+ // Handle single IP for backward compatibility
237+ vec ! [ single_ip. to_string( ) ]
238+ }
239+ None => vec ! [ ] ,
240+ _ => anyhow:: bail!( "ip must be a string or an array of strings" ) ,
228241 } ;
229242 let pull_secret = match value. remove ( "pull_secret" ) {
230243 Some ( value) => Some ( value. as_str ( ) . context ( "pull_secret must be a string" ) ?. to_string ( ) ) ,
@@ -260,9 +273,22 @@ impl RecertConfig {
260273 ) ,
261274 None => None ,
262275 } ;
263- let machine_network_cidr = match value. remove ( "machine_network_cidr" ) {
264- Some ( value) => Some ( value. as_str ( ) . context ( "machine_network_cidr must be a string" ) ?. to_string ( ) ) ,
265- None => None ,
276+ let machine_network_cidrs = match value. remove ( "machine_network_cidr" ) {
277+ Some ( serde_json:: Value :: Array ( array) ) => {
278+ ensure ! ( array. len( ) <= 2 , "machine_network_cidr array must up to 2 elements" ) ;
279+ array
280+ . iter ( )
281+ . map ( |v| -> Result < String , anyhow:: Error > {
282+ Ok ( v. as_str ( ) . context ( "machine_network_cidr array element must be a string" ) ?. to_string ( ) )
283+ } )
284+ . collect :: < Result < Vec < _ > , _ > > ( ) ?
285+ }
286+ Some ( serde_json:: Value :: String ( single_cidr) ) => {
287+ // Handle single CIDR for backward compatibility
288+ vec ! [ single_cidr. to_string( ) ]
289+ }
290+ None => vec ! [ ] ,
291+ _ => anyhow:: bail!( "machine_network_cidr must be a string or an array of strings" ) ,
266292 } ;
267293 let chrony_config = match value. remove ( "chrony_config" ) {
268294 Some ( value) => Some ( value. as_str ( ) . context ( "chrony_config must be a string" ) ?. to_string ( ) ) ,
@@ -338,14 +364,14 @@ impl RecertConfig {
338364 files : cluster_customization_files,
339365 cluster_rename,
340366 hostname,
341- ip ,
367+ ip_addresses ,
342368 kubeadmin_password_hash : set_kubeadmin_password_hash,
343369 pull_secret,
344370 user_ca_bundle,
345371 proxy_trusted_ca_bundle,
346372 proxy,
347373 install_config,
348- machine_network_cidr ,
374+ machine_network_cidrs ,
349375 chrony_config,
350376 } ;
351377
@@ -429,14 +455,14 @@ impl RecertConfig {
429455 } ,
430456 cluster_rename : cli. cluster_rename ,
431457 hostname : cli. hostname ,
432- ip : cli. ip ,
458+ ip_addresses : cli. ip ,
433459 proxy : cli. proxy ,
434460 install_config : cli. install_config ,
435461 kubeadmin_password_hash : cli. kubeadmin_password_hash ,
436462 pull_secret : cli. pull_secret ,
437463 user_ca_bundle : cli. user_ca_bundle ,
438464 proxy_trusted_ca_bundle : cli. proxy_trusted_ca_bundle ,
439- machine_network_cidr : cli. machine_network_cidr ,
465+ machine_network_cidrs : cli. machine_network_cidr ,
440466 chrony_config : cli. chrony_config ,
441467 } ,
442468 encryption_customizations : EncryptionCustomizations {
0 commit comments