-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Ingress target annotation should set, not append #318
Ingress target annotation should set, not append #318
Conversation
/assign hjacobs |
bfd2e71
to
ee783d6
Compare
@ClaytonONeill please also change the logic when FQDN template is used ( |
ee783d6
to
29d6f86
Compare
@hjacobs Thanks for catching that. Should be fixed in both places now. Not sure how I overlooked that. |
@ideahitme could you have a quick look (also to get familiar with this feature). LGTM, but I already overlooked something the last time 😏 |
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.
Some minor improvements can be done here
source/ingress.go
Outdated
@@ -152,7 +160,11 @@ func endpointsFromIngress(ing *v1beta1.Ingress) []*endpoint.Endpoint { | |||
continue | |||
} | |||
|
|||
endpoints = addEndpointsFromTargetAnnotation(ing, rule.Host, endpoints) | |||
endpoints = getEndpointsFromTargetAnnotation(ing, rule.Host) |
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.
I am not entirely sure about this, so this basically ignores all but lastrules.host
and generate endpoint from it. Why not generate an endpoint for each of the hosts found ?
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.
IMHO getEndpointsFromTargetAnnotation
should be called from Endpoint()
method above:
- Try to generate endpoint from target annotation key, if none:
- Try to generate endpoint from ingress status field, if none:
- Try to generate endpoint from template
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.
@ideahitme My thought was to move it to be called from Endpoint also, but then that leads to duplication of the code that loops over the rules gathering hosts.
As far as the call to it in the endpointsFromTemplate function, I'm not sure. If the consensus is to change that I'll be glad to do it, but I'd rather not have this fix get bogged down on something unrelated.
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.
@ClaytonONeill it is okay, it was just a suggestion on to improve overall code structure - which can be done in subsequent PR. Otherwise this pull request looks okay to me. If no objections I will have this merged /cc @linki
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.
@ClaytonONeill and also my first comment above (regarding ignoring all but last rule.host
values), is that intentional ?
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.
No, I think that's accidental. I'll take a look at fixing that and get this updated if I'm correct.
@@ -129,7 +133,11 @@ func (sc *ingressSource) endpointsFromTemplate(ing *v1beta1.Ingress) ([]*endpoin | |||
|
|||
hostname := buf.String() | |||
|
|||
endpoints = addEndpointsFromTargetAnnotation(ing, hostname, endpoints) | |||
endpoints = getEndpointsFromTargetAnnotation(ing, hostname) |
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.
I think this does not belong here, endpointsFromTemplate is called only as a last resort to generate an endpoint, i.e. there is no target annotation
29d6f86
to
0ce65b1
Compare
@ideahitme I think the latest update should fix the issue you identified. |
@ClaytonONeill please update the changelog and good to be merged from my side |
@ideahitme @ClaytonONeill lgtm |
If the user has specified a target for the ingress, treat that as overriding any endpoints already set on the ingress, even if that list is not empty. This allows overriding the IP address or hostname set when using a service like kube-keepalived-vip.
0ce65b1
to
a934bcd
Compare
@ideahitme I wasn't 100% sure about the changelog, so I updated it as if it were a new release. If you want something different let me know and I can get it updated to match. |
This seems to be non-functional on Google with v0.4.4
|
@james-masson Does it work normally without target annotations? I saw the same problem on Route53 w/AWS when using a hostname for the target annotation, but ended up switching back to IP based target annotations for other reasons. I assumed this wasn't a target annotation specific issue at that time. |
Hmm. I think I put the wrong log in the issue - or perhaps the right log in the wrong issue. I fixed that error with "txt-prefix" - as it's a CNAME/TXT conflict - nothing to do with this PR. Apologies for the noise... |
If the user has specified a target for the ingress, treat that as overriding any endpoints already set on the ingress, even if that list is not empty. This allows overriding the IP address or hostname set when using a service like kube-keepalived-vip.
If the user has specified a target for the ingress, treat that as
overriding any endpoints already set on the ingress, even if that list
is not empty. This allows overriding the IP address or hostname set
when using a service like kube-keepalived-vip.
This is related to #312