Skip to content

Commit

Permalink
Add e2e test for Node Requirement Drift
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam committed Aug 1, 2023
1 parent e08a862 commit 002d25e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions test/suites/drift/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ var _ = Describe("Drift", Label("AWS"), func() {
SecurityGroupSelector: map[string]string{"karpenter.sh/discovery": settings.FromContext(env.Context).ClusterName},
SubnetSelector: map[string]string{"karpenter.sh/discovery": settings.FromContext(env.Context).ClusterName},
}})
provisioner = test.Provisioner(test.ProvisionerOptions{ProviderRef: &v1alpha5.MachineTemplateRef{Name: nodeTemplate.Name}})
provisioner = test.Provisioner(test.ProvisionerOptions{
Requirements: []v1.NodeSelectorRequirement{{Key: v1alpha5.LabelCapacityType, Operator: v1.NodeSelectorOpIn, Values: []string{v1alpha5.CapacityTypeOnDemand}}},
ProviderRef: &v1alpha5.MachineTemplateRef{Name: nodeTemplate.Name},
})
// Add a do-not-evict pod so that we can check node metadata before we deprovision
pod = test.Pod(test.PodOptions{
ObjectMeta: metav1.ObjectMeta{
Expand All @@ -289,7 +292,7 @@ var _ = Describe("Drift", Label("AWS"), func() {
},
})
})
DescribeTable("provisioner static drift", func(fieldName string, provisionerOption test.ProvisionerOptions) {
DescribeTable("Provisioner Drift", func(fieldName string, provisionerOption test.ProvisionerOptions) {
provisionerOption.ObjectMeta = provisioner.ObjectMeta
updatedProvisioner := test.Provisioner(
test.ProvisionerOptions{ProviderRef: &v1alpha5.MachineTemplateRef{Name: nodeTemplate.Name}},
Expand Down Expand Up @@ -334,6 +337,7 @@ var _ = Describe("Drift", Label("AWS"), func() {
EvictionSoftGracePeriod: map[string]metav1.Duration{"memory.available": {Duration: time.Minute}},
}}),
Entry("Start-up Taints Drift", "Start-up Taint", test.ProvisionerOptions{StartupTaints: []v1.Taint{{Key: "example.com/another-taint-2", Effect: v1.TaintEffectPreferNoSchedule}}}),
Entry("NodeRequirement Drift", "NodeRequirement", test.ProvisionerOptions{Requirements: []v1.NodeSelectorRequirement{{Key: v1alpha5.LabelCapacityType, Operator: v1.NodeSelectorOpIn, Values: []string{v1alpha5.CapacityTypeSpot}}}}),
)
})
})
2 changes: 1 addition & 1 deletion website/content/en/preview/concepts/deprovisioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ Read the [Drift Design](https://github.com/aws/karpenter-core/pull/366/files) fo
| Taints | x | | | x |
| Labels | x | | | x |
| Annotations | x | | | x |
| Node Requirements | | x | | |
| Node Requirements | | x | | x |
| Kubelet Configuration | x | | | x |
| Weight | | | x | NA |
| Limits | | | x | NA |
Expand Down

0 comments on commit 002d25e

Please sign in to comment.