Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d8563a8
add backend_config_plugin
inFocus7 Oct 14, 2025
a1a807f
set up tests + krt for tls-based policy merger
inFocus7 Oct 14, 2025
149db58
add testing + fix NPE in BackendConfigPolicy translation in agentgateway
inFocus7 Oct 15, 2025
d15666f
add test for mmultiple targetRefs in backendtls translation
inFocus7 Oct 15, 2025
d752832
make generated-code
inFocus7 Oct 15, 2025
43d0237
Merge branch 'main' into feat/support-section-name-in-backend-config-…
inFocus7 Oct 15, 2025
8835e06
simplify policy mapping and grouping to track a single policy per type
inFocus7 Oct 15, 2025
21ac165
remove TODOs
inFocus7 Oct 16, 2025
cddc502
run go-generate-apis
inFocus7 Oct 20, 2025
de49830
Merge branch 'main' into feat/support-section-name-in-backend-config-…
inFocus7 Oct 20, 2025
be5ceae
split agw backendTls plugins, create plugin for backendmodelconfig tr…
inFocus7 Oct 20, 2025
8fe2bff
generate code
inFocus7 Oct 20, 2025
5b066c6
Merge branch 'main' into feat/support-section-name-in-backend-config-…
inFocus7 Oct 20, 2025
8aeceae
add statuses based on backendConfig translation in agentgateway
inFocus7 Oct 21, 2025
eba74f5
Merge branch 'main' into feat/support-section-name-in-backend-config-…
inFocus7 Oct 21, 2025
326d503
Merge branch 'main' into feat/support-section-name-in-backend-config-…
inFocus7 Oct 22, 2025
7efcc26
generalize config policy generation logic
inFocus7 Oct 22, 2025
2f2c668
Merge branch 'main' into feat/support-section-name-in-backend-config-…
inFocus7 Oct 24, 2025
0cbe930
update status syncing for backendConfigPolicies
inFocus7 Oct 24, 2025
9d11132
resolve issues with updates in backendconfigpolicy
inFocus7 Oct 24, 2025
de2e031
fix status fatal with backendconfigpolicy
inFocus7 Oct 24, 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
4 changes: 2 additions & 2 deletions api/v1alpha1/backend_config_policy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ type BackendConfigPolicySpec struct {
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=16
// +kubebuilder:validation:XValidation:rule="self.all(r, (r.group == '' && r.kind == 'Service') || (r.group == 'gateway.kgateway.dev' && r.kind == 'Backend'))",message="TargetRefs must reference either a Kubernetes Service or a Backend API"
TargetRefs []LocalPolicyTargetReference `json:"targetRefs,omitempty"`
TargetRefs []LocalPolicyTargetReferenceWithSectionName `json:"targetRefs,omitempty"`

// TargetSelectors specifies the target selectors to select resources to attach the policy to.
// +optional
// +kubebuilder:validation:XValidation:rule="self.all(r, (r.group == '' && r.kind == 'Service') || (r.group == 'gateway.kgateway.dev' && r.kind == 'Backend'))",message="TargetSelectors must reference either a Kubernetes Service or a Backend API"
TargetSelectors []LocalPolicyTargetSelector `json:"targetSelectors,omitempty"`
TargetSelectors []LocalPolicyTargetSelectorWithSectionName `json:"targetSelectors,omitempty"`

// The timeout for new network connections to hosts in the cluster.
// +optional
Expand Down
8 changes: 5 additions & 3 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ spec:
the policy to.
items:
description: |-
Select the object to attach the policy by Group, Kind, and Name.
Select the object to attach the policy by Group, Kind, Name and SectionName.
The object must be in the same namespace as the policy.
You can target only one object at a time.
properties:
Expand All @@ -686,6 +686,12 @@ spec:
maxLength: 253
minLength: 1
type: string
sectionName:
description: The section name of the target resource.
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- group
- kind
Expand All @@ -704,7 +710,7 @@ spec:
resources to attach the policy to.
items:
description: |-
LocalPolicyTargetSelector selects the object to attach the policy by Group, Kind, and MatchLabels.
LocalPolicyTargetSelectorWithSectionName the object to attach the policy by Group, Kind, MatchLabels, and optionally SectionName.
The object must be in the same namespace as the policy and match the
specified labels.
Do not use targetSelectors when reconciliation times are critical, especially if you
Expand All @@ -731,6 +737,12 @@ spec:
type: string
description: Label selector to select the target resource.
type: object
sectionName:
description: The section name of the target resource.
maxLength: 253
minLength: 1
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
required:
- group
- kind
Expand Down
2 changes: 2 additions & 0 deletions internal/kgateway/agentgatewaysyncer/status/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ func enqueueStatus[T any](sw WorkerQueue, obj controllers.Object, ws T) {
res.GroupVersionKind = wellknown.TrafficPolicyGVK
case *gwxv1a1.XListenerSet:
res.GroupVersionKind = wellknown.XListenerSetGVK
case *v1alpha1.BackendConfigPolicy:
res.GroupVersionKind = wellknown.BackendConfigPolicyGVK
default:
log.Fatalf("enqueueStatus unknown type %T", t)
}
Expand Down
15 changes: 14 additions & 1 deletion internal/kgateway/agentgatewaysyncer/status_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ const (
type AgentGwStatusSyncer struct {
client kube.Client

trafficPolicies StatusSyncer[*v1alpha1.TrafficPolicy, *gwv1.PolicyStatus]
trafficPolicies StatusSyncer[*v1alpha1.TrafficPolicy, *gwv1.PolicyStatus]
backendConfigPolicies StatusSyncer[*v1alpha1.BackendConfigPolicy, *gwv1.PolicyStatus]

// Configuration
controllerName string
Expand Down Expand Up @@ -144,6 +145,16 @@ func NewAgwStatusSyncer(
}
},
},
backendConfigPolicies: StatusSyncer[*v1alpha1.BackendConfigPolicy, *gwv1.PolicyStatus]{
name: "backendConfigPolicy",
client: kclient.NewFilteredDelayed[*v1alpha1.BackendConfigPolicy](client, wellknown.BackendConfigPolicyGVR, f),
build: func(om metav1.ObjectMeta, s *gwv1.PolicyStatus) *v1alpha1.BackendConfigPolicy {
return &v1alpha1.BackendConfigPolicy{
ObjectMeta: om,
Status: *s,
}
},
},
}

return syncer
Expand Down Expand Up @@ -198,6 +209,8 @@ func (s *AgentGwStatusSyncer) SyncStatus(ctx context.Context, resource status.Re
s.httpRoutes.ApplyStatus(ctx, resource, statusObj)
case wellknown.TrafficPolicyGVK:
s.trafficPolicies.ApplyStatus(ctx, resource, statusObj)
case wellknown.BackendConfigPolicyGVK:
s.backendConfigPolicies.ApplyStatus(ctx, resource, statusObj)
default:
log.Fatalf("SyncStatus: unknown resource type: %v", resource.GroupVersionKind)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func NewPlugin(ctx context.Context, commoncol *collections.CommonCollections, v
},
Policy: b,
PolicyIR: policyIR,
TargetRefs: pluginsdkutils.TargetRefsToPolicyRefs(b.Spec.TargetRefs, b.Spec.TargetSelectors),
TargetRefs: pluginsdkutils.TargetRefsToPolicyRefsWithSectionName(b.Spec.TargetRefs, b.Spec.TargetSelectors),
Errors: errs,
}
}, commoncol.KrtOpts.ToOptions("BackendConfigPolicyIRs")...)
Expand Down
Loading