-
Notifications
You must be signed in to change notification settings - Fork 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
Add labels for traefik.frontend.entryPoints
& PassTLSCert
to Kubernetes
#2324
Add labels for traefik.frontend.entryPoints
& PassTLSCert
to Kubernetes
#2324
Conversation
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.
LGTM 👏
traefik.frontend.entryPoints
& PassTLSCert
to Kubernetes
Ping @dtomcej or @timoreimann, WDYT ? |
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.
LGTM
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.
Still need to look at the code, but the least we're missing is documentation. Can we add that?
Ah wait, this doesn't seem to be about a new annotation, so maybe no docs update strictly needed. Would it be worthwhile to extend the guide somehow though? @dtomcej, WDYT? |
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.
Left a few remarks.
On second pass through, it looks like we're referencing annotations that have not been documented yet. Would that be correct, and if so, can we amend the docs?
provider/kubernetes/kubernetes.go
Outdated
log.Warnf("Unknown value '%s' for %s, falling back to %s", passHostHeaderAnnotation, types.LabelFrontendPassHostHeader, PassHostHeader) | ||
} | ||
PassHostHeader := getRulePassHostHeader(i, p) | ||
PassTLSCert := getRulePassTLSCert(i, p) |
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.
The two variables probably don't need to be exported. Can we decapitalize them?
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.
Done.
provider/kubernetes/kubernetes.go
Outdated
if realm := i.Annotations[annotationKubernetesAuthRealm]; realm != "" && realm != traefikDefaultRealm { | ||
log.Errorf("Value for annotation %q on ingress %s/%s invalid: no realm customization supported", annotationKubernetesAuthRealm, i.ObjectMeta.Namespace, i.ObjectMeta.Name) | ||
delete(templateObjects.Backends, r.Host+pa.Path) | ||
continue | ||
} | ||
|
||
EntryPoints := getEntrypoints(i) |
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.
Unexport this one too?
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.
Done.
provider/kubernetes/kubernetes.go
Outdated
Routes: make(map[string]types.Route), | ||
Priority: priority, | ||
BasicAuth: basicAuthCreds, | ||
WhitelistSourceRange: whitelistSourceRange, | ||
EntryPoints: EntryPoints, |
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.
Are the entry points needed for the pass TLS functionality? If not, then I'd prefer to handle them in a separate PR.
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.
Did i really need to make two separate PR?
if ok { | ||
return strings.Split(entrypointsAnnotation, ",") | ||
} | ||
return nil |
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.
If the nil
slice is handled equally to the empty slice case by Traefik, then we don't need the extra ok
check it seems?
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.
strings.Split
return a non empty slice when his first arg is empty, so if i didn't check extra ok
, i will need to check if first of slice is empty. It seem more maintainable that way, 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.
Good point, I missed that property of strings.Split
. Let's keep things like they are right now then.
provider/kubernetes/kubernetes.go
Outdated
return nil | ||
} | ||
|
||
func getRulePassHostHeader(i *v1beta1.Ingress, p *Provider) bool { |
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 not really a rule it seems to me. Can we drop that part from the function name?
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.
Done.
provider/kubernetes/kubernetes.go
Outdated
return passHostHeader | ||
} | ||
|
||
func getRulePassTLSCert(i *v1beta1.Ingress, p *Provider) bool { |
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.
Drop Rule
from the name here too?
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.
Done.
provider/kubernetes/kubernetes.go
Outdated
default: | ||
log.Warnf("Unknown value '%s' for %s, falling back to %s", passTLSCertAnnotation, types.LabelFrontendPassTLSCert, passTLSCert) | ||
} | ||
return passTLSCert |
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.
Is the parsing logic identical to what we have in the function just above? If so, can we extract a little helper and use it from both implementation?
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.
Done.
@ryarnyah So that your PR is integrated in the 1.5, it is imperative that it is ready by Tuesday 21 November at the latest. 🚀 |
2734f2c
to
daf02eb
Compare
I also added some docs on these. |
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.
One typo left, otherwise I'm good.
provider/kubernetes/kubernetes.go
Outdated
|
||
} | ||
|
||
func getBoolAnnoatation(meta v1.ObjectMeta, name string, defaultValue bool) bool { |
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.
Typo: Annoatation -> Annotation.
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.
Done.
daf02eb
to
66d91d4
Compare
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.
LGTM, thanks. 👏
Description
Add labels:
traefik.frontend.entryPoints
traefik.frontend.passTLSCert