Skip to content

Commit de74706

Browse files
committed
feat: add bastion and allowedCIDR to dev-test clusterclass
Signed-off-by: Bharath Nallapeta <[email protected]>
1 parent 6d42cbb commit de74706

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

templates/cluster-template-development.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@ spec:
2424
value: ${ADD_IMAGE_VERSION:=false}
2525
- name: injectIgnitionSysext
2626
value: ${INJECT_IGNITION_SYSEXT:=true}
27+
- name: allowedCIDRs
28+
value: ${OPENSTACK_API_SERVER_ALLOWED_CIDRS:=[]}
29+
- name: bastion
30+
value:
31+
enabled: ${OPENSTACK_BASTION_ENABLED:=false}
32+
spec:
33+
flavor: ${OPENSTACK_BASTION_FLAVOR:=m1.small}
34+
image:
35+
filter:
36+
name: ${OPENSTACK_BASTION_IMAGE_NAME:=ubuntu-24.04}
37+
sshKeyName: ${OPENSTACK_SSH_KEY_NAME:=""}

templates/clusterclass-dev-test.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,53 @@ spec:
7373
Use a sysext overlay to add the Kubernetes components to the image.
7474
This is for use with flatcar and similar images.
7575
default: false
76+
- name: allowedCIDRs
77+
required: false
78+
schema:
79+
openAPIV3Schema:
80+
type: array
81+
items:
82+
type: string
83+
description: |
84+
List of CIDR ranges allowed to access the API server load balancer.
85+
If not specified, all traffic will be allowed.
86+
default: []
87+
- name: bastion
88+
required: false
89+
schema:
90+
openAPIV3Schema:
91+
type: object
92+
properties:
93+
enabled:
94+
type: boolean
95+
description: "Enable or disable the bastion host"
96+
default: false
97+
spec:
98+
type: object
99+
description: "OpenStackMachineSpec for the bastion host"
100+
properties:
101+
flavor:
102+
type: string
103+
description: "OpenStack flavor for the bastion"
104+
image:
105+
type: object
106+
properties:
107+
filter:
108+
type: object
109+
properties:
110+
name:
111+
type: string
112+
description: "Name of the image to use for bastion"
113+
sshKeyName:
114+
type: string
115+
description: "SSH key pair name for bastion access"
116+
floatingIP:
117+
type: string
118+
format: ipv4
119+
description: "Floating IP address to assign to the bastion (optional)"
120+
availabilityZone:
121+
type: string
122+
description: "Availability zone for the bastion host"
76123
patches:
77124
- name: image
78125
description: "Sets the OpenStack image that is used for creating the servers."
@@ -114,6 +161,34 @@ spec:
114161
path: /spec/template/spec/identityRef
115162
valueFrom:
116163
variable: identityRef
164+
- name: allowedCIDRs
165+
description: "Sets the allowed CIDRs for the API server load balancer."
166+
enabledIf: "{{ if .allowedCIDRs }}{{ gt (len .allowedCIDRs) 0 }}{{ end }}"
167+
definitions:
168+
- selector:
169+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
170+
kind: OpenStackClusterTemplate
171+
matchResources:
172+
infrastructureCluster: true
173+
jsonPatches:
174+
- op: add
175+
path: /spec/template/spec/apiServerLoadBalancer/allowedCIDRs
176+
valueFrom:
177+
variable: allowedCIDRs
178+
- name: bastion
179+
description: "Sets the bastion host configuration."
180+
enabledIf: "{{ if .bastion }}{{ .bastion.enabled }}{{ end }}"
181+
definitions:
182+
- selector:
183+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
184+
kind: OpenStackClusterTemplate
185+
matchResources:
186+
infrastructureCluster: true
187+
jsonPatches:
188+
- op: add
189+
path: /spec/template/spec/bastion
190+
valueFrom:
191+
variable: bastion
117192
- name: ignitionSysext
118193
description: "Add the necessary ignition configuration for kube components through sysext."
119194
enabledIf: "{{ .injectIgnitionSysext }}"

0 commit comments

Comments
 (0)