Skip to content

Feature/dtc#286

Open
julius-malcovsky wants to merge 11 commits intomainfrom
feature/dtc
Open

Feature/dtc#286
julius-malcovsky wants to merge 11 commits intomainfrom
feature/dtc

Conversation

@julius-malcovsky
Copy link
Copy Markdown
Contributor

No description provided.

julius-malcovsky and others added 2 commits March 18, 2026 13:39
Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
@julius-malcovsky julius-malcovsky self-assigned this Mar 18, 2026
Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
julius-malcovsky and others added 4 commits March 21, 2026 20:26
…tion logic

Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
@julius-malcovsky julius-malcovsky marked this pull request as ready for review March 24, 2026 09:59
Copilot AI review requested due to automatic review settings March 24, 2026 09:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands Gateway Realm configuration from single url/issuerUrl fields to multi-value urls/issuerUrls, and adds optional Zone-level DTC (Dynamic Traffic Control) support by creating an additional “dtc” Gateway Realm when configured.

Changes:

  • Update RealmSpec and Gateway Realm CRD to use urls[] / issuerUrls[] and adjust route creation to build downstreams for all Realm URLs.
  • Add spec.gateway.dtcUrl to Zones and create/update a DTC Gateway Realm (name: dtc) during Zone reconciliation.
  • Update generated deepcopy code, CRDs, and tests across modules to reflect the new RealmSpec fields and DTC behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
gateway/internal/handler/realm/routes.go Build Route downstreams from all realm.spec.urls instead of a single URL.
gateway/internal/features/suite_test.go Update mock Realm to new Urls/IssuerUrls fields.
gateway/internal/features/builder_ratelimiting_test.go Update RealmSpec usage in rate limiting tests.
gateway/internal/controller/realm_controller_test.go Update RealmSpec usage in controller tests.
gateway/config/crd/bases/gateway.cp.ei.telekom.de_realms.yaml CRD schema changes: urls[] / issuerUrls[] required with minItems=1.
gateway/api/v1/zz_generated.deepcopy.go Deepcopy updated for new RealmSpec slices.
gateway/api/v1/realm_types.go RealmSpec updated + AsUpstream/AsDownstream updated for list fields.
event/internal/handler/util/callback_route_test.go Update RealmSpec usage in event callback route tests.
event/internal/handler/eventexposure/handler_test.go Update RealmSpec usage in event exposure handler tests.
event/internal/handler/eventconfig/handler_test.go Update RealmSpec usage in event config handler tests.
api/internal/handler/util_proxy_route_test.go Update RealmSpec usage in API proxy route tests.
api/internal/controller/remoteapisubscription_controller_test.go Update test realm setup to set Spec.Urls.
api/internal/controller/apiexposure_controller_test.go Update RealmSpec usage in API exposure tests.
admin/internal/handler/zone/handler.go Add DTC realm creation + adapt issuer access to IssuerUrls[0] and gateway realm spec updates.
admin/internal/handler/util/naming/naming.go Add naming helper for DTC gateway realm.
admin/internal/controller/zone_controller_test.go Add/extend tests for DTC realm behavior and updated RealmSpec expectations.
admin/config/crd/bases/admin.cp.ei.telekom.de_zones.yaml Add spec.gateway.dtcUrl and status.dtcGatewayRealm.
admin/api/v1/zz_generated.deepcopy.go Deepcopy updated for new DtcUrl and DtcGatewayRealm.
admin/api/v1/zone_types.go Add GatewayConfig.DtcUrl and ZoneStatus.DtcGatewayRealm.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Member

@ron96g ron96g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. I already have plans in mind to overengineer this to the moon so maybe you have to stop me but please verify the comments.

// Urls is the list of Gateway URLs that this realm should accept traffic from
// +listType=set
// +kubebuilder:validation:MinItems=1
Urls []string `json:"urls"`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check via regex or URL pattern. Same for the issuerUrls

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not "+kubebuilder:validation:Format=uri"?

return route, errors.Wrapf(err, "failed to parse URL: %s", realmUrl)
}

downstreams = append(downstreams, gatewayv1.Downstream{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are multiple downstream handled in the Route creation? Is this actually supported? See KongClient.CreateOrReplaceRoute

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated the logic to support multiple downstreams. hosts and paths are de-duplicated before sent to kong. will need to test it properly, but so far it looks ok

julius-malcovsky and others added 2 commits March 24, 2026 12:01
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…d. hosts and issuers are de-duplicated

Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
@julius-malcovsky julius-malcovsky requested a review from ron96g March 25, 2026 14:28
julius-malcovsky and others added 2 commits March 25, 2026 15:37
…by the scoped client

Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
Co-authored-by: Björn Kottner <BjoernKarma@users.noreply.github.com>
Co-authored-by: Ismael Garba <iagarba@users.noreply.github.com>
Co-authored-by: Stefan Siber <stefan-ctrl@users.noreply.github.com>
Co-authored-by: Ron Gummich <ron96g@users.noreply.github.com>
DefaultConsumers: []string{},
Urls: []string{handlingContext.Zone.Spec.Gateway.Url},
IssuerUrls: []string{urls.ForGatewayRealm(handlingContext.Zone.Spec.IdentityProvider.Url, realmName)},
DefaultConsumers: []string{"gateway"},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DefaultConsumers should no longer be pre-filled and are added only if required by meshing

Gateway: types.ObjectRefFromObject(gateway),
Urls: dtcUrls,
IssuerUrls: issuerUrls,
DefaultConsumers: []string{"gateway"},
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

// Paths are deduplicated while maintaining order (first occurrence wins).
func (g *Route) GetPaths() []string {
seen := make(map[string]bool)
paths := make([]string, 0, len(g.Spec.Downstreams))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In praxis this will probably result in mostly over-sized slices as the path will remain the same and only the hosts are different. But personally, I think its okay for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants