bootstrapper: add fallback endpoint and custom endpoint to SAN field (#2108)

terraform: collect apiserver cert SANs and support custom endpoint

constants: add new constants for cluster configuration and custom endpoint

cloud: support apiserver cert sans and prepare for endpoint migration on AWS

config: add customEndpoint field

bootstrapper: use per-CSP apiserver cert SANs

cli: route customEndpoint to terraform and add migration for apiserver cert SANs

bootstrapper: change interface of GetLoadBalancerEndpoint to return host and port separately
This commit is contained in:
Malte Poll 2023-07-21 16:43:51 +02:00 committed by GitHub
parent 3324a4eba2
commit 8da6a23aa5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 724 additions and 301 deletions

View file

@ -487,10 +487,10 @@ func TestGetLoadBalancerEndpoint(t *testing.T) {
}
testCases := map[string]struct {
imds *stubIMDSClient
api *stubServersClient
want string
wantErr bool
imds *stubIMDSClient
api *stubServersClient
wantHost string
wantErr bool
}{
"error returned from IMDS client": {
imds: &stubIMDSClient{uidErr: errors.New("failed")},
@ -613,7 +613,7 @@ func TestGetLoadBalancerEndpoint(t *testing.T) {
},
}, nil),
},
want: "198.51.100.0",
wantHost: "198.51.100.0",
},
"first valid endpoint returned from server addresses not in subnet CIDR": {
imds: &stubIMDSClient{},
@ -628,7 +628,7 @@ func TestGetLoadBalancerEndpoint(t *testing.T) {
},
}, nil),
},
want: "198.51.100.0",
wantHost: "198.51.100.0",
},
}
@ -641,13 +641,14 @@ func TestGetLoadBalancerEndpoint(t *testing.T) {
api: tc.api,
}
got, err := c.GetLoadBalancerEndpoint(context.Background())
gotHost, gotPort, err := c.GetLoadBalancerEndpoint(context.Background())
if tc.wantErr {
assert.Error(err)
} else {
assert.NoError(err)
assert.Equal(tc.want, got)
assert.Equal(tc.wantHost, gotHost)
assert.Equal("6443", gotPort)
}
})
}