Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/util/proxyconfig/no_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func mergeUserSystemNoProxy(proxy *configv1.Proxy, infra *configv1.Infrastructur
} else {
set.Insert(fmt.Sprintf(".%s.compute.internal", region))
}
// Add AWS Route 53 resolver IP needs to be added to the no_proxy list for ClusterHostedDNS.
// Good to have it even during regular installs.
// https://docs.aws.amazon.com/vpc/latest/userguide/AmazonDNS-concepts.html
set.Insert("169.254.169.253")
case configv1.AzurePlatformType:
if cloudName := infra.Status.PlatformStatus.Azure.CloudName; cloudName != configv1.AzurePublicCloud {
// https://learn.microsoft.com/en-us/azure/virtual-network/what-is-ip-address-168-63-129-16
Expand Down
56 changes: 47 additions & 9 deletions pkg/util/proxyconfig/no_proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,33 @@ func infraConfig(platform configv1.PlatformType, domain, region string) *configv
}
}

func infraConfigWithClusterHostedDNS(platform configv1.PlatformType, domain, region string) *configv1.Infrastructure {
platformStatus := &configv1.PlatformStatus{}
switch platform {
case configv1.AWSPlatformType:
platformStatus = &configv1.PlatformStatus{
Type: configv1.AWSPlatformType,
AWS: &configv1.AWSPlatformStatus{
Region: region,
CloudLoadBalancerConfig: &configv1.CloudLoadBalancerConfig{
DNSType: configv1.ClusterHostedDNSType,
},
},
}
}
return &configv1.Infrastructure{
ObjectMeta: metav1.ObjectMeta{
Name: "test-infra",
},
Status: configv1.InfrastructureStatus{
APIServerURL: "https://api." + domain + ":6443",
APIServerInternalURL: "https://api-int." + domain + ":6443",
PlatformStatus: platformStatus,
EtcdDiscoveryDomain: domain,
},
}
}

func netConfig(cluster string, svcNet []string) *configv1.Network {
clusterNet := configv1.ClusterNetworkEntry{CIDR: cluster}
return &configv1.Network{
Expand Down Expand Up @@ -130,7 +157,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with gcp provider",
Expand All @@ -152,7 +179,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.ec2.internal,.svc,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with single user noProxy",
Expand All @@ -163,7 +190,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,172.30.0.1,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,172.30.0.1,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with single user noProxy dual stack",
Expand All @@ -174,7 +201,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,172.30.0.1,2001:db8::/32,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,172.30.0.1,2001:db8::/32,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with multiple user noProxy",
Expand All @@ -185,7 +212,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.foo.test.com,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,172.30.0.1,199.161.0.0/16,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,172.30.0.1,199.161.0.0/16,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with multiple user noProxy dual stack",
Expand All @@ -196,7 +223,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.foo.test.com,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,172.30.0.1,199.161.0.0/16,2001:db8::/32,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,172.30.0.1,199.161.0.0/16,2001:db8::/32,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "invalid api server url",
Expand Down Expand Up @@ -262,7 +289,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
getEnv: func(v string) string { return strconv.FormatBool(v == "PROXY_INTERNAL_APISERVER_ADDRESS") },
},
want: ".cluster.local,.foo.test.com,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,172.30.0.1,199.161.0.0/16,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,172.30.0.1,199.161.0.0/16,localhost",
wantErr: false,
},
{name: "valid proxy config with install config has default Machine CIDR",
Expand All @@ -273,7 +300,7 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapDataWithDefaultMachineCIDR),
},
want: ".cluster.local,.svc,.us-west-2.compute.internal,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with install config has default Machine Network CIDR",
Expand All @@ -284,7 +311,18 @@ func TestMergeUserSystemNoProxy(t *testing.T) {
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapDataWithDefaultMachineNetworkCIDR),
},
want: ".cluster.local,.svc,.us-west-2.compute.internal,10.128.0.0/14,127.0.0.1," +
"169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
"169.254.169.253,169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
wantErr: false,
},
{name: "valid proxy config with aws provider with ClusterHostedDNS",
args: args{
proxy: proxyConfig(),
infra: infraConfigWithClusterHostedDNS(configv1.AWSPlatformType, "test.cluster.com", "us-west-2"),
network: netConfig("10.128.0.0/14", []string{"172.30.0.0/16"}),
cluster: cfgMapWithInstallConfig(cfgMapKey, cfgMapData),
},
want: ".cluster.local,.svc,.us-west-2.compute.internal,10.0.0.0/16,10.128.0.0/14,127.0.0.1," +
"169.254.169.253,169.254.169.254,172.30.0.0/16,api-int.test.cluster.com,localhost",
wantErr: false,
},
}
Expand Down