Skip to content

Allow VPA e2e tests to reference a custom namespace #8752

@maxcao13

Description

@maxcao13

Which component are you using?:
/area vertical-pod-autoscaler

Is your feature request designed to solve a problem? If so describe the problem this feature should solve.:
If deploying the VPA in a namespace that is not kube-system there some e2e tests fail because they expect that hardcoded namespace. This is fundamentally different from how the VPA is setup where it is possible to use custom namespaces for certain features.

For example, for the admission-controller status lease, the VPA currently defaults to AdmissionControllerStatusNamespace = metav1.NamespaceSystem, but if the VPA container itself detects it is deployed in a differente namespace, it will default to that instead:

admissionControllerStatusNamespace := status.AdmissionControllerStatusNamespace
if namespace != "" {
admissionControllerStatusNamespace = namespace
}

But the test just uses the kube-system namespace by default:

ginkgo.By("Setting up the Admission Controller status")
stopCh := make(chan struct{})
statusUpdater := status.NewUpdater(
f.ClientSet,
status.AdmissionControllerStatusName,
status.AdmissionControllerStatusNamespace,
statusUpdateInterval,
"e2e test",
)

Another example, is this e2e helper function here, which assumes the recommender is in the kube-system namespace:

namespace := "kube-system"

Describe the solution you'd like.:
Perhaps a custom go test flag or environment variable can be used to specify a namespace other than kube-system as overrides.

Smaller ask, but I also would like the common namespace reference in the e2e tests to be centralized. Right now there exists VpaNamespace variable in e2e/vi/common, RecommenderNamespace in e2e/utils/common.go which also references the kube-system as well. And other future and existing namespaces referencing the VPA namespace should be pointed to by this centrailized variable as well.

Describe any alternative solutions you've considered.:
You can also tell me off, if you believe this is overengineering :-)

This is simple to fix in our fork, but since the namespace overrides work in the actual code, I would think it would make sense for the e2es to cover this as well.

Metadata

Metadata

Assignees

Labels

area/vertical-pod-autoscalergood first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions