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

update e2e helm install #10632

Merged
merged 25 commits into from
Feb 17, 2025
Merged

update e2e helm install #10632

merged 25 commits into from
Feb 17, 2025

Conversation

jenshu
Copy link
Contributor

@jenshu jenshu commented Feb 14, 2025

Simplify the install API used by e2e tests by removing the SoloTestHelper, removing fields that are hardcoded (e.g. test assets directory, index filename) or that can be derived (e.g. local chart uri), and calling the helm cli for install/uninstall.

Also removed the build ignore directives from all the files used by the base e2e test installation, to ensure they compile.
Enabling feature tests will be done in follow-up PRs.

other parts of this PR were previously broken out:

Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
Signed-off-by: Jenny Shu <[email protected]>
@jenshu jenshu marked this pull request as ready for review February 17, 2025 01:10
Signed-off-by: Jenny Shu <[email protected]>
@jenshu jenshu changed the title [WIP] update e2e helm install update e2e helm install Feb 17, 2025
// InstallOpts is a set of typical options for a helm install which can be passed in
// instead of requiring the caller to remember the helm cli flags. extraArgs should
// always be accepted and respected when using InstallOpts.
type InstallOpts struct {
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 to install.go

Comment on lines -155 to -161
func (c *Client) AddGlooRepository(ctx context.Context, extraArgs ...string) error {
return c.AddRepository(ctx, ChartName, ChartRepositoryUrl, extraArgs...)
}

func (c *Client) AddPrGlooRepository(ctx context.Context, extraArgs ...string) error {
return c.AddRepository(ctx, ChartName, PrChartRepositoryUrl, extraArgs...)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no longer needed, we now use an oci registry which doesn't require helm repo add

Comment on lines -28 to -34
TestAssetDir string

// Helm chart name
HelmChartName string

// Name of the helm index file name
HelmRepoIndexFileName string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these were always hardcoded; removed

)

// Default test configuration
var defaults = TestConfig{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

glooctl stuff, not needed

// Function to provide/override test configuration. Default values will be passed in.
type TestConfigFunc func(defaults TestConfig) TestConfig

type TestConfig struct {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed TestConfig and SoloTestHelper in favor of just passing in the options directly via the helm client InstallOptions in pkg/utils/helmutils/install.go

// there's an issue pulling the certgen docker image.
// Without this timeout, it would just hang indefinitely.
func glooctlInstallWithTimeout(rootDir string, opts *Options, timeout time.Duration) error {
return runWithTimeout(rootDir, opts, timeout, "install")
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 think it's unlikely we'll run into timeout issues since we don't have jobs running as part of the helm install now, but we can always add this back later if needed

Comment on lines -37 to -43
ReleasedVersion string

// The version of the Helm chart. Calculated from either the chart or the released version. It will not have a leading 'v'
ChartVersion string

// The path to the local helm chart used for testing. Based on the TestAssertDir and relative to RootDir.
ChartUri string
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instead of storing them on the Context (where they were never used), we just pass these in via the helm client InstallOptions

kubeGatewaySuiteRunner.Register("DirectResponse", directresponse.NewTestingSuite)
kubeGatewaySuiteRunner.Register("CRDCategories", crd_categories.NewTestingSuite)
kubeGatewaySuiteRunner.Register("Metrics", metrics.NewTestingSuite)
// kubeGatewaySuiteRunner.Register("Deployer", deployer.NewTestingSuite)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

commented out the feature tests just to get the main SuiteRunner compiling.
the feature tests will be re-enabled individually

helper.WithExtraArgs("--values", i.Metadata.ProfileValuesManifestFile),
helper.WithExtraArgs("--values", i.Metadata.ValuesManifestFile),
)
func (i *TestInstallation) InstallKgatewayFromLocalChart(ctx context.Context) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this replaces the previous TestHelper stuff. it simply gets the local chart path and calls the helm cli install func

Copy link
Member

Choose a reason for hiding this comment

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

nit: s/InstallKgatewayFromLocalChart/InstallFromLocalChart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm I kind of like having the 'kgateway' in the name because there could be other things we install/uninstall during the tests (e.g. istio)

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 the chart name is implicit based on the "FromLocalChart" naming as we don't have multiple local charts (well I guess maybe the deployer chart counts here too).

We could also have an Install method that acts as a driver / hook for other suites to DI the dependencies that need to be installed (e.g. helm charts, binaries like istioctl, etc.). In this case, this method would take a variadic parameter and delegate to sub-install functions that match the expected function signature s.t. call sites can configure which hooks are needed.

@timflannagan
Copy link
Member

Supports #10480.

Copy link
Member

@timflannagan timflannagan left a comment

Choose a reason for hiding this comment

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

Had a couple of questions, comments, etc. but nothing that isn't immediately blocking as long as we're tracking everything in the #10480 epic properly.

Just want to wrap my head around the order of operations here. You added some context that this PR is foundational and that enabling individual feature suites will be done as a follow-up. Are we planning on enabling this suite in our GHA workflows then?

@@ -18,6 +18,7 @@ require (
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.6.0
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/hashicorp/go-multierror v1.1.1
Copy link
Member

Choose a reason for hiding this comment

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

We should rip this dependency out in favor of other methods for aggregating errors together (e.g. utilerrors.NewAggregate or the stlib errors.Join). This can be done in a follow-up since we're removing the build ignore flag and these are issues with the existing code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

filed #10643

Copy link
Member

Choose a reason for hiding this comment

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

Should we move this to internal? Any reason we'd need this to live in pkg/ right now?

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 using this helmutils package anywhere outside of the test/ directory? I'm wondering whether we should move it there instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was previously outside the test pkg because our CLI used this pkg. now that we don't have a CLI we could move it back into a test pkg but not sure what the plans are for adding back a CLI or if it will live in this repo

Copy link
Member

Choose a reason for hiding this comment

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

yep sgtm. let's get the main structure in place first and then revisit -- the priority is getting feedback on our extension APIs for PRs.

helper.WithExtraArgs("--values", i.Metadata.ProfileValuesManifestFile),
helper.WithExtraArgs("--values", i.Metadata.ValuesManifestFile),
)
func (i *TestInstallation) InstallKgatewayFromLocalChart(ctx context.Context) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/InstallKgatewayFromLocalChart/InstallFromLocalChart?

@@ -36,7 +35,7 @@ type SimpleTestCase struct {
// Resources expected to be created by manifest
Resources []client.Object
// values file passed during an upgrade
UpgradeValues string
// UpgradeValues string
Copy link
Member

Choose a reason for hiding this comment

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

nit: Add TODO comment like we did with the other uncommented function/code blocks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mind if i handle that in the next PR so this one doesn't have to re-run CI again?

Comment on lines -26 to -33
// Deprecated; if this is needed create a resource yaml for it.
func GetHttpEchoImage() string {
httpEchoImage := "hashicorp/http-echo"
if runtime.GOARCH == "arm64" {
httpEchoImage = "gcr.io/solo-test-236622/http-echo:0.2.4"
}
return httpEchoImage
}
Copy link
Member

Choose a reason for hiding this comment

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

Just curious -- was this dead code from before, or dead code as a result of ripping out some code with these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like it was dead code even in the gloo repo


func (i *TestInstallation) UninstallGlooGateway(ctx context.Context, uninstallFn func(ctx context.Context) error) {
func (i *TestInstallation) UninstallKgateway(ctx context.Context) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Same comment as above. I think we can improve this name in addition to how the general install, upgrade, uninstall flow methods are implemented, but that can be done organically over time & a problem with the existing code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see my response from above

@jenshu jenshu added this pull request to the merge queue Feb 17, 2025
Merged via the queue into kgateway-dev:main with commit 3ef5a55 Feb 17, 2025
9 checks passed
@jenshu jenshu deleted the compile-e2e-1 branch February 17, 2025 19:42
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