Skip to content

Commit cc1fed5

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 ace87c9 commit cc1fed5

8 files changed

+28
-3
lines changed

api/v1beta1/awscluster_conversion.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ func (src *AWSCluster) ConvertTo(dstRaw conversion.Hub) error {
6767
dst.Status.Bastion.HostID = restored.Status.Bastion.HostID
6868
dst.Status.Bastion.CapacityReservationPreference = restored.Status.Bastion.CapacityReservationPreference
6969
dst.Status.Bastion.CPUOptions = restored.Status.Bastion.CPUOptions
70+
dst.Status.Bastion.IPv6Address = restored.Status.Bastion.IPv6Address
7071
}
7172
dst.Spec.Partition = restored.Spec.Partition
7273

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: 6 additions & 1 deletion
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
@@ -1368,6 +1368,9 @@ spec:
13681368
instanceState:
13691369
description: The current state of the instance.
13701370
type: string
1371+
ipv6Address:
1372+
description: The IPv6 address assigned to the instance.
1373+
type: string
13711374
marketType:
13721375
description: |-
13731376
MarketType specifies the type of market for the EC2 instance. Valid values include:
@@ -3644,6 +3647,9 @@ spec:
36443647
instanceState:
36453648
description: The current state of the instance.
36463649
type: string
3650+
ipv6Address:
3651+
description: The IPv6 address assigned to the instance.
3652+
type: string
36473653
marketType:
36483654
description: |-
36493655
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:
@@ -2345,6 +2349,9 @@ spec:
23452349
instanceState:
23462350
description: The current state of the instance.
23472351
type: string
2352+
ipv6Address:
2353+
description: The IPv6 address assigned to the instance.
2354+
type: string
23482355
marketType:
23492356
description: |-
23502357
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
@@ -933,6 +933,7 @@ func (s *Service) SDKToInstance(v types.Instance) (*infrav1.Instance, error) {
933933
ImageID: aws.ToString(v.ImageId),
934934
SSHKeyName: v.KeyName,
935935
PrivateIP: v.PrivateIpAddress,
936+
IPv6Address: v.Ipv6Address,
936937
PublicIP: v.PublicIpAddress,
937938
ENASupport: v.EnaSupport,
938939
EBSOptimized: v.EbsOptimized,

0 commit comments

Comments
 (0)