-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Refactor setting the "resource" label into endpointsForHostname #3762
Refactor setting the "resource" label into endpointsForHostname #3762
Conversation
98fdef0
to
50e4569
Compare
/cc @mloiseleur |
} | ||
if len(ms.defaultTargets) > 0 { | ||
for i := range endpoints { | ||
eps := endpointsForHostname(endpoints[i].DNSName, ms.defaultTargets, endpoints[i].RecordTTL, endpoints[i].ProviderSpecific, endpoints[i].SetIdentifier) | ||
eps := endpointsForHostname(endpoints[i].DNSName, ms.defaultTargets, endpoints[i].RecordTTL, endpoints[i].ProviderSpecific, endpoints[i].SetIdentifier, "") | ||
for _, ep := range eps { | ||
ep.Labels = endpoints[i].Labels | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With two sources, the second one may erase resource labels of the first, no ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would that happen? The code, both before and after, is copying all the labels for each endpoint it is copying (and applying defaultTargets
. Each sub-source's endpoints will get their respective resource labels.
providerSpecific, setIdentifier := getProviderSpecificAnnotations(annotations) | ||
for _, domain := range virtualHost.Domains { | ||
endpoints = append(endpoints, endpointsForHostname(strings.TrimSuffix(domain, "."), targets, ttl, providerSpecific, setIdentifier)...) | ||
endpoints = append(endpoints, endpointsForHostname(strings.TrimSuffix(domain, "."), targets, ttl, providerSpecific, setIdentifier, "")...) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird to have only Gloo Proxy without resource Label. It's because they only use annotations ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably should list the VirtualHost. But that is a pre-existing issue.
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
Refactor the code for setting the "resource" label into the endpointsForHostname() function. Start setting the "resource" label for endpoints created from Ambassador
Host
resources.Checklist
Unit tests updatedEnd user documentation updated