Skip to content

Commit 684b625

Browse files
committed
use frontproxy externalHostname in rootshard for frontproxy test
This is required because the external hostname inside a rootshard in an installation with a frontproxy should be the external hostname of the frontproxy On-behalf-of: SAP <[email protected]> Signed-off-by: Simon Bein <[email protected]>
1 parent 9d6aa02 commit 684b625

File tree

5 files changed

+10
-13
lines changed

5 files changed

+10
-13
lines changed

test/e2e/frontproxies/frontproxies_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ func TestCreateFrontProxy(t *testing.T) {
4646

4747
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)
4848

49+
externalHostname := "front-proxy-front-proxy.svc.cluster.local"
50+
4951
// deploy rootshard
50-
rootShard := utils.DeployRootShard(ctx, t, client, namespace)
52+
rootShard := utils.DeployRootShard(ctx, t, client, namespace, externalHostname)
5153

5254
// deploy front-proxy
53-
frontProxy := utils.DeployFrontProxy(ctx, t, client, namespace, rootShard.Name)
55+
frontProxy := utils.DeployFrontProxy(ctx, t, client, namespace, rootShard.Name, externalHostname)
5456

5557
// create front-proxy kubeconfig
5658
configSecretName := "kubeconfig-front-proxy-e2e"

test/e2e/rootshards/rootshards_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func TestCreateRootShard(t *testing.T) {
4242
namespace := "create-rootshard"
4343

4444
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)
45-
rootShard := utils.DeployRootShard(ctx, t, client, namespace)
45+
rootShard := utils.DeployRootShard(ctx, t, client, namespace, "example.localhost")
4646

4747
configSecretName := "kubeconfig"
4848

test/e2e/shards/shards_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestCreateShard(t *testing.T) {
4747
utils.CreateSelfDestructingNamespace(t, ctx, client, namespace)
4848

4949
// deploy a root shard incl. etcd
50-
rootShard := utils.DeployRootShard(ctx, t, client, namespace)
50+
rootShard := utils.DeployRootShard(ctx, t, client, namespace, "example.localhost")
5151

5252
// deploy a 2nd shard incl. etcd
5353
shardName := "aadvark"

test/utils/deploy.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func DeployShard(ctx context.Context, t *testing.T, client ctrlruntimeclient.Cli
106106
return shard
107107
}
108108

109-
func DeployRootShard(ctx context.Context, t *testing.T, client ctrlruntimeclient.Client, namespace string, patches ...func(*operatorv1alpha1.RootShard)) operatorv1alpha1.RootShard {
109+
func DeployRootShard(ctx context.Context, t *testing.T, client ctrlruntimeclient.Client, namespace string, externalHostname string, patches ...func(*operatorv1alpha1.RootShard)) operatorv1alpha1.RootShard {
110110
t.Helper()
111111

112112
etcd := DeployEtcd(t, "etcd-r00t", namespace)
@@ -117,7 +117,7 @@ func DeployRootShard(ctx context.Context, t *testing.T, client ctrlruntimeclient
117117

118118
rootShard.Spec = operatorv1alpha1.RootShardSpec{
119119
External: operatorv1alpha1.ExternalConfig{
120-
Hostname: "example.localhost",
120+
Hostname: externalHostname,
121121
Port: 6443,
122122
},
123123
Cache: operatorv1alpha1.CacheConfig{
@@ -156,7 +156,7 @@ func DeployRootShard(ctx context.Context, t *testing.T, client ctrlruntimeclient
156156
return rootShard
157157
}
158158

159-
func DeployFrontProxy(ctx context.Context, t *testing.T, client ctrlruntimeclient.Client, namespace string, rootShardName string, patches ...func(*operatorv1alpha1.FrontProxy)) operatorv1alpha1.FrontProxy {
159+
func DeployFrontProxy(ctx context.Context, t *testing.T, client ctrlruntimeclient.Client, namespace string, rootShardName string, externalHostname string, patches ...func(*operatorv1alpha1.FrontProxy)) operatorv1alpha1.FrontProxy {
160160
t.Helper()
161161

162162
frontProxy := operatorv1alpha1.FrontProxy{}
@@ -169,7 +169,7 @@ func DeployFrontProxy(ctx context.Context, t *testing.T, client ctrlruntimeclien
169169
Name: rootShardName,
170170
},
171171
},
172-
ExternalHostname: fmt.Sprintf("%s.%s.svc.cluster.local", frontProxy.Name, frontProxy.Namespace),
172+
ExternalHostname: externalHostname,
173173
Auth: &operatorv1alpha1.AuthSpec{
174174
// we need to remove the default system:masters group in order to do our testing
175175
DropGroups: []string{""},

test/utils/utils.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ func ConnectWithKubeconfig(
182182
parts := strings.Split(hostname, ".")
183183
serviceName := parts[0]
184184

185-
// for frontproxies add required suffix
186-
if config.Spec.Target.FrontProxyRef != nil {
187-
serviceName += "-front-proxy"
188-
}
189-
190185
portNum, err := strconv.ParseInt(portString, 10, 32)
191186
if err != nil {
192187
t.Fatalf("Failed to parse kubeconfig's port %q: %v", portString, err)

0 commit comments

Comments
 (0)