Skip to content

Commit

Permalink
wasmplugin controller: public methods changed to private
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Mar 20, 2024
1 parent 22ec000 commit 99f5e4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions controllers/rate_limiting_wasmplugin_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (r *RateLimitingWASMPluginReconciler) wasmPluginConfig(ctx context.Context,

for _, policy := range rateLimitPolicies {
rlp := policy.(*kuadrantv1beta2.RateLimitPolicy)
wasmRLP, err := r.WASMRateLimitPolicy(ctx, t, rlp, gw)
wasmRLP, err := r.wasmRateLimitPolicy(ctx, t, rlp, gw)
if err != nil {
return nil, err

Check warning on line 179 in controllers/rate_limiting_wasmplugin_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/rate_limiting_wasmplugin_controller.go#L179

Added line #L179 was not covered by tests
}
Expand Down Expand Up @@ -232,8 +232,8 @@ func (r *RateLimitingWASMPluginReconciler) topologyIndexesFromGateway(ctx contex
return kuadrantgatewayapi.NewTopologyIndexes(t), nil
}

func (r *RateLimitingWASMPluginReconciler) WASMRateLimitPolicy(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*wasm.RateLimitPolicy, error) {
route, err := r.RouteFromRLP(ctx, t, rlp, gw)
func (r *RateLimitingWASMPluginReconciler) wasmRateLimitPolicy(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*wasm.RateLimitPolicy, error) {
route, err := r.routeFromRLP(ctx, t, rlp, gw)
if err != nil {
return nil, err

Check warning on line 238 in controllers/rate_limiting_wasmplugin_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/rate_limiting_wasmplugin_controller.go#L238

Added line #L238 was not covered by tests
}
Expand Down Expand Up @@ -280,7 +280,7 @@ func (r *RateLimitingWASMPluginReconciler) WASMRateLimitPolicy(ctx context.Conte
}, nil
}

func (r *RateLimitingWASMPluginReconciler) RouteFromRLP(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*gatewayapiv1.HTTPRoute, error) {
func (r *RateLimitingWASMPluginReconciler) routeFromRLP(ctx context.Context, t *kuadrantgatewayapi.TopologyIndexes, rlp *kuadrantv1beta2.RateLimitPolicy, gw *gatewayapiv1.Gateway) (*gatewayapiv1.HTTPRoute, error) {
logger, err := logr.FromContext(ctx)
if err != nil {
return nil, err

Check warning on line 286 in controllers/rate_limiting_wasmplugin_controller.go

View check run for this annotation

Codecov / codecov/patch

controllers/rate_limiting_wasmplugin_controller.go#L286

Added line #L286 was not covered by tests
Expand Down Expand Up @@ -321,7 +321,7 @@ func (r *RateLimitingWASMPluginReconciler) RouteFromRLP(ctx context.Context, t *
}

// addHTTPRouteByGatewayIndexer declares an index key that we can later use with the client as a pseudo-field name,
// allowing to query all the routes parenting a given gateway
// allowing to query all the routes parented by a given gateway
// to prevent creating the same index field multiple times, the function is declared private to be
// called only by this controller
func addHTTPRouteByGatewayIndexer(mgr ctrl.Manager, baseLogger logr.Logger) error {
Expand Down
4 changes: 2 additions & 2 deletions controllers/rate_limiting_wasmplugin_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
Expect(wasmRLP.Service).To(Equal(common.KuadrantRateLimitClusterName))
})

It("Simple RLP targeting Gateway parenting one HTTPRoute creates wasmplugin", func() {
It("Simple RLP targeting Gateway parented by one HTTPRoute creates wasmplugin", func() {
// create httproute
httpRoute := testBuildBasicHttpRoute(routeName, gwName, testNamespace, []string{"*.example.com"})
err := k8sClient.Create(context.Background(), httpRoute)
Expand Down Expand Up @@ -947,7 +947,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() {
})

// Check wasm plugin for gateway B does not exist
// There is not RLP targeting Gateway B or any route parenting Gateway B
// There is not RLP targeting Gateway B or any route parented by Gateway B
// it may take some reconciliation loops to get to that, so checking it with eventually
Eventually(func() bool {
wasmPluginKey := client.ObjectKey{Name: rlptools.WASMPluginName(gwB), Namespace: testNamespace}
Expand Down

0 comments on commit 99f5e4d

Please sign in to comment.