Skip to content

Commit

Permalink
chore: Add testing for NodeRequirement Drift (#3933)
Browse files Browse the repository at this point in the history
  • Loading branch information
engedaam authored Aug 1, 2023
1 parent 76fea98 commit 9f325c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/avast/retry-go v3.0.0+incompatible
github.com/aws/aws-sdk-go v1.44.294
github.com/aws/karpenter-core v0.29.2-0.20230725171823-d34a21d5648d
github.com/aws/karpenter-core v0.29.2-0.20230801010020-94053bac8d48
github.com/go-playground/validator/v10 v10.13.0
github.com/imdario/mergo v0.3.16
github.com/mitchellh/hashstructure/v2 v2.0.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ github.com/avast/retry-go v3.0.0+incompatible h1:4SOWQ7Qs+oroOTQOYnAHqelpCO0biHS
github.com/avast/retry-go v3.0.0+incompatible/go.mod h1:XtSnn+n/sHqQIpZ10K1qAevBhOOCWBLXXy3hyiqqBrY=
github.com/aws/aws-sdk-go v1.44.294 h1:3x7GaEth+pDU9HwFcAU0awZlEix5CEdyIZvV08SlHa8=
github.com/aws/aws-sdk-go v1.44.294/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/karpenter-core v0.29.2-0.20230725171823-d34a21d5648d h1:NRv2tSoPVyyYnLWco4w+OSXiEo434QLxNCq7ecxb8Eo=
github.com/aws/karpenter-core v0.29.2-0.20230725171823-d34a21d5648d/go.mod h1:+C8X0N378fQ/+YmopvRHflj2JFrVP8sPs9xL7v4A6eM=
github.com/aws/karpenter-core v0.29.2-0.20230801010020-94053bac8d48 h1:efBudEW9YaaPqwXVa20z23bsLQ5qji23W0Qcd6Xd1rI=
github.com/aws/karpenter-core v0.29.2-0.20230801010020-94053bac8d48/go.mod h1:+C8X0N378fQ/+YmopvRHflj2JFrVP8sPs9xL7v4A6eM=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
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 9f325c1

Please sign in to comment.