Skip to content

Commit 2597c6c

Browse files
committed
crd: add IPv6 of bastion host to cluster status
When creating a bastion host for an IPv6 cluster, the instance has both public IPv4 and IPv6. Thus, we need to report them in the cluster status if any. This also adds an additional print column to display that bastion IPv6.
1 parent 594e650 commit 2597c6c

8 files changed

+27
-2
lines changed

api/v1beta1/awscluster_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
6363
dst.Status.Bastion.NetworkInterfaceType = restored.Status.Bastion.NetworkInterfaceType
6464
dst.Status.Bastion.CapacityReservationID = restored.Status.Bastion.CapacityReservationID
6565
dst.Status.Bastion.MarketType = restored.Status.Bastion.MarketType
66+
dst.Status.Bastion.IPv6Address = restored.Status.Bastion.IPv6Address
6667
}
6768
dst.Spec.Partition = restored.Spec.Partition
6869

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/awscluster_types.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,8 @@ type S3Bucket struct {
324324
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Cluster infrastructure is ready for EC2 instances"
325325
// +kubebuilder:printcolumn:name="VPC",type="string",JSONPath=".spec.network.vpc.id",description="AWS VPC the cluster is using"
326326
// +kubebuilder:printcolumn:name="Endpoint",type="string",JSONPath=".spec.controlPlaneEndpoint",description="API Endpoint",priority=1
327-
// +kubebuilder:printcolumn:name="Bastion IP",type="string",JSONPath=".status.bastion.publicIp",description="Bastion IP address for breakglass access"
327+
// +kubebuilder:printcolumn:name="Bastion IP",type="string",JSONPath=".status.bastion.publicIp",description="Bastion IPv4 address for breakglass access"
328+
// +kubebuilder:printcolumn:name="Bastion IPv6",type="string",JSONPath=".status.bastion.ipv6Address",description="Bastion IPv6 address for breakglass access"
328329
// +k8s:defaulter-gen=true
329330

330331
// AWSCluster is the schema for Amazon EC2 based Kubernetes Cluster API.

api/v1beta2/types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ type Instance struct {
197197
// The private IPv4 address assigned to the instance.
198198
PrivateIP *string `json:"privateIp,omitempty"`
199199

200+
// The IPv6 address assigned to the instance.
201+
IPv6Address *string `json:"ipv6Address,omitempty"`
202+
200203
// The public IPv4 address assigned to the instance, if applicable.
201204
PublicIP *string `json:"publicIp,omitempty"`
202205

api/v1beta2/zz_generated.deepcopy.go

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

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,9 @@ spec:
13061306
instanceState:
13071307
description: The current state of the instance.
13081308
type: string
1309+
ipv6Address:
1310+
description: The IPv6 address assigned to the instance.
1311+
type: string
13091312
marketType:
13101313
description: |-
13111314
MarketType specifies the type of market for the EC2 instance. Valid values include:
@@ -3497,6 +3500,9 @@ spec:
34973500
instanceState:
34983501
description: The current state of the instance.
34993502
type: string
3503+
ipv6Address:
3504+
description: The IPv6 address assigned to the instance.
3505+
type: string
35003506
marketType:
35013507
description: |-
35023508
MarketType specifies the type of market for the EC2 instance. Valid values include:

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,10 +901,14 @@ spec:
901901
name: Endpoint
902902
priority: 1
903903
type: string
904-
- description: Bastion IP address for breakglass access
904+
- description: Bastion IPv4 address for breakglass access
905905
jsonPath: .status.bastion.publicIp
906906
name: Bastion IP
907907
type: string
908+
- description: Bastion IPv6 address for breakglass access
909+
jsonPath: .status.bastion.ipv6Address
910+
name: Bastion IPv6
911+
type: string
908912
name: v1beta2
909913
schema:
910914
openAPIV3Schema:
@@ -2288,6 +2292,9 @@ spec:
22882292
instanceState:
22892293
description: The current state of the instance.
22902294
type: string
2295+
ipv6Address:
2296+
description: The IPv6 address assigned to the instance.
2297+
type: string
22912298
marketType:
22922299
description: |-
22932300
MarketType specifies the type of market for the EC2 instance. Valid values include:

pkg/cloud/services/ec2/instances.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ func (s *Service) SDKToInstance(v types.Instance) (*infrav1.Instance, error) {
891891
ImageID: aws.ToString(v.ImageId),
892892
SSHKeyName: v.KeyName,
893893
PrivateIP: v.PrivateIpAddress,
894+
IPv6Address: v.Ipv6Address,
894895
PublicIP: v.PublicIpAddress,
895896
ENASupport: v.EnaSupport,
896897
EBSOptimized: v.EbsOptimized,

0 commit comments

Comments
 (0)