Skip to content

Commit

Permalink
Remove symlink to crd file in kubernetes e2e test data (#10388)
Browse files Browse the repository at this point in the history
Co-authored-by: Sam Heilbron <[email protected]>
  • Loading branch information
sheidkamp and sam-heilbron authored Nov 22, 2024
1 parent a36c350 commit 25aa232
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
6 changes: 6 additions & 0 deletions changelog/v1.18.0-rc2/remove-manifest-symlink.yaml
Original file line number Diff line number Diff line change
@@ -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.
18 changes: 18 additions & 0 deletions projects/gateway2/crds/crds.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

This file was deleted.

3 changes: 2 additions & 1 deletion test/kubernetes/e2e/features/services/httproute/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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{
Expand Down

0 comments on commit 25aa232

Please sign in to comment.