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

Target ref #691

Merged
merged 2 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions controllers/authpolicy_istio_authorizationpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ func (r *AuthPolicyReconciler) istioAuthorizationPolicy(ctx context.Context, ap
Labels: istioAuthorizationPolicyLabels(client.ObjectKeyFromObject(gateway), client.ObjectKeyFromObject(ap)),
},
Spec: istiosecurity.AuthorizationPolicy{
Action: istiosecurity.AuthorizationPolicy_CUSTOM,
Selector: kuadrantistioutils.WorkloadSelectorFromGateway(ctx, r.Client(), gateway),
Action: istiosecurity.AuthorizationPolicy_CUSTOM,
TargetRef: kuadrantistioutils.PolicyTargetRefFromGateway(gateway),
ActionDetail: &istiosecurity.AuthorizationPolicy_Provider{
Provider: &istiosecurity.AuthorizationPolicy_ExtensionProvider{
Name: KuadrantExtAuthProviderName,
Expand Down
10 changes: 10 additions & 0 deletions tests/istio/authpolicy_controller_authorizationpolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ var _ = Describe("AuthPolicy controller managing authorization policy", Ordered,
logf.Log.V(1).Info("Fetching Istio's AuthorizationPolicy", "key", iapKey.String(), "error", err)
return err == nil
}).WithContext(ctx).Should(BeTrue())

// has the correct target ref
Expect(iap.Spec.TargetRef.Group).To(Equal("gateway.networking.k8s.io"))
Expect(iap.Spec.TargetRef.Kind).To(Equal("Gateway"))
Expect(iap.Spec.TargetRef.Name).To(Equal(TestGatewayName))
Expect(iap.Spec.Rules).To(HaveLen(1))
Expect(iap.Spec.Rules[0].To).To(HaveLen(1))
Expect(iap.Spec.Rules[0].To[0].Operation).ShouldNot(BeNil())
Expand Down Expand Up @@ -164,6 +169,11 @@ var _ = Describe("AuthPolicy controller managing authorization policy", Ordered,
logf.Log.V(1).Info("Fetching Istio's AuthorizationPolicy", "key", iapKey.String(), "error", err)
return err == nil
}).WithContext(ctx).Should(BeTrue())

// has the correct target ref
Expect(iap.Spec.TargetRef.Group).To(Equal("gateway.networking.k8s.io"))
Expect(iap.Spec.TargetRef.Kind).To(Equal("Gateway"))
Expect(iap.Spec.TargetRef.Name).To(Equal(TestGatewayName))
Expect(iap.Spec.Rules).To(HaveLen(1))
Expect(iap.Spec.Rules[0].To).To(HaveLen(1))
Expect(iap.Spec.Rules[0].To[0].Operation).ShouldNot(BeNil())
Expand Down
Loading