Skip to content

Feature/dtc#286

Draft
julius-malcovsky wants to merge 3 commits intomainfrom
feature/dtc
Draft

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

Conversation

@julius-malcovsky
Copy link
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>
Eventually(func() bool {
err := k8sClient.Get(ctx, zone1Ref, zone1)
return err == nil && meta.IsStatusConditionTrue(zone1.Status.Conditions, condition.ConditionTypeReady)
}, timeout, interval).Should(BeTrue())
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional: better way is use With functions. It is adding directly additional context because without knowing Eventually interface you can very easy switch timeout and interval variable or another stuff because it is very generic


// Build URLs array: all DTC URLs from all zones (including current zone)
var dtcUrls []string
for _, zone := range zoneList.Items {
Copy link
Collaborator

Choose a reason for hiding this comment

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

how many zones can we have here? for _, zone := range will copy whole object in .Items. Use index can avoid necessary operation and improve performance.

If operation is executed on stack, it won't bring a lot of improvement.

url, err := url.Parse(r.Spec.Url)
// Use the first URL as the upstream URL
if len(r.Spec.Urls) == 0 {
return ups, err
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional: return here is enough but err will be nill and ups will be empty. Is it okay?

}

_, err = c.CreateOrUpdate(ctx, route, mutator)
_, err := c.CreateOrUpdate(ctx, route, mutator)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why?

mutator := func() error {
err := controllerutil.SetControllerReference(realm, route, c.Scheme())
if err != nil {
if err := controllerutil.SetControllerReference(realm, route, c.Scheme()); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional: i don't recommend use the same variable name in nested function because it can be very easy be included over closures and it complicated review because difference is almost just one character := vs =. I prefer use custom names as locErr (local Error) or something else.

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.

2 participants