-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcluster-class.yaml
912 lines (901 loc) · 36.4 KB
/
cluster-class.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: {{ .Release.Name }}-{{ .Chart.Version }}
spec:
controlPlane:
ref:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
machineInfrastructure:
ref:
kind: OpenStackMachineTemplate
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
name: {{ .Release.Name }}-{{ .Chart.Version }}-control-plane
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-cluster
workers:
machineDeployments:
- class: default-worker
template:
bootstrap:
ref:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-default-worker
infrastructure:
ref:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
name: {{ .Release.Name }}-{{ .Chart.Version }}-default-worker
variables:
- name: external_id
required: false
schema:
openAPIV3Schema:
type: string
example: "ebfe5546-f09f-4f42-ab54-094e457d42ec"
format: "uuid4"
description: "ExternalNetworkID is the ID of an external OpenStack Network. This is necessary to get public internet to the VMs."
- name: controller_flavor
required: false
schema:
openAPIV3Schema:
type: string
default: "SCS-2V-4-20s"
example: "SCS-2V-4-20s"
description: "OpenStack instance flavor for control-plane nodes."
- name: worker_flavor
required: false
schema:
openAPIV3Schema:
type: string
default: "SCS-2V-4"
example: "SCS-2V-4"
description: "OpenStack instance flavor for worker nodes."
- name: controller_root_disk
required: false
schema:
openAPIV3Schema:
type: integer
minimum: 1
example: 25
description: "Root disk size in GiB for control-plane nodes. OpenStack volume will be created and used instead of an ephemeral disk defined in flavor. Should only be used for the diskless flavors."
- name: worker_root_disk
required: false
schema:
openAPIV3Schema:
type: integer
minimum: 1
default: 25
example: 25
description: "Root disk size in GiB for worker nodes. OpenStack volume will be created and used instead of an ephemeral disk defined in flavor. Should be used for the diskless flavors."
- name: yawol_flavor_id
required: false
schema:
openAPIV3Schema:
type: string
format: "uuid4"
example: "0a79590e-10d7-4c2c-8f69-ca0a2c6208d2"
description: "ID of the existing flavor used as a default yawol flavor."
- name: yawol_image_id
required: false
schema:
openAPIV3Schema:
type: string
format: "uuid4"
example: "f0b2ef46-f0ff-43d2-9c08-f58a5a6e9060"
description: "ID of the existing imaged used as a default yawol image."
- name: kube_vip_network_id
required: false
schema:
openAPIV3Schema:
type: string
format: "uuid4"
example: "40a51f6c-9e4b-4b24-9187-49851a410c97"
description: "ID of the existing network. The network should have one subnet with one port reserved as virtual IP."
- name: kube_vip_apiserver_virtual_ip
required: false
schema:
openAPIV3Schema:
type: string
format: "ipv4"
example: "10.0.0.197"
description: "Virtual IP address reserved in kube_vip_network_id."
- name: kube_vip_apiserver_public_ip
required: false
schema:
openAPIV3Schema:
type: string
format: "ipv4"
description: "Public IP address associated with kube_vip_apiserver_virtual_ip. It is needed only when the management cluster is on a different network as a workload cluster."
- name: registry_mirrors
required: false
schema:
openAPIV3Schema:
type: array
default: []
example: [ { hostname_upstream: "docker.io", url_upstream: "https://registry-1.docker.io", url_mirror: "https://registry.foo.tld/v2/foo", cert_mirror: "" }, { hostname_upstream: "gcr.io", url_upstream: "https://gcr.io", url_mirror: "https://registry.bar.tld/v2/foo", cert_mirror: "" } ]
description: "Registry mirrors for upstream registries"
items:
type: object
properties:
hostname_upstream:
type: string
example: "docker.io"
description: "The hostname of the upstream registry"
url_upstream:
type: string
example: "https://registry-1.docker.io"
description: "The url of the upstream registry"
url_mirror:
type: string
example: "https://registry.xyz.tld/v2/dockerhub"
description: "The url of the mirror"
cert_mirror:
type: string
example: "<PEM>"
description: "The certificate of mirror in PEM format"
- name: openstack_security_groups
required: false
schema:
openAPIV3Schema:
type: array
default: []
example: ["security-group-1"]
description: "The names of the security groups to assign to the instance"
items:
type: string
- name: cloud_name
required: false
schema:
openAPIV3Schema:
type: string
default: "openstack"
example: "openstack"
description: "The name of the cloud to use from the clouds secret"
- name: secret_name
required: false
schema:
openAPIV3Schema:
type: string
default: "openstack"
example: "openstack"
description: "The name of the clouds secret"
- name: controller_server_group_id
required: false
schema:
openAPIV3Schema:
type: string
default: ""
example: "3adf4e92-bb33-4e44-8ad3-afda9dfe8ec3"
description: "The server group to assign the control plane nodes to."
- name: worker_server_group_id
required: false
schema:
openAPIV3Schema:
type: string
default: ""
example: "869fe071-1e56-46a9-9166-47c9f228e297"
description: "The server group to assign the worker nodes to."
- name: ssh_key
required: false
schema:
openAPIV3Schema:
type: string
default: ""
example: "capi-keypair"
description: "The ssh key to inject in the nodes."
- name: apiserver_loadbalancer
required: false
schema:
openAPIV3Schema:
type: string
default: "octavia-amphora"
example: "none, octavia-amphora, octavia-ovn, kube-vip"
description: |
"In this cluster-stack we have two kind of loadbalancers. Each of them has its own configuration variable. This setting here is to configure the loadbalancer that is placed in front of the apiserver.
To configure the loadbalancer for the workloads, see variable workload_loadbalancer.
You can choose from 4 options:
none:
No loadbalancer solution will be deployed
octavia-amphora:
(default) Uses openstack's loadbalancer service (provider:amphora)
octavia-ovn:
Uses openstack's loadbalancer service (provider:ovn)
kube-vip:
Uses kube-vip as loadbalancer.
You have to provide the following additional variables:
kube_vip_network_id
kube_vip_apiserver_virtual_ip
kube_vip_apiserver_public_ip
Requires Kubernetes version < 1.29
Also the settings node_cidr and dns_nameservers will no longer have an effect.
- name: workload_loadbalancer
required: false
schema:
openAPIV3Schema:
type: string
default: "octavia-amphora"
example: "none, octavia-amphora, octavia-ovn, yawol"
description: |
"This setting here is to configure the loadbalancer solution for your services inside your cluster.
If you want to configure the loadbalancer in front of your apiserver, see variable apiserver_loadbalancer instead.
You can choose from 4 options:
none:
No loadbalancer solution will be deployed
octavia-amphora:
(default) Uses openstack's loadbalancer service (provider:amphora)
octavia-ovn:
Uses openstack's loadbalancer service (provider:ovn)
yawol:
Uses yawol as loadbalancer.
You have to provide the following additional variables:
yawol_flavor_id
yawol_image_id
Also note this setting does not work with application credentials (only username/password)"
- name: dns_nameservers
required: false
schema:
openAPIV3Schema:
type: array
description: |
"DNSNameservers is the list of nameservers for the OpenStack Subnet being created. Set this value when you need to create a new network/subnet while the access through DNS is required.
This setting has no effect when apiserver_loadbalancer is set to kube-vip.
However you can set the dns server when creating the subnet for kube-vip."
default: ["5.1.66.255", "185.150.99.255"]
example: ["5.1.66.255", "185.150.99.255"]
items:
type: string
- name: node_cidr
required: false
schema:
openAPIV3Schema:
type: string
format: "cidr"
default: "10.8.0.0/20"
example: "10.8.0.0/20"
description: |
"NodeCIDR is the OpenStack Subnet to be created. Cluster actuator will create a network, a subnet with NodeCIDR, and a router connected to this subnet. If you leave this empty, no network will be created.
This setting has no effect when apiserver_loadbalancer is set to kube-vip.
However you can set the node_cidr when creating the subnet for kube-vip."
- name: certSANs
required: false
schema:
openAPIV3Schema:
type: array
default: []
example: ["mydomain.example"]
description: "CertSANs sets extra Subject Alternative Names for the API Server signing cert."
items:
type: string
- name: oidc_config
required: false
schema:
openAPIV3Schema:
type: object
properties:
client_id:
type: string
example: "kubectl"
description: "A client id that all tokens must be issued for."
issuer_url:
type: string
example: "https://dex.k8s.scs.community"
description: "URL of the provider that allows the API server to
dis cover public signing keys. Only URLs that use the https:// scheme are
acc epted. This is typically the provider's discovery URL, changed to have an
emp ty path"
username_claim:
type: string
example: "preferred_username"
default: "preferred_username"
description: "JWT claim to use as the user name. By default sub,
whi ch is expected to be a unique identifier of the end user. Admins can choose
oth er claims, such as email or name, depending on their provider. However,
cla ims other than email will be prefixed with the issuer URL to prevent naming
cla shes with other plugins."
groups_claim:
type: string
example: "groups"
default: "groups"
description: "JWT claim to use as the user's group. If the claim
is present it must be an array of strings."
username_prefix:
type: string
example: "oidc:"
default: "oidc:"
description: "Prefix prepended to username claims to prevent
cla shes with existing names (such as system: users). For example, the value
oid c: will create usernames like oidc:jane.doe. If this flag isn't provided and
--o idc-username-claim is a value other than email the prefix defaults to (
Iss uer URL )# where ( Issuer URL ) is the value of --oidc-issuer-url. The value
- c an be used to disable all prefixing."
groups_prefix:
type: string
example: "oidc:"
default: "oidc:"
description: "Prefix prepended to group claims to prevent clashes
wit h existing names (such as system: groups). For example, the value oidc: will
cre ate group names like oidc:engineering and oidc:infra."
- name: network_mtu
required: false
schema:
openAPIV3Schema:
type: integer
example: 1500
description: "NetworkMTU sets the maximum transmission unit (MTU) value to address fragmentation for the private network ID."
- name: controlPlaneAvailabilityZones
required: false
schema:
openAPIV3Schema:
type: array
example: ["nova"]
description: "ControlPlaneAvailabilityZones is the set of availability zones which control plane machines may be deployed to."
items:
type: string
- name: controlPlaneOmitAvailabilityZone
required: false
schema:
openAPIV3Schema:
type: boolean
example: true
description: "ControlPlaneOmitAvailabilityZone causes availability zone to be omitted when creating control plane nodes, allowing the Nova scheduler to make a decision on which availability zone to use based on other scheduling constraints."
patches:
- name: k8s_version
description: "Sets the openstack node image for workers and the controlplane to the cluster-api image with the version mentioned in spec.topology.version."
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: replace
path: "/spec/template/spec/image/filter/name"
valueFrom:
template: ubuntu-capi-image-{{ `{{ .builtin.cluster.topology.version }}` }}
- name: apiserver_loadbalancer_octavia-amphora
description: "Takes care of the patches that should be applied when variable apiserver_loadbalancer is set to octavia-amphora."
enabledIf: {{ `'{{ eq .apiserver_loadbalancer "octavia-amphora" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/apiServerLoadBalancer/enabled"
value: true
- op: add
path: "/spec/template/spec/apiServerLoadBalancer/provider"
value: "amphora"
- name: apiserver_loadbalancer_octavia-ovn
description: "Takes care of the patches that should be applied when variable apiserver_loadbalancer is set to octavia-ovn."
enabledIf: {{ `'{{ eq .apiserver_loadbalancer "octavia-ovn" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/apiServerLoadBalancer/enabled"
value: true
- op: add
path: "/spec/template/spec/apiServerLoadBalancer/provider"
value: "ovn"
- name: apiserver_loadbalancer_kube-vip
description: "Takes care of the patches that should be applied when variable apiserver_loadbalancer is set to kube-vip."
enabledIf: {{ `'{{ eq .apiserver_loadbalancer "kube-vip" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/network"
valueFrom:
template: |
id: {{"{{"}} .kube_vip_network_id {{"}}"}}
- op: add
path: "/spec/template/spec/disableAPIServerFloatingIP"
value: true
- op: add
path: "/spec/template/spec/apiServerFixedIP"
valueFrom:
template: {{ `"{{ if .kube_vip_apiserver_public_ip }}{{.kube_vip_apiserver_public_ip}}{{else}}{{.kube_vip_apiserver_virtual_ip}}{{end}}"` }}
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/ports"
valueFrom:
template: |
- network:
id: {{"{{"}} .kube_vip_network_id {{"}}"}}
allowedAddressPairs:
- ipAddress: {{"{{"}} .kube_vip_apiserver_virtual_ip {{"}}"}}
- selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/preKubeadmCommands"
valueFrom:
template: |
- modprobe --all ip_vs ip_vs_rr nf_conntrack
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/files"
valueFrom:
template: |
- content: |
ip_vs
ip_vs_rr
nf_conntrack
owner: "root:root"
path: /etc/modules-load.d/kube-vip.conf
permissions: "0644"
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/files/-"
valueFrom:
template: |
content: |
# docker run --network host --rm ghcr.io/kube-vip/kube-vip:v0.7.2 manifest pod --address '{{"{{"}} .kube_vip_apiserver_virtual_ip {{"}}"}}' --controlplane --arp --leaderElection --enableLoadBalancer
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: kube-vip
namespace: kube-system
spec:
containers:
- args:
- manager
env:
- name: vip_arp
value: "true"
- name: port
value: "6443"
- name: vip_cidr
value: "32"
- name: dns_mode
value: first
- name: cp_enable
value: "true"
- name: cp_namespace
value: kube-system
- name: vip_leaderelection
value: "true"
- name: vip_leasename
value: plndr-cp-lock
- name: vip_leaseduration
value: "5"
- name: vip_renewdeadline
value: "3"
- name: vip_retryperiod
value: "1"
- name: lb_enable
value: "true"
- name: lb_port
value: "6443"
- name: lb_fwdmethod
value: local
- name: address
value: '{{"{{"}} .kube_vip_apiserver_virtual_ip {{"}}"}}'
- name: prometheus_server
value: :2112
image: ghcr.io/kube-vip/kube-vip:v0.7.2
imagePullPolicy: IfNotPresent # Always
name: kube-vip
resources: {}
securityContext:
capabilities:
add:
- NET_ADMIN
- NET_RAW
volumeMounts:
- mountPath: /etc/kubernetes/admin.conf
name: kubeconfig
hostAliases:
- hostnames:
- kubernetes
ip: 127.0.0.1
hostNetwork: true
volumes:
- hostPath:
path: /etc/kubernetes/admin.conf
name: kubeconfig
status: {}
owner: "root:root"
path: /etc/kubernetes/manifests/kube-vip.yaml
permissions: "0644"
- name: controller_flavor
description: "Sets the openstack instance flavor for the KubeadmControlPlane."
enabledIf: {{ `'{{ ne .controller_flavor "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: replace
path: "/spec/template/spec/flavor"
valueFrom:
variable: controller_flavor
- name: worker_flavor
description: "Sets the openstack instance flavor for the worker nodes."
enabledIf: {{ `'{{ ne .worker_flavor "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: false
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: replace
path: "/spec/template/spec/flavor"
valueFrom:
variable: worker_flavor
- name: controller_root_disk
description: "Sets the root disk size in GiB for control-plane nodes."
enabledIf: {{ `"{{ if .controller_root_disk }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/rootVolume"
valueFrom:
template: |
sizeGiB: {{"{{"}} .controller_root_disk {{"}}"}}
- name: worker_root_disk
description: "Sets the root disk size in GiB for worker nodes."
enabledIf: {{ `"{{ if .worker_root_disk }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: false
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: add
path: "/spec/template/spec/rootVolume"
valueFrom:
template: |
sizeGiB: {{"{{"}} .worker_root_disk {{"}}"}}
- name: external_id
description: "Sets the ID of an external OpenStack Network. This is necessary to get public internet to the VMs."
enabledIf: {{ `"{{ if .external_id }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/externalNetwork"
value: {}
- op: add
path: "/spec/template/spec/externalNetwork/id"
valueFrom:
variable: external_id
- name: network_mtu
description: "Sets the network MTU when variable network_mtu exist in cluster resource."
enabledIf: {{ `"{{ if .network_mtu }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/networkMTU"
valueFrom:
variable: network_mtu
- name: controlPlaneAvailabilityZones
description: "Sets the availability zones which control plane machines may be deployed to."
enabledIf: {{ `"{{ if .controlPlaneAvailabilityZones }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/controlPlaneAvailabilityZones"
valueFrom:
variable: controlPlaneAvailabilityZones
- name: controlPlaneOmitAvailabilityZone
description: "Causes availability zone to be omitted when creating control plane nodes."
enabledIf: {{ `"{{ if .controlPlaneOmitAvailabilityZone }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/controlPlaneOmitAvailabilityZone"
valueFrom:
variable: controlPlaneOmitAvailabilityZone
- name: openstack_security_groups
description: "Sets the list of the openstack security groups for the worker and the controlplane instances."
enabledIf: {{ `"{{ if .openstack_security_groups }}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: add
path: "/spec/template/spec/securityGroups"
valueFrom:
template: {{ `"[ {{ range .openstack_security_groups }} { filter: { name: {{ . }}}}, {{ end }} ]"` }}
- name: cloud_name
description: "Sets the name of the cloud to use from the clouds secret."
enabledIf: {{ `'{{ ne .cloud_name "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/identityRef/cloudName"
valueFrom:
variable: cloud_name
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: replace
path: "/spec/template/spec/identityRef/cloudName"
valueFrom:
variable: cloud_name
- name: secret_name
description: "Sets the name of the clouds secret."
enabledIf: {{ `'{{ ne .secret_name "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: replace
path: "/spec/template/spec/identityRef/name"
valueFrom:
variable: secret_name
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: replace
path: "/spec/template/spec/identityRef/name"
valueFrom:
variable: secret_name
- name: controller_server_group_id
description: "Sets the server group to assign the control plane nodes to."
enabledIf: {{ `'{{ ne .controller_server_group_id "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/serverGroup"
valueFrom:
template: |
id: {{"{{"}} .controller_server_group_id {{"}}"}}
- name: worker_server_group_id
description: "Sets the server group to assign the worker nodes to."
enabledIf: {{ `'{{ ne .worker_server_group_id "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: false
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: add
path: "/spec/template/spec/serverGroup"
valueFrom:
template: |
id: {{"{{"}} .worker_server_group_id {{"}}"}}
- name: ssh_key
description: "Sets the ssh key to inject in the nodes."
enabledIf: {{ `'{{ ne .ssh_key "" }}'` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackMachineTemplate
matchResources:
controlPlane: true
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: add
path: "/spec/template/spec/sshKeyName"
valueFrom:
variable: ssh_key
- name: certSANs
description: "CertSANs sets extra Subject Alternative Names for the API Server signing cert."
enabledIf: {{ `"{{ if .certSANs }}true{{end}}"` }}
definitions:
- selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/certSANs"
valueFrom:
variable: certSANs
- name: oidc_config
description: "Configure API Server to use external authentication service."
enabledIf: {{ `"{{ if and .oidc_config .oidc_config.client_id .oidc_config.issuer_url }}true{{end}}"` }}
definitions:
- selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs/oidc-client-id"
valueFrom:
variable: oidc_config.client_id
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs/oidc-issuer-url"
valueFrom:
variable: oidc_config.issuer_url
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs/oidc-username-claim"
valueFrom:
variable: oidc_config.username_claim
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs/oidc-groups-claim"
valueFrom:
variable: oidc_config.groups_claim
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs/oidc-username-prefix"
valueFrom:
variable: oidc_config.username_prefix
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/clusterConfiguration/apiServer/extraArgs/oidc-groups-prefix"
valueFrom:
variable: oidc_config.groups_prefix
- name: subnet
description: "Sets the NodeCIDR for the OpenStack Subnet to be created. Cluster actuator will create a network, a subnet with NodeCIDR, and a router connected to this subnet."
enabledIf: {{ `"{{ if and .node_cidr (ne .apiserver_loadbalancer \"kube-vip\")}}true{{end}}"` }}
definitions:
- selector:
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: OpenStackClusterTemplate
matchResources:
infrastructureCluster: true
jsonPatches:
- op: add
path: "/spec/template/spec/managedSubnets"
valueFrom:
template: |
- cidr: '{{"{{"}} .node_cidr {{"}}"}}'
dnsNameservers:
{{`{{- range .dns_nameservers }}`}}
- {{`{{ . }}`}}
{{`{{- end }}`}}
- name: registry_mirrors_worker
description: "Configure registry mirrors for containerd (worker)."
enabledIf: {{ `"{{ if .registry_mirrors }}true{{end}}"` }}
definitions:
- selector:
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
matchResources:
machineDeploymentClass:
names:
- default-worker
jsonPatches:
- op: add
path: "/spec/template/spec/files"
valueFrom:
template: |
{{`{{- range $r := .registry_mirrors }}
- content: |
server = "{{ $r.url_upstream }}"
[host."{{ $r.url_mirror }}"]
capabilities = ["pull","resolve"]
override_path = true
owner: root:root
path: /etc/containerd/certs.d/{{ $r.hostname_upstream }}/hosts.toml
permissions: "0644"
{{- if $r.cert_mirror }}
- content: "{{ $r.cert_mirror }}"
owner: root:root
path: /etc/containerd/certs/{{ $r.hostname_upstream }}
permissions: "0644"
{{- end }}
{{- end }}`}}
- name: registry_mirrors_control_plane
description: "Configure registry mirrors for containerd (control plane)."
enabledIf: {{ `"{{ if .registry_mirrors }}true{{end}}"` }}
definitions:
- selector:
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlaneTemplate
matchResources:
controlPlane: true
jsonPatches:
- op: add
path: "/spec/template/spec/kubeadmConfigSpec/files"
valueFrom:
template: |
{{`{{- range $r := .registry_mirrors }}
- content: |
server = "{{ $r.url_upstream }}"
[host."{{ $r.url_mirror }}"]
capabilities = ["pull","resolve"]
override_path = true
owner: root:root
path: /etc/containerd/certs.d/{{ $r.hostname_upstream }}/hosts.toml
permissions: "0644"
{{- if $r.cert_mirror }}
- content: "{{ $r.cert_mirror }}"
owner: root:root
path: /etc/containerd/certs/{{ $r.hostname_upstream }}
permissions: "0644"
{{- end }}
{{- end }}`}}