Skip to content

Commit

Permalink
create kubernetes endpoint in fake cluster.
Browse files Browse the repository at this point in the history
  • Loading branch information
lionelvillard committed Feb 8, 2023
1 parent fc683ba commit 1e47c2b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/e2e/framework/kcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
"github.com/spf13/pflag"
"github.com/stretchr/testify/require"

corev1 "k8s.io/api/core/v1"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -916,6 +917,23 @@ func NewFakeWorkloadServer(t *testing.T, server RunningServer, org logicalcluste
return true
}, wait.ForeverTestTimeout, time.Millisecond*100)

// Install the kubernetes endpoint in the default namespace. The DNS network policies reference this endpoint.
require.Eventually(t, func() bool {
_, err = kubeClient.CoreV1().Endpoints("default").Create(ctx, &corev1.Endpoints{
ObjectMeta: metav1.ObjectMeta{
Name: "kubernetes",
},
Subsets: []corev1.EndpointSubset{{
Addresses: []corev1.EndpointAddress{{IP: "172.19.0.2:6443"}},
}},
}, metav1.CreateOptions{})
if err != nil {
t.Logf("failed to create the kubernetes endpoint: %v", err)
return false
}
return true
}, wait.ForeverTestTimeout, time.Millisecond*100)

return fakeServer
}

Expand Down

0 comments on commit 1e47c2b

Please sign in to comment.