diff --git a/changelog/v1.18.0-rc2/remove-manifest-symlink.yaml b/changelog/v1.18.0-rc2/remove-manifest-symlink.yaml new file mode 100644 index 00000000000..2f6a2e9812f --- /dev/null +++ b/changelog/v1.18.0-rc2/remove-manifest-symlink.yaml @@ -0,0 +1,6 @@ +changelog: + - type: NON_USER_FACING + issueLink: https://github.com/solo-io/solo-projects/issues/7255 + resolvesIssue: false + description: >- + Remove `tcproute-crd.yaml` symlink and get the crd location from the crd package. diff --git a/projects/gateway2/crds/crds.go b/projects/gateway2/crds/crds.go index d2541cee21b..6af5799654c 100644 --- a/projects/gateway2/crds/crds.go +++ b/projects/gateway2/crds/crds.go @@ -2,7 +2,25 @@ package crds import ( _ "embed" + "path" + "path/filepath" + "runtime" ) //go:embed gateway-crds.yaml var GatewayCrds []byte + +func getDirectory() string { + _, filename, _, _ := runtime.Caller(0) + return path.Dir(filename) +} + +// directory is the absolute path to the directory containing the crd files +// It can't change at runtime, so we can cache it +var directory = getDirectory() + +// AbsPathToCrd returns the absolute path to directory in which crds are stored (currently the same directory as this file) +// Used for tests to find the crd files if needed +func AbsPathToCrd(crdFile string) string { + return filepath.Join(directory, crdFile) +} diff --git a/test/kubernetes/e2e/features/services/httproute/testdata/tcproute-crd.yaml b/test/kubernetes/e2e/features/services/httproute/testdata/tcproute-crd.yaml deleted file mode 120000 index abdc43cdcc5..00000000000 --- a/test/kubernetes/e2e/features/services/httproute/testdata/tcproute-crd.yaml +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../projects/gateway2/crds/tcproute-crd.yaml \ No newline at end of file diff --git a/test/kubernetes/e2e/features/services/httproute/types.go b/test/kubernetes/e2e/features/services/httproute/types.go index bf431a974f5..4ae4a30ef94 100644 --- a/test/kubernetes/e2e/features/services/httproute/types.go +++ b/test/kubernetes/e2e/features/services/httproute/types.go @@ -9,6 +9,7 @@ import ( "github.com/solo-io/skv2/codegen/util" "github.com/onsi/gomega/gstruct" + "github.com/solo-io/gloo/projects/gateway2/crds" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -17,7 +18,7 @@ import ( var ( routeWithServiceManifest = filepath.Join(util.MustGetThisDir(), "testdata", "route-with-service.yaml") serviceManifest = filepath.Join(util.MustGetThisDir(), "testdata", "service-for-route.yaml") - tcpRouteCrdManifest = filepath.Join(util.MustGetThisDir(), "testdata", "tcproute-crd.yaml") + tcpRouteCrdManifest = filepath.Join(crds.AbsPathToCrd("tcproute-crd.yaml")) // Proxy resource to be translated glooProxyObjectMeta = metav1.ObjectMeta{