Skip to content
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

Merged
merged 1 commit into from
Nov 20, 2017

Conversation

ryarnyah
Copy link
Contributor

@ryarnyah ryarnyah commented Oct 25, 2017

Description

Add labels:

  • traefik.frontend.entryPoints
  • traefik.frontend.passTLSCert

Copy link
Contributor

@nmengin nmengin left a comment

Choose a reason for hiding this comment

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

LGTM 👏

@ldez ldez changed the title Add LabelFrontendEntryPoints & LabelFrontendPassTLSCert to kubernetes… Add labels for traefik.frontend.entryPoints & PassTLSCert to Kubernetes Oct 31, 2017
@emilevauge
Copy link
Member

Ping @dtomcej or @timoreimann, WDYT ?

Copy link
Contributor

@dtomcej dtomcej left a comment

Choose a reason for hiding this comment

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

LGTM
:shipit:

Copy link
Contributor

@timoreimann timoreimann left a 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?

@timoreimann
Copy link
Contributor

timoreimann commented Nov 10, 2017

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?

Copy link
Contributor

@timoreimann timoreimann left a 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?

log.Warnf("Unknown value '%s' for %s, falling back to %s", passHostHeaderAnnotation, types.LabelFrontendPassHostHeader, PassHostHeader)
}
PassHostHeader := getRulePassHostHeader(i, p)
PassTLSCert := getRulePassTLSCert(i, p)
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unexport this one too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Routes: make(map[string]types.Route),
Priority: priority,
BasicAuth: basicAuthCreds,
WhitelistSourceRange: whitelistSourceRange,
EntryPoints: EntryPoints,
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor

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.

return nil
}

func getRulePassHostHeader(i *v1beta1.Ingress, p *Provider) bool {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

return passHostHeader
}

func getRulePassTLSCert(i *v1beta1.Ingress, p *Provider) bool {
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

default:
log.Warnf("Unknown value '%s' for %s, falling back to %s", passTLSCertAnnotation, types.LabelFrontendPassTLSCert, passTLSCert)
}
return passTLSCert
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ldez
Copy link
Contributor

ldez commented Nov 16, 2017

@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. 🚀

@ryarnyah ryarnyah force-pushed the feat/add-pass-tls-cert-providers branch 2 times, most recently from 2734f2c to daf02eb Compare November 19, 2017 07:39
@ryarnyah
Copy link
Contributor Author

I also added some docs on these.

Copy link
Contributor

@timoreimann timoreimann left a 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.


}

func getBoolAnnoatation(meta v1.ObjectMeta, name string, defaultValue bool) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Annoatation -> Annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ryarnyah ryarnyah force-pushed the feat/add-pass-tls-cert-providers branch from daf02eb to 66d91d4 Compare November 20, 2017 00:28
Copy link
Contributor

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

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

LGTM, thanks. 👏

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

Successfully merging this pull request may close these issues.

7 participants