@@ -46,6 +46,8 @@ const (
4646 ZoneTypeAvailabilityZone ZoneType = "availability-zone"
4747 // ZoneTypeLocalZone defines the AWS zone type in Local Zone infrastructure.
4848 ZoneTypeLocalZone ZoneType = "local-zone"
49+ // ZoneTypeWavelengthZone defines the AWS zone type in Wavelength infrastructure.
50+ ZoneTypeWavelengthZone ZoneType = "wavelength-zone"
4951)
5052
5153// NetworkStatus encapsulates AWS networking resources.
@@ -409,6 +411,12 @@ type VPCSpec struct {
409411 // +optional
410412 InternetGatewayID * string `json:"internetGatewayId,omitempty"`
411413
414+ // CarrierGatewayID is the id of the internet gateway associated with the VPC,
415+ // for carrier network (Wavelength Zones).
416+ // +optional
417+ // +kubebuilder:validation:XValidation:rule="self.startsWith('cagw-')",message="Carrier Gateway ID must start with 'cagw-'"
418+ CarrierGatewayID * string `json:"carrierGatewayId,omitempty"`
419+
412420 // Tags is a collection of tags describing the resource.
413421 Tags Tags `json:"tags,omitempty"`
414422
@@ -521,33 +529,36 @@ type SubnetSpec struct {
521529
522530 // ZoneType defines the type of the zone where the subnet is created.
523531 //
524- // The valid values are availability-zone, and local -zone.
532+ // The valid values are availability-zone, local-zone, and wavelength -zone.
525533 //
526534 // Subnet with zone type availability-zone (regular) is always selected to create cluster
527535 // resources, like Load Balancers, NAT Gateways, Contol Plane nodes, etc.
528536 //
529- // Subnet with zone type local-zone is not eligible to automatically create
537+ // Subnet with zone type local-zone or wavelength-zone is not eligible to automatically create
530538 // regular cluster resources.
531539 //
532540 // The public subnet in availability-zone or local-zone is associated with regular public
533541 // route table with default route entry to a Internet Gateway.
534542 //
543+ // The public subnet in wavelength-zone is associated with a carrier public
544+ // route table with default route entry to a Carrier Gateway.
545+ //
535546 // The private subnet in the availability-zone is associated with a private route table with
536547 // the default route entry to a NAT Gateway created in that zone.
537548 //
538- // The private subnet in the local-zone is associated with a private route table with
549+ // The private subnet in the local-zone or wavelength-zone is associated with a private route table with
539550 // the default route entry re-using the NAT Gateway in the Region (preferred from the
540551 // parent zone, the zone type availability-zone in the region, or first table available).
541552 //
542- // +kubebuilder:validation:Enum=availability-zone;local-zone
553+ // +kubebuilder:validation:Enum=availability-zone;local-zone;wavelength-zone
543554 // +optional
544555 ZoneType * ZoneType `json:"zoneType,omitempty"`
545556
546557 // ParentZoneName is the zone name where the current subnet's zone is tied when
547558 // the zone is a Local Zone.
548559 //
549- // The subnets in Local Zone locations consume the ParentZoneName to determine the correct
550- // private route table to egress traffic to the internet.
560+ // The subnets in Local Zone or Wavelength Zone locations consume the ParentZoneName
561+ // to select the correct private route table to egress traffic to the internet.
551562 //
552563 // +optional
553564 ParentZoneName * string `json:"parentZoneName,omitempty"`
@@ -570,7 +581,27 @@ func (s *SubnetSpec) String() string {
570581// IsEdge returns the true when the subnet is created in the edge zone,
571582// Local Zones.
572583func (s * SubnetSpec ) IsEdge () bool {
573- return s .ZoneType != nil && * s .ZoneType == ZoneTypeLocalZone
584+ if s .ZoneType == nil {
585+ return false
586+ }
587+ if s .ZoneType .Equal (ZoneTypeLocalZone ) {
588+ return true
589+ }
590+ if s .ZoneType .Equal (ZoneTypeWavelengthZone ) {
591+ return true
592+ }
593+ return false
594+ }
595+
596+ // IsEdgeWavelength returns true only when the subnet is created in Wavelength Zone.
597+ func (s * SubnetSpec ) IsEdgeWavelength () bool {
598+ if s .ZoneType == nil {
599+ return false
600+ }
601+ if * s .ZoneType == ZoneTypeWavelengthZone {
602+ return true
603+ }
604+ return false
574605}
575606
576607// SetZoneInfo updates the subnets with zone information.
@@ -681,7 +712,7 @@ func (s Subnets) FilterPrivate() (res Subnets) {
681712 res = append (res , x )
682713 }
683714 }
684- return res
715+ return
685716}
686717
687718// FilterPublic returns a slice containing all subnets marked as public.
@@ -695,7 +726,7 @@ func (s Subnets) FilterPublic() (res Subnets) {
695726 res = append (res , x )
696727 }
697728 }
698- return res
729+ return
699730}
700731
701732// FilterByZone returns a slice containing all subnets that live in the availability zone specified.
@@ -705,7 +736,7 @@ func (s Subnets) FilterByZone(zone string) (res Subnets) {
705736 res = append (res , x )
706737 }
707738 }
708- return res
739+ return
709740}
710741
711742// GetUniqueZones returns a slice containing the unique zones of the subnets.
@@ -731,6 +762,19 @@ func (s Subnets) SetZoneInfo(zones []*ec2.AvailabilityZone) error {
731762 return nil
732763}
733764
765+ // HasPublicSubnetWavelength returns true when there are subnets in Wavelength zone.
766+ func (s Subnets ) HasPublicSubnetWavelength () bool {
767+ for _ , sub := range s {
768+ if sub .ZoneType == nil {
769+ return false
770+ }
771+ if sub .IsPublic && * sub .ZoneType == ZoneTypeWavelengthZone {
772+ return true
773+ }
774+ }
775+ return false
776+ }
777+
734778// CNISpec defines configuration for CNI.
735779type CNISpec struct {
736780 // CNIIngressRules specify rules to apply to control plane and worker node security groups.
@@ -953,3 +997,8 @@ type ZoneType string
953997func (z ZoneType ) String () string {
954998 return string (z )
955999}
1000+
1001+ // Equal compares two zone types.
1002+ func (z ZoneType ) Equal (other ZoneType ) bool {
1003+ return z == other
1004+ }
0 commit comments