Skip to content

Commit 25aa232

Browse files
Remove symlink to crd file in kubernetes e2e test data (#10388)
Co-authored-by: Sam Heilbron <[email protected]>
1 parent a36c350 commit 25aa232

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
changelog:
2+
- type: NON_USER_FACING
3+
issueLink: https://github.com/solo-io/solo-projects/issues/7255
4+
resolvesIssue: false
5+
description: >-
6+
Remove `tcproute-crd.yaml` symlink and get the crd location from the crd package.

projects/gateway2/crds/crds.go

+18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,25 @@ package crds
22

33
import (
44
_ "embed"
5+
"path"
6+
"path/filepath"
7+
"runtime"
58
)
69

710
//go:embed gateway-crds.yaml
811
var GatewayCrds []byte
12+
13+
func getDirectory() string {
14+
_, filename, _, _ := runtime.Caller(0)
15+
return path.Dir(filename)
16+
}
17+
18+
// directory is the absolute path to the directory containing the crd files
19+
// It can't change at runtime, so we can cache it
20+
var directory = getDirectory()
21+
22+
// AbsPathToCrd returns the absolute path to directory in which crds are stored (currently the same directory as this file)
23+
// Used for tests to find the crd files if needed
24+
func AbsPathToCrd(crdFile string) string {
25+
return filepath.Join(directory, crdFile)
26+
}

test/kubernetes/e2e/features/services/httproute/testdata/tcproute-crd.yaml

-1
This file was deleted.

test/kubernetes/e2e/features/services/httproute/types.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/solo-io/skv2/codegen/util"
1010

1111
"github.com/onsi/gomega/gstruct"
12+
"github.com/solo-io/gloo/projects/gateway2/crds"
1213
appsv1 "k8s.io/api/apps/v1"
1314
corev1 "k8s.io/api/core/v1"
1415
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -17,7 +18,7 @@ import (
1718
var (
1819
routeWithServiceManifest = filepath.Join(util.MustGetThisDir(), "testdata", "route-with-service.yaml")
1920
serviceManifest = filepath.Join(util.MustGetThisDir(), "testdata", "service-for-route.yaml")
20-
tcpRouteCrdManifest = filepath.Join(util.MustGetThisDir(), "testdata", "tcproute-crd.yaml")
21+
tcpRouteCrdManifest = filepath.Join(crds.AbsPathToCrd("tcproute-crd.yaml"))
2122

2223
// Proxy resource to be translated
2324
glooProxyObjectMeta = metav1.ObjectMeta{

0 commit comments

Comments
 (0)