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

Wasmplugin controller: new approach using Kuadrant Topology (DAG) #317

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f9271f0
wasmplugin controller
eguzki Oct 2, 2023
0056fcc
wasmplugin label selector is back
eguzki Nov 23, 2023
90cd9e3
wasmplugin name from rlptools
eguzki Nov 24, 2023
aeafada
fix unittests
eguzki Nov 24, 2023
78e1773
wasmplugin controller: custom field indexer called from the wasmplugi…
eguzki Nov 24, 2023
1699bf1
wasmplugin controller: fix use case of rlp targeting gateway with no …
eguzki Nov 24, 2023
65e6427
wasmplugin controller: integration tests
eguzki Nov 29, 2023
4546226
wasmplugin controller: integration tests
eguzki Dec 12, 2023
6a1e30e
controllers/ratelimitpolicy_controller_test.go: fix imports
eguzki Dec 13, 2023
990f2b6
wasmplugin controller: integration tests
eguzki Dec 13, 2023
aab39f2
wasmplugin controller: integration tests
eguzki Dec 14, 2023
7616512
wasmplugin controller: integration tests
eguzki Dec 14, 2023
aa59341
wasmplugin controller: integration tests: Free Route gets dedicated RLP
eguzki Dec 18, 2023
42b7fb2
wasmplugin controller: integration tests: New free route on a Gateway…
eguzki Dec 18, 2023
a733363
picking changes when rebasing
eguzki Feb 21, 2024
7be17ec
wasmplugin controller: enhance logging
eguzki Feb 22, 2024
7d010d8
wasmplugin controller: integration tests for hostnameless route
eguzki Feb 22, 2024
c05b0f4
wasmplugin controller: wasm rules from existing or inherited hostnames
eguzki Feb 22, 2024
321cf90
wasmplugin controller: sort policies by creation timestamp
eguzki Feb 26, 2024
88af9f2
wasmplugin controller: reuse GetRouteAcceptedGatewayParentKeys
eguzki Feb 26, 2024
c58450a
wasmplugin controller: refactor freeRoute -> untargetedRoute
eguzki Feb 26, 2024
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
46 changes: 34 additions & 12 deletions controllers/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
certmanmetav1 "github.com/cert-manager/cert-manager/pkg/apis/meta/v1"
"github.com/google/uuid"
. "github.com/onsi/gomega"

istioclientgoextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
Expand All @@ -35,7 +34,6 @@ import (
gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"

kuadrantdnsv1alpha1 "github.com/kuadrant/dns-operator/api/v1alpha1"

kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1"
kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2"
"github.com/kuadrant/kuadrant-operator/pkg/common"
Expand Down Expand Up @@ -308,26 +306,32 @@ func testRouteIsAccepted(routeKey client.ObjectKey) func() bool {
return func() bool {
route := &gatewayapiv1.HTTPRoute{}
err := k8sClient.Get(context.Background(), routeKey, route)
return err == nil && common.IsHTTPRouteAccepted(route)

if err != nil {
logf.Log.V(1).Info("httpRoute not read", "route", routeKey, "error", err)
return false
}

if !common.IsHTTPRouteAccepted(route) {
logf.Log.V(1).Info("httpRoute not accepted", "route", routeKey)
return false
}

return true
}
}

func testGatewayIsReady(gateway *gatewayapiv1.Gateway) func() bool {
return func() bool {
existingGateway := &gatewayapiv1.Gateway{}
err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(gateway), existingGateway)
return err == nil && meta.IsStatusConditionTrue(existingGateway.Status.Conditions, common.GatewayProgrammedConditionType)
}
}

func testRLPIsAccepted(rlpKey client.ObjectKey) func() bool {
return func() bool {
existingRLP := &kuadrantv1beta2.RateLimitPolicy{}
err := k8sClient.Get(context.Background(), rlpKey, existingRLP)
if err != nil {
logf.Log.V(1).Info("gateway not read", "gateway", client.ObjectKeyFromObject(gateway), "error", err)
return false
}
if !meta.IsStatusConditionTrue(existingRLP.Status.Conditions, string(gatewayapiv1alpha2.PolicyConditionAccepted)) {

if !meta.IsStatusConditionTrue(existingGateway.Status.Conditions, common.GatewayProgrammedConditionType) {
logf.Log.V(1).Info("gateway not programmed", "gateway", client.ObjectKeyFromObject(gateway))
return false
}

Expand All @@ -340,6 +344,7 @@ func testWasmPluginIsAvailable(key client.ObjectKey) func() bool {
wp := &istioclientgoextensionv1alpha1.WasmPlugin{}
err := k8sClient.Get(context.Background(), key, wp)
if err != nil {
logf.Log.V(1).Info("wasmplugin not read", "key", key, "error", err)
return false
}

Expand All @@ -353,6 +358,23 @@ func testWasmPluginIsAvailable(key client.ObjectKey) func() bool {
}
}

func testRLPIsAccepted(rlpKey client.ObjectKey) func() bool {
return func() bool {
existingRLP := &kuadrantv1beta2.RateLimitPolicy{}
err := k8sClient.Get(context.Background(), rlpKey, existingRLP)
if err != nil {
logf.Log.V(1).Info("ratelimitpolicy not read", "rlp", rlpKey, "error", err)
return false
}
if !meta.IsStatusConditionTrue(existingRLP.Status.Conditions, string(gatewayapiv1alpha2.PolicyConditionAccepted)) {
logf.Log.V(1).Info("ratelimitpolicy not available", "rlp", rlpKey)
return false
}

return true
}
}

// DNS

func testBuildManagedZone(name, ns, domainName string) *kuadrantdnsv1alpha1.ManagedZone {
Expand Down
Loading
Loading