Skip to content

Commit f0f3382

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 f74c2a6 commit f0f3382

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

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
@@ -1338,6 +1338,9 @@ spec:
13381338
instanceState:
13391339
description: The current state of the instance.
13401340
type: string
1341+
ipv6Address:
1342+
description: The IPv6 address assigned to the instance.
1343+
type: string
13411344
marketType:
13421345
description: |-
13431346
MarketType specifies the type of market for the EC2 instance. Valid values include:
@@ -3562,6 +3565,9 @@ spec:
35623565
instanceState:
35633566
description: The current state of the instance.
35643567
type: string
3568+
ipv6Address:
3569+
description: The IPv6 address assigned to the instance.
3570+
type: string
35653571
marketType:
35663572
description: |-
35673573
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:
@@ -2320,6 +2324,9 @@ spec:
23202324
instanceState:
23212325
description: The current state of the instance.
23222326
type: string
2327+
ipv6Address:
2328+
description: The IPv6 address assigned to the instance.
2329+
type: string
23232330
marketType:
23242331
description: |-
23252332
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
@@ -926,6 +926,7 @@ func (s *Service) SDKToInstance(v types.Instance) (*infrav1.Instance, error) {
926926
ImageID: aws.ToString(v.ImageId),
927927
SSHKeyName: v.KeyName,
928928
PrivateIP: v.PrivateIpAddress,
929+
IPv6Address: v.Ipv6Address,
929930
PublicIP: v.PublicIpAddress,
930931
ENASupport: v.EnaSupport,
931932
EBSOptimized: v.EbsOptimized,

0 commit comments

Comments
 (0)