Skip to content

Commit

Permalink
ci: fix flaky test for stale instance type drift (kubernetes-sigs#1990)
Browse files Browse the repository at this point in the history
Signed-off-by: flavono123 <[email protected]>
  • Loading branch information
flavono123 authored Feb 16, 2025
1 parent 9fe41b8 commit 2b05d96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ uninstall-kwok: ## Uninstall kwok provider
build-with-kind: # build with kind assumes the image will be uploaded directly onto the kind control plane, without an image repository
$(eval CONTROLLER_IMG=$(shell $(WITH_GOFLAGS) KO_DOCKER_REPO="$(KWOK_REPO)" ko build sigs.k8s.io/karpenter/kwok))
$(eval IMG_REPOSITORY=$(shell echo $(CONTROLLER_IMG) | cut -d ":" -f 1))
$(eval IMG_TAG=latest)
$(eval IMG_TAG=latest)

build: ## Build the Karpenter KWOK controller images using ko build
$(eval CONTROLLER_IMG=$(shell $(WITH_GOFLAGS) KO_DOCKER_REPO="$(KWOK_REPO)" ko build -B sigs.k8s.io/karpenter/kwok))
$(eval IMG_REPOSITORY=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 1 | cut -d ":" -f 1))
$(eval IMG_TAG=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 1 | cut -d ":" -f 2 -s))
$(eval IMG_DIGEST=$(shell echo $(CONTROLLER_IMG) | cut -d "@" -f 2))

apply-with-kind: verify build-with-kind ## Deploy the kwok controller from the current state of your git repository into your ~/.kube/config cluster
kubectl apply -f kwok/charts/crds
helm upgrade --install karpenter kwok/charts --namespace $(KARPENTER_NAMESPACE) --skip-crds \
Expand All @@ -38,7 +38,7 @@ apply-with-kind: verify build-with-kind ## Deploy the kwok controller from the c
--set controller.image.tag=$(IMG_TAG) \
--set serviceMonitor.enabled=true \
--set-string controller.env[0].name=ENABLE_PROFILING \
--set-string controller.env[0].value=true
--set-string controller.env[0].value=true

e2etests: ## Run the e2e suite against your local cluster
cd test && go test \
Expand Down
7 changes: 5 additions & 2 deletions pkg/controllers/nodeclaim/disruption/drift_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,11 @@ var _ = Describe("Drift", func() {
It("should detect stale instance type drift if the instance type offerings aren't compatible with the nodeclaim", func() {
cp.InstanceTypes = lo.Map(cp.InstanceTypes, func(it *cloudprovider.InstanceType, _ int) *cloudprovider.InstanceType {
if it.Name == nodeClaim.Labels[corev1.LabelInstanceTypeStable] {
newLabels := lo.Keys(nodeClaim.Labels)
it.Requirements = scheduling.NewLabelRequirements(map[string]string{newLabels[0]: test.RandomName()})
for i := range it.Offerings {
it.Offerings[i].Requirements = scheduling.NewLabelRequirements(map[string]string{
corev1.LabelTopologyZone: test.RandomName(),
})
}
}
return it
})
Expand Down

0 comments on commit 2b05d96

Please sign in to comment.