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

test: Add Support for Upstream E2E tests with default AWS Provider EC2NodeClass #7697

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ KARPENTER_CORE_DIR = $(shell go list -m -f '{{ .Dir }}' sigs.k8s.io/karpenter)

# TEST_SUITE enables you to select a specific test suite directory to run "make e2etests" against
TEST_SUITE ?= "..."
TMPFILE = $(shell mktemp)

# Filename when building the binary controller only
GOARCH ?= $(shell go env GOARCH)
Expand Down Expand Up @@ -88,6 +89,20 @@ e2etests: ## Run the e2e suite against your local cluster
--ginkgo.grace-period=3m \
--ginkgo.vv

upstream-e2etests:
CLUSTER_NAME=${CLUSTER_NAME} envsubst < $(shell pwd)/test/pkg/environment/aws/default_ec2nodeclass.yaml > ${TMPFILE}
go test \
-count 1 \
-timeout 1h \
-v \
$(KARPENTER_CORE_DIR)/test/suites/$(shell echo $(TEST_SUITE) | tr A-Z a-z)/... \
--ginkgo.focus="${FOCUS}" \
--ginkgo.timeout=1h \
--ginkgo.grace-period=5m \
--ginkgo.vv \
--default-nodeclass="$(TMPFILE)"\
--default-nodepool="$(shell pwd)/test/pkg/environment/aws/default_nodepool.yaml"

e2etests-deflake: ## Run the e2e suite against your local cluster
cd test && CLUSTER_NAME=${CLUSTER_NAME} ginkgo \
--focus="${FOCUS}" \
Expand Down
15 changes: 15 additions & 0 deletions test/pkg/environment/aws/default_ec2nodeclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: karpenter.k8s.aws/v1
kind: EC2NodeClass
metadata:
name: default
spec:
amiFamily: AL2023
subnetSelectorTerms:
- tags:
karpenter.sh/discovery: $CLUSTER_NAME
securityGroupSelectorTerms:
- tags:
karpenter.sh/discovery: $CLUSTER_NAME
role: KarpenterNodeRole-$CLUSTER_NAME
amiSelectorTerms:
- alias: al2023@latest
36 changes: 36 additions & 0 deletions test/pkg/environment/aws/default_nodepool.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: karpenter.sh/v1
kind: NodePool
metadata:
name: default
spec:
disruption:
consolidationPolicy: WhenEmptyOrUnderutilized
consolidateAfter: Never
budgets:
- nodes: 100%
limits:
cpu: 1000
memory: 1000Gi
template:
spec:
expireAfter: Never
requirements:
- key: kubernetes.io/os
operator: In
values: ["linux"]
- key: karpenter.sh/capacity-type
operator: In
values: ["on-demand"]
- key: karpenter.k8s.aws/instance-category
operator: In
values: ["c", "m", "r"]
- key: karpenter.k8s.aws/instance-generation
operator: In
values: ["2"]
- key: karpenter.k8s.aws/instance-family
operator: NotIn
values: ["a1"]
nodeClassRef:
group: karpenter.k8s.aws
kind: EKSNodeClass
name: default
Loading