Skip to content

Commit 280a160

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 db21fa8 commit 280a160

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
@@ -65,6 +65,7 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
6565
dst.Status.Bastion.MarketType = restored.Status.Bastion.MarketType
6666
dst.Status.Bastion.HostAffinity = restored.Status.Bastion.HostAffinity
6767
dst.Status.Bastion.HostID = restored.Status.Bastion.HostID
68+
dst.Status.Bastion.IPv6Address = restored.Status.Bastion.IPv6Address
6869
}
6970
dst.Spec.Partition = restored.Spec.Partition
7071

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
@@ -1320,6 +1320,9 @@ spec:
13201320
instanceState:
13211321
description: The current state of the instance.
13221322
type: string
1323+
ipv6Address:
1324+
description: The IPv6 address assigned to the instance.
1325+
type: string
13231326
marketType:
13241327
description: |-
13251328
MarketType specifies the type of market for the EC2 instance. Valid values include:
@@ -3526,6 +3529,9 @@ spec:
35263529
instanceState:
35273530
description: The current state of the instance.
35283531
type: string
3532+
ipv6Address:
3533+
description: The IPv6 address assigned to the instance.
3534+
type: string
35293535
marketType:
35303536
description: |-
35313537
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:
@@ -2302,6 +2306,9 @@ spec:
23022306
instanceState:
23032307
description: The current state of the instance.
23042308
type: string
2309+
ipv6Address:
2310+
description: The IPv6 address assigned to the instance.
2311+
type: string
23052312
marketType:
23062313
description: |-
23072314
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
@@ -919,6 +919,7 @@ func (s *Service) SDKToInstance(v types.Instance) (*infrav1.Instance, error) {
919919
ImageID: aws.ToString(v.ImageId),
920920
SSHKeyName: v.KeyName,
921921
PrivateIP: v.PrivateIpAddress,
922+
IPv6Address: v.Ipv6Address,
922923
PublicIP: v.PublicIpAddress,
923924
ENASupport: v.EnaSupport,
924925
EBSOptimized: v.EbsOptimized,

0 commit comments

Comments
 (0)