Skip to content

Commit

Permalink
Add Integration E2E testing for v1beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Oct 20, 2023
1 parent 24cd55c commit 9549709
Show file tree
Hide file tree
Showing 30 changed files with 2,898 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
strategy:
fail-fast: false
matrix:
suite: [Beta/Drift, Alpha/Integration, Alpha/Machine, Alpha/Consolidation, Alpha/Utilization, Alpha/Interruption, Alpha/Drift, Alpha/Expiration, Alpha/Chaos, Alpha/IPv6]
suite: [Beta/Integration, Beta/Drift, Alpha/Integration, Alpha/Machine, Alpha/Consolidation, Alpha/Utilization, Alpha/Interruption, Alpha/Drift, Alpha/Expiration, Alpha/Chaos, Alpha/IPv6]
uses: ./.github/workflows/e2e.yaml
with:
suite: ${{ matrix.suite }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
type: choice
required: true
options:
- Beta/Integration
- Beta/Drift
- Alpha/Integration
- Alpha/Machine
Expand Down
25 changes: 24 additions & 1 deletion test/pkg/environment/common/expectations.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,9 @@ func (env *Environment) ExpectCABundle() string {
return base64.StdEncoding.EncodeToString(transportConfig.TLS.CAData)
}

func (env *Environment) GetDaemonSetCount(prov *v1alpha5.Provisioner) int {
func (env *Environment) GetDaemonSetCountLegacy(prov *v1alpha5.Provisioner) int {
GinkgoHelper()

// Performs the same logic as the scheduler to get the number of daemonset
// pods that we estimate we will need to schedule as overhead to each node
daemonSetList := &appsv1.DaemonSetList{}
Expand All @@ -728,3 +730,24 @@ func (env *Environment) GetDaemonSetCount(prov *v1alpha5.Provisioner) int {
return true
})
}

func (env *Environment) GetDaemonSetCount(np *corev1beta1.NodePool) int {
GinkgoHelper()

// Performs the same logic as the scheduler to get the number of daemonset
// pods that we estimate we will need to schedule as overhead to each node
daemonSetList := &appsv1.DaemonSetList{}
Expect(env.Client.List(env.Context, daemonSetList)).To(Succeed())

return lo.CountBy(daemonSetList.Items, func(d appsv1.DaemonSet) bool {
p := &v1.Pod{Spec: d.Spec.Template.Spec}
nodeTemplate := pscheduling.NewNodeClaimTemplate(np)
if err := scheduling.Taints(nodeTemplate.Spec.Taints).Tolerates(p); err != nil {
return false
}
if err := nodeTemplate.Requirements.Compatible(scheduling.NewPodRequirements(p), scheduling.AllowUndefinedWellKnownLabelsV1Beta1); err != nil {
return false
}
return true
})
}
4 changes: 2 additions & 2 deletions test/suites/alpha/integration/kubelet_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {
})

// Get the DS pod count and use it to calculate the DS pod overhead
dsCount := env.GetDaemonSetCount(provisioner)
dsCount := env.GetDaemonSetCountLegacy(provisioner)
provisioner.Spec.KubeletConfiguration = &v1alpha5.KubeletConfiguration{
MaxPods: ptr.Int32(1 + int32(dsCount)),
}
Expand Down Expand Up @@ -260,7 +260,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {
// 2. If # of DS pods is even, we will have i.e. ceil((4+2)/2) = 3
// Since we restrict node to two cores, we will allow 6 pods. Both nodes will have
// 4 DS pods and 2 test pods.
dsCount := env.GetDaemonSetCount(provisioner)
dsCount := env.GetDaemonSetCountLegacy(provisioner)
provisioner.Spec.KubeletConfiguration = &v1alpha5.KubeletConfiguration{
PodsPerCore: ptr.Int32(int32(math.Ceil(float64(2+dsCount) / 2))),
}
Expand Down
2 changes: 1 addition & 1 deletion test/suites/alpha/scale/deprovisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ var _ = Describe("Deprovisioning", Label(debug.NoWatch), Label(debug.NoEvents),
}
deployment = test.Deployment(deploymentOptions)
selector = labels.SelectorFromSet(deployment.Spec.Selector.MatchLabels)
dsCount = env.GetDaemonSetCount(provisioner)
dsCount = env.GetDaemonSetCountLegacy(provisioner)
})

AfterEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/suites/alpha/scale/provisioning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ var _ = Describe("Provisioning", Label(debug.NoWatch), Label(debug.NoEvents), fu
})
selector = labels.SelectorFromSet(deployment.Spec.Selector.MatchLabels)
// Get the DS pod count and use it to calculate the DS pod overhead
dsCount = env.GetDaemonSetCount(provisioner)
dsCount = env.GetDaemonSetCountLegacy(provisioner)
})
It("should scale successfully on a node-dense scale-up", Label(debug.NoEvents), func(_ context.Context) {
// Disable Prefix Delegation for the node-dense scale-up to not exhaust the IPs
Expand Down

0 comments on commit 9549709

Please sign in to comment.