Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove kube2e dep from test/kubernetes/e2e #10587

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

jenshu
Copy link
Contributor

@jenshu jenshu commented Feb 6, 2025

Some more testing-related cleanup - removed test/kubernetes/e2e's dependence on test/kube2e helpers (that way when we re-enable the tests under test/kubernetes/e2e we don't need to also re-enable the kube2e ones to get it to compile). See comments for details.

@@ -46,6 +46,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
Selector labels
*/}}
{{- define "kgateway.selectorLabels" -}}
kgateway: kgateway
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this because test/helpers/kube_dump.go looks for pods with label gloo=gloo and we didn't yet have a standard/hardcoded label that's added to all the kgateway pods (kgateway.name can be overridden)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather see us adopt the common labels instead of mirroring the existing pattern. We can address this in a follow-up as long as it's tracked though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using common labels but they don't currently have hardcoded values that can be queried for the log dump. maybe we should change app.kubernetes.io/name to kgateway? i can add a tracking item somewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added #10591 as a sub-task of #10441

@@ -7,7 +7,7 @@ import (
. "github.com/onsi/gomega"
"github.com/solo-io/go-utils/threadsafe"

"github.com/kgateway-dev/kgateway/pkg/utils/glooadminutils/admincli"
"github.com/kgateway-dev/kgateway/pkg/utils/controllerutils/admincli"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed pkg to remove the gloo ref

@@ -23,9 +23,6 @@ const (
// test framework does not need to install/uninstall Istio.
SkipIstioInstall = "SKIP_ISTIO_INSTALL"

// KubeTestType is used to indicate which kube2e suite should be run while executing regression tests
KubeTestType = "KUBE2E_TESTS"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

@@ -80,21 +79,6 @@ var (
DefaultCurlPollingTimeout = time.Second * 2 // DefaultCurlPollingTimeout is the default pollinginterval for "Eventually" curl assertions
)

var getTimeoutsAsInterfaces = helpers.GetDefaultTimingsTransform(DefaultCurlTimeout, DefaultCurlPollingTimeout)

func GetTimeouts(timeout ...time.Duration) (currentTimeout, pollingInterval time.Duration) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved these out into test/helpers/timeouts.go

@@ -58,87 +56,3 @@ func PercentileIndex(length, pct int) int {

return int(math.Ceil(float64(length)*(float64(pct)/float64(100)))) - 1
}

// GetDefaultEventuallyTimeoutsTransform returns timeout and polling interval values to use with a gomega eventually call
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved these into test/helpers/timeouts.go to have all the timeout-related stuff in one file

@@ -0,0 +1,115 @@
//go:build ignore

package helpers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

helper functions moved from the other 2 files

@@ -412,20 +395,14 @@ func EnvoyDumpOnFail(ctx context.Context, kubectlCli *kubectl.Cli, _ io.Writer,
for _, ns := range namespaces {
proxies := []string{}

// TODO need to get the right label, and pass in the Gateway namespaces
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can address this in a follow-up; need a way to select all the proxy pods

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we planning on adding a line item to that e2e epic you linked?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, created #10592

defer f.Close()
kubeCli := &install.CmdKubectl{}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CmdKubectl had already been deleted in a previous cleanup (and it had been deprecated), so changed this to use kubectl.Cli

@@ -1,56 +0,0 @@
//go:build ignore

package helpers
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used anywhere


## Performance tests

Our tests include some performance tests which variably guard against regressions in performance or validate decisions made to choose one algorithm over others.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe these tests were deleted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under the impression we disabled the suite but didn't delete the suite. At least, that's what

# performance_tests_main:
# name: main performance tests
# if: ${{ (github.event_name == 'workflow_dispatch' && inputs.run-performance && inputs.branch == 'main') || github.event.schedule == '0 5 * * *' }}
# runs-on: ubuntu-22.04
# timeout-minutes: 60
# steps:
# - uses: actions/checkout@v4
# with:
# ref: main
# - uses: ./.github/actions/prep-go-runner
# - uses: ./.github/actions/performance-tests
was implying.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i couldn't find any tests labeled with performance / Performance or any calls to the Measure functions mentioned in the readme (although i could have missed it, can you double check?)

controllerLogsFile := fileAtPath(filepath.Join(outDir, fmt.Sprintf("%s.controller.log", podName)))
controllerLogsCmd := kubectlCli.WithReceiver(controllerLogsFile).Command(ctx,
"-n", ns, "logs", podName, "-c", "gloo", "--tail=1000")
"-n", ns, "logs", podName, "-c", "kgateway", "--tail=1000")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's the GlooDeploymentName constant we can leverage here as well instead of hardcoding the pod/deployment name and risking drift over time. I don't remember why I held off on renaming that constant when I last touched that file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, 522130a added a const for the container name, but i can do another cleanup pass with the naming in the next PR

Comment on lines -30 to +29
// StandardGlooDumpOnFail creates adump of the kubernetes state and certain envoy data from
// StandardKgatewayDumpOnFail creates a dump of the kubernetes state and certain envoy data from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I'm less familiar with this test code -- I think my preference is to rip out the project name/branding from the function entirely unless there's any conflicts with existing util function names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a few other functions in here - KubeDumpOnFail, ControllerDumpOnFail, EnvoyDumpOnFail and StandardKgatewayDumpOnFail calls all of them. I don't see anything outside of this file calling these other 3 functions, so what about:

  • renaming StandardKgatewayDumpOnFail to StandardDumpOnFail?
  • making KubeDumpOnFail, ControllerDumpOnFail, EnvoyDumpOnFail non-exported

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fun. Nothing mission critical here -- let's revisit this if we have time once we're closer to the finish line for this stream of work.

@@ -65,7 +64,7 @@ func KubeDumpOnFail(ctx context.Context, kubectlCli *kubectl.Cli, outLog io.Writ

recordDockerState(fileAtPath(filepath.Join(outDir, "docker-state.log")))
recordProcessState(fileAtPath(filepath.Join(outDir, "process-state.log")))
recordKubeState(fileAtPath(filepath.Join(outDir, "kube-state.log")))
recordKubeState(ctx, kubectlCli, fileAtPath(filepath.Join(outDir, "kube-state.log")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up that line 59/60 has solo.io reference, but that's an existing problem with this code and we can fix that in #10584.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, we can do a sweep of everything when we pick up that cleanup task you linked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants