|
7 | 7 | "testing"
|
8 | 8 |
|
9 | 9 | . "github.com/onsi/gomega"
|
| 10 | + v1 "k8s.io/api/core/v1" |
10 | 11 | "k8s.io/apiserver/pkg/storage/names"
|
11 | 12 | capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
|
12 | 13 | runtimehooksv1 "sigs.k8s.io/cluster-api/exp/runtime/hooks/api/v1alpha1"
|
@@ -134,6 +135,90 @@ func TestGenerateNoProxy(t *testing.T) {
|
134 | 135 | "kubernetes.default", ".svc", ".svc.cluster.local",
|
135 | 136 | },
|
136 | 137 | },
|
| 138 | + { |
| 139 | + name: "Unknown infrastructure cluster", |
| 140 | + cluster: &capiv1.Cluster{ |
| 141 | + Spec: capiv1.ClusterSpec{ |
| 142 | + InfrastructureRef: &v1.ObjectReference{ |
| 143 | + Kind: "SomeFakeInfrastructureCluster", |
| 144 | + }, |
| 145 | + }, |
| 146 | + }, |
| 147 | + expectedNoProxy: []string{ |
| 148 | + "localhost", "127.0.0.1", "kubernetes", "kubernetes.default", |
| 149 | + ".svc", ".svc.cluster.local", |
| 150 | + }, |
| 151 | + }, |
| 152 | + { |
| 153 | + name: "AWS cluster", |
| 154 | + cluster: &capiv1.Cluster{ |
| 155 | + Spec: capiv1.ClusterSpec{ |
| 156 | + InfrastructureRef: &v1.ObjectReference{ |
| 157 | + Kind: "AWSCluster", |
| 158 | + }, |
| 159 | + }, |
| 160 | + }, |
| 161 | + expectedNoProxy: []string{ |
| 162 | + "localhost", "127.0.0.1", "kubernetes", "kubernetes.default", |
| 163 | + ".svc", ".svc.cluster.local", "169.254.169.254", ".elb.amazonaws.com", |
| 164 | + }, |
| 165 | + }, |
| 166 | + { |
| 167 | + name: "AWS managed (EKS) cluster", |
| 168 | + cluster: &capiv1.Cluster{ |
| 169 | + Spec: capiv1.ClusterSpec{ |
| 170 | + InfrastructureRef: &v1.ObjectReference{ |
| 171 | + Kind: "AWSManagedCluster", |
| 172 | + }, |
| 173 | + }, |
| 174 | + }, |
| 175 | + expectedNoProxy: []string{ |
| 176 | + "localhost", "127.0.0.1", "kubernetes", "kubernetes.default", |
| 177 | + ".svc", ".svc.cluster.local", "169.254.169.254", ".elb.amazonaws.com", |
| 178 | + }, |
| 179 | + }, |
| 180 | + { |
| 181 | + name: "Azure cluster", |
| 182 | + cluster: &capiv1.Cluster{ |
| 183 | + Spec: capiv1.ClusterSpec{ |
| 184 | + InfrastructureRef: &v1.ObjectReference{ |
| 185 | + Kind: "AzureCluster", |
| 186 | + }, |
| 187 | + }, |
| 188 | + }, |
| 189 | + expectedNoProxy: []string{ |
| 190 | + "localhost", "127.0.0.1", "kubernetes", "kubernetes.default", |
| 191 | + ".svc", ".svc.cluster.local", "169.254.169.254", |
| 192 | + }, |
| 193 | + }, |
| 194 | + { |
| 195 | + name: "Azure managed (AKS) cluster", |
| 196 | + cluster: &capiv1.Cluster{ |
| 197 | + Spec: capiv1.ClusterSpec{ |
| 198 | + InfrastructureRef: &v1.ObjectReference{ |
| 199 | + Kind: "AzureCluster", |
| 200 | + }, |
| 201 | + }, |
| 202 | + }, |
| 203 | + expectedNoProxy: []string{ |
| 204 | + "localhost", "127.0.0.1", "kubernetes", "kubernetes.default", |
| 205 | + ".svc", ".svc.cluster.local", "169.254.169.254", |
| 206 | + }, |
| 207 | + }, |
| 208 | + { |
| 209 | + name: "GCP cluster", |
| 210 | + cluster: &capiv1.Cluster{ |
| 211 | + Spec: capiv1.ClusterSpec{ |
| 212 | + InfrastructureRef: &v1.ObjectReference{ |
| 213 | + Kind: "GCPCluster", |
| 214 | + }, |
| 215 | + }, |
| 216 | + }, |
| 217 | + expectedNoProxy: []string{ |
| 218 | + "localhost", "127.0.0.1", "kubernetes", "kubernetes.default", |
| 219 | + ".svc", ".svc.cluster.local", "169.254.169.254", "metadata", "metadata.google.internal", |
| 220 | + }, |
| 221 | + }, |
137 | 222 | {
|
138 | 223 | name: "custom service network",
|
139 | 224 | cluster: &capiv1.Cluster{
|
|
0 commit comments