Skip to content

Commit 60f5a4c

Browse files
authored
Merge pull request #619 from hidekazuna/bastion
✨ Add bastion host to login the nodes and update non HA template
2 parents ea415e1 + 6b6a801 commit 60f5a4c

File tree

14 files changed

+730
-162
lines changed

14 files changed

+730
-162
lines changed

.zuul/playbooks/run.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@
4848
openstack availability zone list
4949
openstack domain list
5050
51+
openstack flavor delete m1.tiny
52+
openstack flavor create --ram 128 --disk 1 --vcpus 1 --public --id 1 m1.tiny --property hw_rng:allowed='True'
5153
openstack flavor delete m1.small
5254
openstack flavor create --ram 4096 --disk 10 --vcpus 2 --public --id 2 m1.small --property hw_rng:allowed='True'
5355
openstack flavor delete m1.medium

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,10 @@ OPENSTACK_CLOUD_PROVIDER_CONF_B64 ?= ""
298298
OPENSTACK_CLOUD_YAML_B64 ?= ""
299299
OPENSTACK_DNS_NAMESERVERS ?= ""
300300
OPENSTACK_IMAGE_NAME ?= "ubuntu-1910-kube-v1.17.3"
301+
OPENSTACK_BASTION_IMAGE_NAME ?= "cirros"
301302
OPENSTACK_NODE_MACHINE_FLAVOR ?= "m1.small"
302303
OPENSTACK_CONTROL_PLANE_MACHINE_FLAVOR ?= "m1.medium"
304+
OPENSTACK_BASTION_MACHINE_FLAVOR ?= "m1.tiny"
303305
CLUSTER_NAME ?= "capi-quickstart"
304306
OPENSTACK_SSH_KEY_NAME ?= "${CLUSTER_NAME}-key"
305307
OPENSTACK_CLUSTER_TEMPLATE ?= "./templates/cluster-template-without-lb.yaml"
@@ -382,7 +384,10 @@ create-cluster: $(CLUSTERCTL) $(KUSTOMIZE) $(ENVSUBST) ## Create a development K
382384
sed "s|\$${OPENSTACK_CLOUD_PROVIDER_CONF_B64}|$(OPENSTACK_CLOUD_PROVIDER_CONF_B64)|" | \
383385
sed "s|\$${OPENSTACK_CLOUD_CACERT_B64}|$(OPENSTACK_CLOUD_CACERT_B64)|" | \
384386
sed "s|\$${KUBERNETES_VERSION}|$(KUBERNETES_VERSION)|" | \
385-
sed "s|\$${CLUSTER_NAME}|$(CLUSTER_NAME)|" \
387+
sed "s|\$${CLUSTER_NAME}|$(CLUSTER_NAME)|" | \
388+
sed "s|\$${OPENSTACK_BASTION_MACHINE_FLAVOR}|$(OPENSTACK_BASTION_MACHINE_FLAVOR)|" | \
389+
sed "s|\$${OPENSTACK_BASTION_IMAGE_NAME}|$(OPENSTACK_BASTION_IMAGE_NAME)|" | \
390+
sed "s|\$${OPENSTACK_SSH_KEY_NAME}|$(OPENSTACK_SSH_KEY_NAME)|" \
386391
> ./hack/ci/e2e-conformance/e2e-conformance_patch.yaml
387392
$(KUSTOMIZE) build --reorder=none hack/ci/e2e-conformance > ./out/cluster.yaml
388393

api/v1alpha3/openstackcluster_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ type OpenStackClusterSpec struct {
105105

106106
// ControlPlaneAvailabilityZones is the az to deploy control plane to
107107
ControlPlaneAvailabilityZones []string `json:"controlPlaneAvailabilityZones,omitempty"`
108+
109+
// Bastion is the OpenStack instance to login the nodes
110+
//+optional
111+
Bastion *Bastion `json:"bastion,omitempty"`
108112
}
109113

110114
// OpenStackClusterStatus defines the observed state of OpenStackCluster
@@ -129,6 +133,10 @@ type OpenStackClusterStatus struct {
129133
// WorkerSecurityGroup contains all the information about the OpenStack Security
130134
// Group that needs to be applied to worker nodes.
131135
WorkerSecurityGroup *SecurityGroup `json:"workerSecurityGroup,omitempty"`
136+
137+
BastionSecurityGroup *SecurityGroup `json:"bastionSecurityGroup,omitempty"`
138+
139+
Bastion *Bastion `json:"bastion,omitempty"`
132140
}
133141

134142
// +kubebuilder:object:root=true
@@ -140,6 +148,7 @@ type OpenStackClusterStatus struct {
140148
// +kubebuilder:printcolumn:name="Network",type="string",JSONPath=".status.network.id",description="Network the cluster is using"
141149
// +kubebuilder:printcolumn:name="Subnet",type="string",JSONPath=".status.network.subnet.id",description="Subnet the cluster is using"
142150
// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".spec.controlPlaneEndpoint.host",description="API Endpoint",priority=1
151+
// +kubebuilder:printcolumn:name="Bastion",type="string",JSONPath=".status.bastion.floatingIP",description="Bastion floating IP"
143152

144153
// OpenStackCluster is the Schema for the openstackclusters API
145154
type OpenStackCluster struct {

api/v1alpha3/types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,3 +237,19 @@ var (
237237

238238
InstanceStateShutoff = InstanceState("SHUTOFF")
239239
)
240+
241+
// Bastion represents basic information about the bastion node
242+
type Bastion struct {
243+
//+optional
244+
Enabled bool `json:"enabled"`
245+
//+optional
246+
Flavor string `json:"flavor,omitempty"`
247+
//+optional
248+
Image string `json:"image,omitempty"`
249+
//+optional
250+
SSHKeyName string `json:"sshKeyName,omitempty"`
251+
//+optional
252+
SecurityGroups []SecurityGroupParam `json:"securityGroups,omitempty"`
253+
//+optional
254+
FloatingIP string `json:"floatingIP,omitempty"`
255+
}

api/v1alpha3/zz_generated.deepcopy.go

Lines changed: 35 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ spec:
4040
name: Endpoint
4141
priority: 1
4242
type: string
43+
- description: Bastion floating IP
44+
jsonPath: .status.bastion.floatingIP
45+
name: Bastion
46+
type: string
4347
name: v1alpha3
4448
schema:
4549
openAPIV3Schema:
@@ -75,6 +79,61 @@ spec:
7579
description: APIServerLoadBalancerPort is the port on which the listener
7680
on the APIServer loadbalancer will be created
7781
type: integer
82+
bastion:
83+
description: Bastion is the OpenStack instance to login the nodes
84+
properties:
85+
enabled:
86+
type: boolean
87+
flavor:
88+
type: string
89+
floatingIP:
90+
type: string
91+
image:
92+
type: string
93+
securityGroups:
94+
items:
95+
properties:
96+
filter:
97+
description: Filters used to query security groups in openstack
98+
properties:
99+
description:
100+
type: string
101+
id:
102+
type: string
103+
limit:
104+
type: integer
105+
marker:
106+
type: string
107+
name:
108+
type: string
109+
notTags:
110+
type: string
111+
notTagsAny:
112+
type: string
113+
projectId:
114+
type: string
115+
sortDir:
116+
type: string
117+
sortKey:
118+
type: string
119+
tags:
120+
type: string
121+
tagsAny:
122+
type: string
123+
tenantId:
124+
type: string
125+
type: object
126+
name:
127+
description: Security Group name
128+
type: string
129+
uuid:
130+
description: Security Group UID
131+
type: string
132+
type: object
133+
type: array
134+
sshKeyName:
135+
type: string
136+
type: object
78137
cloudName:
79138
description: The name of the cloud to use from the clouds secret
80139
type: string
@@ -311,6 +370,113 @@ spec:
311370
status:
312371
description: OpenStackClusterStatus defines the observed state of OpenStackCluster
313372
properties:
373+
bastion:
374+
description: Bastion represents basic information about the bastion
375+
node
376+
properties:
377+
enabled:
378+
type: boolean
379+
flavor:
380+
type: string
381+
floatingIP:
382+
type: string
383+
image:
384+
type: string
385+
securityGroups:
386+
items:
387+
properties:
388+
filter:
389+
description: Filters used to query security groups in openstack
390+
properties:
391+
description:
392+
type: string
393+
id:
394+
type: string
395+
limit:
396+
type: integer
397+
marker:
398+
type: string
399+
name:
400+
type: string
401+
notTags:
402+
type: string
403+
notTagsAny:
404+
type: string
405+
projectId:
406+
type: string
407+
sortDir:
408+
type: string
409+
sortKey:
410+
type: string
411+
tags:
412+
type: string
413+
tagsAny:
414+
type: string
415+
tenantId:
416+
type: string
417+
type: object
418+
name:
419+
description: Security Group name
420+
type: string
421+
uuid:
422+
description: Security Group UID
423+
type: string
424+
type: object
425+
type: array
426+
sshKeyName:
427+
type: string
428+
type: object
429+
bastionSecurityGroup:
430+
description: SecurityGroup represents the basic information of the
431+
associated OpenStack Neutron Security Group.
432+
properties:
433+
id:
434+
type: string
435+
name:
436+
type: string
437+
rules:
438+
items:
439+
description: SecurityGroupRule represent the basic information
440+
of the associated OpenStack Security Group Role.
441+
properties:
442+
description:
443+
type: string
444+
direction:
445+
type: string
446+
etherType:
447+
type: string
448+
name:
449+
type: string
450+
portRangeMax:
451+
type: integer
452+
portRangeMin:
453+
type: integer
454+
protocol:
455+
type: string
456+
remoteGroupID:
457+
type: string
458+
remoteIPPrefix:
459+
type: string
460+
securityGroupID:
461+
type: string
462+
required:
463+
- description
464+
- direction
465+
- etherType
466+
- name
467+
- portRangeMax
468+
- portRangeMin
469+
- protocol
470+
- remoteGroupID
471+
- remoteIPPrefix
472+
- securityGroupID
473+
type: object
474+
type: array
475+
required:
476+
- id
477+
- name
478+
- rules
479+
type: object
314480
controlPlaneSecurityGroup:
315481
description: 'ControlPlaneSecurityGroups contains all the information
316482
about the OpenStack Security Group that needs to be applied to control

0 commit comments

Comments
 (0)