@@ -690,6 +690,15 @@ func cloudPlatformAPIIntLoadBalancerIPs(cfg RenderConfig) (interface{}, error) {
690
690
default :
691
691
return nil , fmt .Errorf ("" )
692
692
}
693
+ case configv1 .AWSPlatformType :
694
+ switch cloudPlatformLoadBalancerIPState (cfg ) {
695
+ case availableLBIPState :
696
+ return cfg .Infra .Status .PlatformStatus .AWS .CloudLoadBalancerConfig .ClusterHosted .APIIntLoadBalancerIPs , nil
697
+ case absentLBIPState :
698
+ return nil , fmt .Errorf ("AWS API Server IPs unavailable when the DNSType is ClusterHosted" )
699
+ default :
700
+ return nil , fmt .Errorf ("" )
701
+ }
693
702
default :
694
703
return nil , fmt .Errorf ("invalid cloud platform for API Server Internal IPs" )
695
704
}
@@ -712,6 +721,15 @@ func cloudPlatformAPILoadBalancerIPs(cfg RenderConfig) (interface{}, error) {
712
721
default :
713
722
return nil , fmt .Errorf ("" )
714
723
}
724
+ case configv1 .AWSPlatformType :
725
+ switch cloudPlatformLoadBalancerIPState (cfg ) {
726
+ case availableLBIPState :
727
+ return cfg .Infra .Status .PlatformStatus .AWS .CloudLoadBalancerConfig .ClusterHosted .APILoadBalancerIPs , nil
728
+ case absentLBIPState :
729
+ return nil , fmt .Errorf ("AWS API Server IPs unavailable when the DNSType is ClusterHosted" )
730
+ default :
731
+ return nil , fmt .Errorf ("" )
732
+ }
715
733
default :
716
734
return nil , fmt .Errorf ("invalid cloud platform for API Server IPs" )
717
735
}
@@ -734,6 +752,15 @@ func cloudPlatformIngressLoadBalancerIPs(cfg RenderConfig) (interface{}, error)
734
752
default :
735
753
return nil , fmt .Errorf ("" )
736
754
}
755
+ case configv1 .AWSPlatformType :
756
+ switch cloudPlatformLoadBalancerIPState (cfg ) {
757
+ case availableLBIPState :
758
+ return cfg .Infra .Status .PlatformStatus .AWS .CloudLoadBalancerConfig .ClusterHosted .IngressLoadBalancerIPs , nil
759
+ case absentLBIPState :
760
+ return nil , fmt .Errorf ("AWS Ingress IPs unavailable when the DNSType is ClusterHosted" )
761
+ default :
762
+ return nil , fmt .Errorf ("" )
763
+ }
737
764
default :
738
765
return nil , fmt .Errorf ("invalid cloud platform for Ingress LoadBalancer IPs" )
739
766
}
@@ -747,7 +774,8 @@ func cloudPlatformIngressLoadBalancerIPs(cfg RenderConfig) (interface{}, error)
747
774
func cloudPlatformLoadBalancerIPState (cfg RenderConfig ) LoadBalancerIPState {
748
775
lbIPState := defaultLBIPState
749
776
if cfg .Infra .Status .PlatformStatus != nil {
750
- if cfg .Infra .Status .PlatformStatus .Type == configv1 .GCPPlatformType {
777
+ switch cfg .Infra .Status .PlatformStatus .Type {
778
+ case configv1 .GCPPlatformType :
751
779
// If DNSType is set to `ClusterHosted`, we expect the Load Balancer IP addresses to be set.
752
780
// If absent, that is exoected to be temporary.
753
781
if cfg .Infra .Status .PlatformStatus .GCP != nil && cfg .Infra .Status .PlatformStatus .GCP .CloudLoadBalancerConfig != nil && cfg .Infra .Status .PlatformStatus .GCP .CloudLoadBalancerConfig .DNSType == configv1 .ClusterHostedDNSType {
@@ -757,6 +785,16 @@ func cloudPlatformLoadBalancerIPState(cfg RenderConfig) LoadBalancerIPState {
757
785
lbIPState = absentLBIPState
758
786
}
759
787
}
788
+ case configv1 .AWSPlatformType :
789
+ // If DNSType is set to `ClusterHosted`, we expect the Load Balancer IP addresses to be set.
790
+ // If absent, that is exoected to be temporary.
791
+ if cfg .Infra .Status .PlatformStatus .AWS != nil && cfg .Infra .Status .PlatformStatus .AWS .CloudLoadBalancerConfig != nil && cfg .Infra .Status .PlatformStatus .AWS .CloudLoadBalancerConfig .DNSType == configv1 .ClusterHostedDNSType {
792
+ if cfg .Infra .Status .PlatformStatus .AWS .CloudLoadBalancerConfig .ClusterHosted != nil {
793
+ lbIPState = availableLBIPState
794
+ } else {
795
+ lbIPState = absentLBIPState
796
+ }
797
+ }
760
798
}
761
799
}
762
800
return lbIPState
0 commit comments