File tree Expand file tree Collapse file tree 2 files changed +5
-27
lines changed
controllers/providers/aws Expand file tree Collapse file tree 2 files changed +5
-27
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,6 @@ const (
6868 ARNPrefix = "arn:aws:"
6969 LaunchConfigurationNotFoundErrorMessage = "Launch configuration name not found"
7070 defaultPolicyArn = "arn:aws:iam::aws:policy/AmazonEKSFargatePodExecutionRolePolicy"
71-
72- MetadataMACAddressPath = "latest/meta-data/mac"
73- MetadataInterfaceCidrPathFmt = "latest/meta-data/network/interfaces/macs/%v/vpc-ipv4-cidr-blocks"
7471)
7572
7673var (
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ limitations under the License.
1616package aws
1717
1818import (
19- "fmt"
2019 "strings"
2120
2221 "github.com/aws/aws-sdk-go/aws"
@@ -215,28 +214,10 @@ func (w *AwsWorker) DescribeFargateProfile() (*eks.FargateProfile, error) {
215214}
216215
217216func (w * AwsWorker ) GetDNSClusterIP (cluster * eks.Cluster ) string {
218- if cluster != nil {
219- serviceCidr := aws .StringValue (cluster .KubernetesNetworkConfig .ServiceIpv4Cidr )
220- // addresses assigned from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks
221- return strings .ReplaceAll (serviceCidr , "0/16" , "10" )
222- } else {
223- // if cluster information is not available get instance's ipv4 cidr from metadata
224- macAddress , err := w .Ec2Metadata .GetMetadata (MetadataMACAddressPath )
225- if err != nil {
226- return ""
227- }
228-
229- cidrMetadataPath := fmt .Sprintf (MetadataInterfaceCidrPathFmt , macAddress )
230- ipv4Cidr , err := w .Ec2Metadata .GetMetadata (cidrMetadataPath )
231- if err != nil {
232- return ""
233- }
234-
235- // if instance ipv4 cidr starts with 10. service IP is 172.20.0.10, otherwise its 10.100.0.10
236- if strings .HasPrefix (ipv4Cidr , "10." ) {
237- return "172.20.0.10"
238- }
239-
240- return "10.100.0.10"
217+ if cluster == nil {
218+ return ""
241219 }
220+ serviceCidr := aws .StringValue (cluster .KubernetesNetworkConfig .ServiceIpv4Cidr )
221+ // addresses assigned from either the 10.100.0.0/16 or 172.20.0.0/16 CIDR blocks
222+ return strings .ReplaceAll (serviceCidr , "0/16" , "10" )
242223}
You can’t perform that action at this time.
0 commit comments