@@ -484,22 +484,47 @@ metadata:
484
484
name: docker-clusterclass-v0.1.0
485
485
spec:
486
486
...
487
- jsonPatches:
488
- - op: add
489
- path: /spec/template/spec/httpProxy/url
490
- valueFrom:
491
- # Use the url field of the httpProxy variable.
492
- variable: httpProxy.url
493
- - op: add
494
- path: /spec/template/spec/dnsServers
495
- valueFrom:
496
- # Use the entire dnsServers array.
497
- variable: dnsServers
498
- - op: add
499
- path: /spec/template/spec/dnsServer
500
- valueFrom:
501
- # Use the first item of the dnsServers array.
502
- variable: dnsServers[0]
487
+ jsonPatches:
488
+ - op: add
489
+ path: /spec/template/spec/httpProxy/url
490
+ valueFrom:
491
+ # Use the url field of the httpProxy variable.
492
+ variable: httpProxy.url
493
+ - op: add
494
+ path: /spec/template/spec/dnsServers
495
+ valueFrom:
496
+ # Use the entire dnsServers array.
497
+ variable: dnsServers
498
+ - op: add
499
+ path: /spec/template/spec/dnsServer
500
+ valueFrom:
501
+ # Use the first item of the dnsServers array.
502
+ variable: dnsServers[0]
503
+ ` ` `
504
+
505
+ **Tips & Tricks**
506
+
507
+ Complex variables can be used to make references in templates configurable, e.g. the `identityRef` used in `AzureCluster`.
508
+ Of course it's also possible to only make the name of the reference configurable, including restricting the valid values
509
+ to a pre-defined enum.
510
+
511
+ ` ` ` yaml
512
+ apiVersion: cluster.x-k8s.io/v1beta1
513
+ kind: ClusterClass
514
+ metadata:
515
+ name: azure-clusterclass-v0.1.0
516
+ spec:
517
+ ...
518
+ variables:
519
+ - name: clusterIdentityRef
520
+ schema:
521
+ openAPIV3Schema:
522
+ type: object
523
+ properties:
524
+ kind:
525
+ type: string
526
+ name:
527
+ type: string
503
528
` ` `
504
529
505
530
# ## Using variable values in JSON patches
0 commit comments