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

feat: add scaletargetref exists check in webhook and revise some variable name #6350

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a3ca76d
Check scaleTarget if exists in webhook
ctccxxd Nov 19, 2024
7837c59
fix some info
ctccxxd Nov 19, 2024
d58a0aa
change function parameter
ctccxxd Nov 20, 2024
37e4645
fix a mistke
ctccxxd Nov 20, 2024
6fa2d55
add CHANGELOG and change import order
ctccxxd Nov 20, 2024
c76c19f
change import order using gci
ctccxxd Nov 20, 2024
e20ff99
add test and revise old test after forbidden the circumstance scaleTa…
ctccxxd Nov 20, 2024
0fb7542
revise one case
ctccxxd Nov 20, 2024
22b489d
revise test case annotation and follow review opinion
ctccxxd Nov 20, 2024
c017a92
revise cloudevent test
ctccxxd Dec 8, 2024
7b5dddc
Merge branch 'main' into checkscaletargetrefexists
ctccxxd Dec 8, 2024
00bef8e
Update cloudevent_source_test.go
ctccxxd Dec 8, 2024
cf2cc42
change end-to-end test cases
ctccxxd Dec 10, 2024
2614ea9
revise test case
ctccxxd Dec 10, 2024
6845045
Update cloudevent_source_test.go
ctccxxd Dec 10, 2024
97efe83
Update events_test.go
ctccxxd Dec 10, 2024
fab9b0f
Update scaled_object_validation_test.go
ctccxxd Dec 10, 2024
ff3ab9e
Update events_test.go
ctccxxd Dec 10, 2024
7772090
change import order
ctccxxd Dec 10, 2024
ea9dc8e
change test case
ctccxxd Dec 12, 2024
1090263
change format
ctccxxd Dec 12, 2024
a1a41ab
Update events_test.go
ctccxxd Dec 12, 2024
d8ab203
Update cloudevent_source_test.go
ctccxxd Dec 12, 2024
3ca522f
Update events_test.go
ctccxxd Dec 12, 2024
4260f77
Update events_test.go
ctccxxd Dec 12, 2024
497b134
Update controllers/keda/scaledobject_controller.go
zroubalik Jan 2, 2025
3aff46d
Update scaledobject_controller.go
ctccxxd Jan 3, 2025
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
Prev Previous commit
Next Next commit
revise one case
Signed-off-by: Shane <[email protected]>
ctccxxd committed Nov 20, 2024
commit 0fb7542249d7c652f9b9e1cfbf60a76929ec9802
9 changes: 3 additions & 6 deletions apis/keda/v1alpha1/scaledobject_webhook_test.go
Original file line number Diff line number Diff line change
@@ -59,6 +59,7 @@ var _ = It("should validate the so creation when there are other SO for other wo

workload := createDeployment(namespaceName, false, false)
otherWorkload := createDeployment(namespaceName, false, false)
otherWorkload.Name = "other-workload"
otherWorkload.Spec.Template.Name = "other-workload"

so1 := createScaledObject(soName, namespaceName, workloadName, "apps/v1", "Deployment", false, map[string]string{}, "")
@@ -556,22 +557,18 @@ var _ = It("shouldn't validate the so creation with cpu and memory when stateful
}).Should(HaveOccurred())
})

var _ = It("should validate the so creation without cpu and memory when custom resources", func() {
var _ = It("shouldn't validate the so creation without cpu and memory when custom resources without real StatefulSet", func() {

namespaceName := "crd-not-resources"
namespace := createNamespace(namespaceName)
workload := createStatefulSet(namespaceName, false, true)
so := createScaledObject(soName, namespaceName, workloadName, "custom-api", "StatefulSet", true, map[string]string{}, "")

err := k8sClient.Create(context.Background(), namespace)
Expect(err).ToNot(HaveOccurred())

err = k8sClient.Create(context.Background(), workload)
Expect(err).ToNot(HaveOccurred())

Eventually(func() error {
return k8sClient.Create(context.Background(), so)
}).ShouldNot(HaveOccurred())
}).Should(HaveOccurred())
})

var _ = It("should validate so creation when all requirements are met for scaling to zero with cpu scaler", func() {