diff --git a/.travis.yml b/.travis.yml index af7a23397..74b01fb55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,9 @@ sudo: required dist: trusty +git: + depth: false + services: - docker @@ -21,22 +24,16 @@ before_deploy: sudo -E apt-get -yq update; sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-ce=${DOCKER_VERSION}*; docker version; - pip install --user -r requirements.txt; - make -j${N_MAKE_JOBS} crossbinary-parallel; - make image-dirty; - mkdocs build --clean; + if [ "$TRAVIS_TAG" ]; then + make -j${N_MAKE_JOBS} crossbinary-parallel; + make image-dirty; + fi; + curl -sI https://github.com/containous/structor/releases/latest | grep -Fi Location | tr -d '\r' | sed "s/tag/download/g" | awk -F " " '{ print $2 "/structor_linux-amd64"}' | wget --output-document=$GOPATH/bin/structor -i -; + chmod +x $GOPATH/bin/structor; + structor -o containous -r traefik --dockerfile-url="https://raw.githubusercontent.com/containous/traefik/master/docs.Dockerfile" --menu.js-url="https://raw.githubusercontent.com/containous/structor/master/traefik-menu.js.gotmpl" --exp-branch=master --debug; tar cfz dist/traefik-${VERSION}.src.tar.gz --exclude-vcs --exclude dist .; fi deploy: - - provider: pages - edge: true - github_token: ${GITHUB_TOKEN} - local_dir: site - skip_cleanup: true - on: - repo: containous/traefik - tags: true - condition: ${TRAVIS_TAG} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ - provider: releases api_key: ${GITHUB_TOKEN} file: dist/traefik* @@ -56,3 +53,11 @@ deploy: skip_cleanup: true on: repo: containous/traefik + - provider: pages + edge: true + github_token: ${GITHUB_TOKEN} + local_dir: site + skip_cleanup: true + on: + repo: containous/traefik + all_branches: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 89b2844eb..7e571c270 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,169 @@ # Change Log +## [v1.5.0](https://github.com/containous/traefik/tree/v1.5.0) (2018-01-23) +[All Commits](https://github.com/containous/traefik/compare/v1.4.0-rc1...v1.5.0) + +**Enhancements:** +- **[acme,tls]** Rename TLSConfigurations to TLS. ([#2744](https://github.com/containous/traefik/pull/2744) by [ldez](https://github.com/ldez)) +- **[acme,provider,docker,tls]** Make the TLS certificates management dynamic. ([#2233](https://github.com/containous/traefik/pull/2233) by [nmengin](https://github.com/nmengin)) +- **[acme]** Add Let's Encrypt HTTP Challenge ([#2701](https://github.com/containous/traefik/pull/2701) by [Juliens](https://github.com/Juliens)) +- **[acme]** Update github.com/xenolf/lego to 0.4.1 ([#2304](https://github.com/containous/traefik/pull/2304) by [oldmantaiter](https://github.com/oldmantaiter)) +- **[api,healthcheck,metrics,provider,webui]** Split Web into API/Dashboard, ping, metric and Rest Provider ([#2335](https://github.com/containous/traefik/pull/2335) by [Juliens](https://github.com/Juliens)) +- **[authentication]** Pass through certain forward auth negative response headers ([#2127](https://github.com/containous/traefik/pull/2127) by [wheresmysocks](https://github.com/wheresmysocks)) +- **[cluster,consul,file]** Add file to storeconfig ([#2419](https://github.com/containous/traefik/pull/2419) by [emilevauge](https://github.com/emilevauge)) +- **[cluster,provider]** Support Etcd v3, enhance KV support ([#2407](https://github.com/containous/traefik/pull/2407) by [nmengin](https://github.com/nmengin)) +- **[docker,k8s,rancher,webui]** Redirect to another entryPoint per frontend ([#2133](https://github.com/containous/traefik/pull/2133) by [SantoDE](https://github.com/SantoDE)) +- **[docker,k8s,rancher]** Support regex redirect by frontend ([#2570](https://github.com/containous/traefik/pull/2570) by [ldez](https://github.com/ldez)) +- **[docker]** Add Custom header parsing to Docker Provider ([#2030](https://github.com/containous/traefik/pull/2030) by [dtomcej](https://github.com/dtomcej)) +- **[docker]** Docker labels ([#2473](https://github.com/containous/traefik/pull/2473) by [ldez](https://github.com/ldez)) +- **[docker]** Add docker security headers via labels ([#2334](https://github.com/containous/traefik/pull/2334) by [dtomcej](https://github.com/dtomcej)) +- **[docker]** Use Node IP in Swarm Standalone with "host" NetworkMode ([#2274](https://github.com/containous/traefik/pull/2274) by [BlakeMesdag](https://github.com/BlakeMesdag)) +- **[ecs]** ECS provider refactoring ([#2050](https://github.com/containous/traefik/pull/2050) by [mmatur](https://github.com/mmatur)) +- **[ecs]** Add health check label to ECS ([#2421](https://github.com/containous/traefik/pull/2421) by [oldmantaiter](https://github.com/oldmantaiter)) +- **[ecs]** Support Host NetworkMode for ECS provider ([#2320](https://github.com/containous/traefik/pull/2320) by [FriggaHel](https://github.com/FriggaHel)) +- **[etcd]** Manage certificates dynamically in kv store ([#2411](https://github.com/containous/traefik/pull/2411) by [dahefanteng](https://github.com/dahefanteng)) +- **[healthcheck]** Use health check for systemd watchdog ([#2283](https://github.com/containous/traefik/pull/2283) by [guilhem](https://github.com/guilhem)) +- **[k8s]** Kubernetes security header annotations ([#2460](https://github.com/containous/traefik/pull/2460) by [dtomcej](https://github.com/dtomcej)) +- **[k8s]** Add labels for `traefik.frontend.entryPoints` & `PassTLSCert` to Kubernetes ([#2324](https://github.com/containous/traefik/pull/2324) by [ryarnyah](https://github.com/ryarnyah)) +- **[k8s]** Only listen to configured k8s namespaces. ([#1895](https://github.com/containous/traefik/pull/1895) by [timoreimann](https://github.com/timoreimann)) +- **[logs,middleware,consul,docker]** Use constants from http package. ([#2425](https://github.com/containous/traefik/pull/2425) by [ldez](https://github.com/ldez)) +- **[logs]** Add json format support for Traefik logs ([#2056](https://github.com/containous/traefik/pull/2056) by [marco-jantke](https://github.com/marco-jantke)) +- **[marathon]** Marathon constraints filtering ([#2388](https://github.com/containous/traefik/pull/2388) by [aantono](https://github.com/aantono)) +- **[marathon]** Remove unused lightMarathonClient. ([#2383](https://github.com/containous/traefik/pull/2383) by [timoreimann](https://github.com/timoreimann)) +- **[metrics]** Add InfluxDB support for traefik metrics ([#2289](https://github.com/containous/traefik/pull/2289) by [adityacs](https://github.com/adityacs)) +- **[middleware]** Added ReplacePathRegex middleware ([#2033](https://github.com/containous/traefik/pull/2033) by [Tiscs](https://github.com/Tiscs)) +- **[middleware]** Fix custom headers replacement ([#2455](https://github.com/containous/traefik/pull/2455) by [mmatur](https://github.com/mmatur)) +- **[oxy]** Resync oxy with original repository ([#2451](https://github.com/containous/traefik/pull/2451) by [Juliens](https://github.com/Juliens)) +- **[provider]** Support template as raw string. ([#2413](https://github.com/containous/traefik/pull/2413) by [ldez](https://github.com/ldez)) +- **[rancher]** Run Rancher tests cases in parallel. ([#2424](https://github.com/containous/traefik/pull/2424) by [ldez](https://github.com/ldez)) +- **[rancher]** Update Rancher API integration to go-rancher client v2. ([#2291](https://github.com/containous/traefik/pull/2291) by [rawmind0](https://github.com/rawmind0)) +- **[servicefabric]** Add Service Fabric Provider ([#2117](https://github.com/containous/traefik/pull/2117) by [lawrencegripper](https://github.com/lawrencegripper)) +- **[tls]** Allow adding optional Client CA files ([#2306](https://github.com/containous/traefik/pull/2306) by [nmengin](https://github.com/nmengin)) +- **[websocket]** Add tests for websocket headers ([#2379](https://github.com/containous/traefik/pull/2379) by [Juliens](https://github.com/Juliens)) +- Upgrade libkermit/compose version ([#2071](https://github.com/containous/traefik/pull/2071) by [nmengin](https://github.com/nmengin)) +- Add proxy protocol tests ([#2325](https://github.com/containous/traefik/pull/2325) by [emilevauge](https://github.com/emilevauge)) +- Register pprof handlers. ([#2428](https://github.com/containous/traefik/pull/2428) by [timoreimann](https://github.com/timoreimann)) +- Rate limiting for frontends ([#2034](https://github.com/containous/traefik/pull/2034) by [bparli](https://github.com/bparli)) +- Stats collection. ([#2447](https://github.com/containous/traefik/pull/2447) by [ldez](https://github.com/ldez)) +- Add request accepting grace period delaying graceful shutdown. ([#1971](https://github.com/containous/traefik/pull/1971) by [timoreimann](https://github.com/timoreimann)) +- Put subcommand in dedicated files. ([#2265](https://github.com/containous/traefik/pull/2265) by [ldez](https://github.com/ldez)) + +**Bug fixes:** +- **[acme,docker]** Modify ACME configuration migration into KV store ([#2598](https://github.com/containous/traefik/pull/2598) by [nmengin](https://github.com/nmengin)) +- **[acme,logs]** Modify DEBUG messages to get ACME certificates ([#2685](https://github.com/containous/traefik/pull/2685) by [nmengin](https://github.com/nmengin)) +- **[acme]** Modify the ACME renewing logs level ([#2520](https://github.com/containous/traefik/pull/2520) by [nmengin](https://github.com/nmengin)) +- **[acme]** ACME and corporate proxy. ([#2738](https://github.com/containous/traefik/pull/2738) by [ldez](https://github.com/ldez)) +- **[acme]** Challenge HTTP must ignore deprecated web.path option ([#2719](https://github.com/containous/traefik/pull/2719) by [Juliens](https://github.com/Juliens)) +- **[api]** Fix pprof route order. ([#2523](https://github.com/containous/traefik/pull/2523) by [timoreimann](https://github.com/timoreimann)) +- **[authentication,middleware]** Fix concurrent map writes on digest auth ([#2695](https://github.com/containous/traefik/pull/2695) by [mmatur](https://github.com/mmatur)) +- **[consulcatalog]** Use prefix for sticky and stickiness tags. ([#2624](https://github.com/containous/traefik/pull/2624) by [ldez](https://github.com/ldez)) +- **[consulcatalog]** Fix bad Træfik update on Consul Catalog ([#2573](https://github.com/containous/traefik/pull/2573) by [mmatur](https://github.com/mmatur)) +- **[consulcatalog]** Reload configuration when port change for one service ([#2574](https://github.com/containous/traefik/pull/2574) by [mmatur](https://github.com/mmatur)) +- **[docker,k8s]** Fix Labels/annotation logs and values. ([#2488](https://github.com/containous/traefik/pull/2488) by [ldez](https://github.com/ldez)) +- **[docker,k8s]** Change custom headers separator ([#2509](https://github.com/containous/traefik/pull/2509) by [ldez](https://github.com/ldez)) +- **[docker]** Fix empty IP for backend when dnsrr in Docker swarm mode ([#2490](https://github.com/containous/traefik/pull/2490) by [mmatur](https://github.com/mmatur)) +- **[docker]** Quote template strings ([#2496](https://github.com/containous/traefik/pull/2496) by [dtomcej](https://github.com/dtomcej)) +- **[docker]** Return errors from Docker client.Events ([#2689](https://github.com/containous/traefik/pull/2689) by [BlakeMesdag](https://github.com/BlakeMesdag)) +- **[docker]** Typo in Docker template. ([#2692](https://github.com/containous/traefik/pull/2692) by [ldez](https://github.com/ldez)) +- **[ecs]** Add missing functions for ECS template ([#2312](https://github.com/containous/traefik/pull/2312) by [oldmantaiter](https://github.com/oldmantaiter)) +- **[file,tls]** Send empty configuration from file provider ([#2609](https://github.com/containous/traefik/pull/2609) by [nmengin](https://github.com/nmengin)) +- **[healthcheck]** Fix health check when web is not specified ([#2529](https://github.com/containous/traefik/pull/2529) by [Juliens](https://github.com/Juliens)) +- **[k8s]** Reduce logs with new Kubernetes security annotations ([#2506](https://github.com/containous/traefik/pull/2506) by [ldez](https://github.com/ldez)) +- **[k8s]** Add missing entry points template. ([#2594](https://github.com/containous/traefik/pull/2594) by [ldez](https://github.com/ldez)) +- **[kv]** Fix stickiness bug due to template syntax error ([#2591](https://github.com/containous/traefik/pull/2591) by [dahefanteng](https://github.com/dahefanteng)) +- **[kv]** List entries parsing. ([#2669](https://github.com/containous/traefik/pull/2669) by [ldez](https://github.com/ldez)) +- **[logs]** Fix traefik logs to behave like configured ([#2176](https://github.com/containous/traefik/pull/2176) by [marco-jantke](https://github.com/marco-jantke)) +- **[marathon]** Update go-marathon ([#2585](https://github.com/containous/traefik/pull/2585) by [timoreimann](https://github.com/timoreimann)) +- **[mesos]** Mesos: Use slave.PID.Host as task SlaveIP. ([#2590](https://github.com/containous/traefik/pull/2590) by [nemosupremo](https://github.com/nemosupremo)) +- **[metrics]** Fix breaking change in web metrics ([#2725](https://github.com/containous/traefik/pull/2725) by [Juliens](https://github.com/Juliens)) +- **[metrics]** Do not ignore web params when web.metrics.prometheus is set ([#2499](https://github.com/containous/traefik/pull/2499) by [Juliens](https://github.com/Juliens)) +- **[metrics]** Fix metrics problem on multiple entrypoints ([#2492](https://github.com/containous/traefik/pull/2492) by [Juliens](https://github.com/Juliens)) +- **[metrics]** Fix data races. ([#2287](https://github.com/containous/traefik/pull/2287) by [tcolgate](https://github.com/tcolgate)) +- **[metrics]** Flaky test Influxdb. ([#2386](https://github.com/containous/traefik/pull/2386) by [ldez](https://github.com/ldez)) +- **[middleware,docker,k8s]** Fix custom headers template ([#2621](https://github.com/containous/traefik/pull/2621) by [ldez](https://github.com/ldez)) +- **[middleware]** Don't panic if ResponseWriter does not implement CloseNotify ([#2651](https://github.com/containous/traefik/pull/2651) by [Juliens](https://github.com/Juliens)) +- **[middleware]** GzipResponse must implement CloseNotifier if ResponseWriter implement it ([#2657](https://github.com/containous/traefik/pull/2657) by [Juliens](https://github.com/Juliens)) +- **[middleware]** Fix RawPath handling in addPrefix ([#2560](https://github.com/containous/traefik/pull/2560) by [risdenk](https://github.com/risdenk)) +- **[middleware]** We need to flush the end of the body when retry is streamed ([#2644](https://github.com/containous/traefik/pull/2644) by [Juliens](https://github.com/Juliens)) +- **[provider]** Fix typo in frontend.headers.customresponseheaders label ([#2356](https://github.com/containous/traefik/pull/2356) by [nmandery](https://github.com/nmandery)) +- **[provider]** Fix concurrent provider config reloads ([#2276](https://github.com/containous/traefik/pull/2276) by [marco-jantke](https://github.com/marco-jantke)) +- **[rancher]** Don't reload configuration when rancher server is down ([#2706](https://github.com/containous/traefik/pull/2706) by [wacken89](https://github.com/wacken89)) +- **[rules]** Add non regex pathPrefix ([#2592](https://github.com/containous/traefik/pull/2592) by [emilevauge](https://github.com/emilevauge)) +- **[servicefabric]** Fix backend name for Stateful services. (Service Fabric) ([#2559](https://github.com/containous/traefik/pull/2559) by [ldez](https://github.com/ldez)) +- **[servicefabric]** Fix isHealthy logic. ([#2577](https://github.com/containous/traefik/pull/2577) by [ldez](https://github.com/ldez)) +- **[servicefabric]** Service Fabric 'expose' as boolean. ([#2476](https://github.com/containous/traefik/pull/2476) by [ldez](https://github.com/ldez)) +- **[tls]** Allow deleting dynamically all TLS certificates from an entryPoint ([#2603](https://github.com/containous/traefik/pull/2603) by [nmengin](https://github.com/nmengin)) +- **[websocket]** Disable websocket compression ([#2727](https://github.com/containous/traefik/pull/2727) by [Juliens](https://github.com/Juliens)) +- **[websocket]** Add compression and better error handling ([#2702](https://github.com/containous/traefik/pull/2702) by [Juliens](https://github.com/Juliens)) +- **[websocket]** Use gorilla readMessage and writeMessage instead of just an io.Copy ([#2650](https://github.com/containous/traefik/pull/2650) by [Juliens](https://github.com/Juliens)) +- **[websocket]** RawPath and Transfer TLSConfig in websocket ([#2077](https://github.com/containous/traefik/pull/2077) by [Juliens](https://github.com/Juliens)) +- **[zk]** Change Zookeeper default prefix. ([#2580](https://github.com/containous/traefik/pull/2580) by [ldez](https://github.com/ldez)) +- Fix wrong default entry point and non-existing entry point issue ([#2501](https://github.com/containous/traefik/pull/2501) by [Juliens](https://github.com/Juliens)) +- Fix goroutine leak in throttler logic. ([#2739](https://github.com/containous/traefik/pull/2739) by [timoreimann](https://github.com/timoreimann)) +- Fix timeout integration test ([#2679](https://github.com/containous/traefik/pull/2679) by [ldez](https://github.com/ldez)) +- Fix frontend redirect ([#2544](https://github.com/containous/traefik/pull/2544) by [ldez](https://github.com/ldez)) +- Close ring buffer used in throttling function. ([#2532](https://github.com/containous/traefik/pull/2532) by [timoreimann](https://github.com/timoreimann)) + +**Documentation:** +- **[acme]** Improve documentation for Cloudflare API key ([#2558](https://github.com/containous/traefik/pull/2558) by [mmatur](https://github.com/mmatur)) +- **[acme]** Update Let's Encrypt provider list ([#2347](https://github.com/containous/traefik/pull/2347) by [mmatur](https://github.com/mmatur)) +- **[cluster]** Add a clustering example with Docker Swarm ([#2589](https://github.com/containous/traefik/pull/2589) by [jmaitrehenry](https://github.com/jmaitrehenry)) +- **[consul,consulcatalog]** Split Consul and Consul Catalog documentation ([#2654](https://github.com/containous/traefik/pull/2654) by [ldez](https://github.com/ldez)) +- **[consul]** Improve Consul documentation ([#2485](https://github.com/containous/traefik/pull/2485) by [mmatur](https://github.com/mmatur)) +- **[docker/swarm]** Typo in docker.endpoint TCP port. ([#2626](https://github.com/containous/traefik/pull/2626) by [redhandpl](https://github.com/redhandpl)) +- **[docker]** Fix Docker labels documentation render. ([#2505](https://github.com/containous/traefik/pull/2505) by [ldez](https://github.com/ldez)) +- **[docker]** Add a note on how to add label to a docker compose file ([#2611](https://github.com/containous/traefik/pull/2611) by [jmaitrehenry](https://github.com/jmaitrehenry)) +- **[etcd]** Fix typo in examples ([#2446](https://github.com/containous/traefik/pull/2446) by [dahefanteng](https://github.com/dahefanteng)) +- **[k8s]** Add note to Kubernetes RBAC docs about RoleBindings and namespaces ([#2498](https://github.com/containous/traefik/pull/2498) by [jmara](https://github.com/jmara)) +- **[k8s]** k8s guide: Leave note about assumed DaemonSet usage. ([#2634](https://github.com/containous/traefik/pull/2634) by [timoreimann](https://github.com/timoreimann)) +- **[k8s]** Apply various contentual and stylish improvements to the k8s docs. ([#2677](https://github.com/containous/traefik/pull/2677) by [timoreimann](https://github.com/timoreimann)) +- **[k8s]** Document rewrite-target annotation. ([#2676](https://github.com/containous/traefik/pull/2676) by [timoreimann](https://github.com/timoreimann)) +- **[k8s]** Remove obsolete links in k8s docs ([#2465](https://github.com/containous/traefik/pull/2465) by [marco-jantke](https://github.com/marco-jantke)) +- **[k8s]** Document filename parameter for Kubernetes. ([#2464](https://github.com/containous/traefik/pull/2464) by [timoreimann](https://github.com/timoreimann)) +- **[marathon]** Improve Marathon service label documentation. ([#2635](https://github.com/containous/traefik/pull/2635) by [timoreimann](https://github.com/timoreimann)) +- **[metrics]** Add entrypoint in Prometheus doc and remove web on Influxdb doc ([#2452](https://github.com/containous/traefik/pull/2452) by [Juliens](https://github.com/Juliens)) +- **[provider,webui]** Fix redirect problem on dashboard + docs/tests on [web] ([#2686](https://github.com/containous/traefik/pull/2686) by [Juliens](https://github.com/Juliens)) +- **[servicefabric]** Describe 'refreshSecond' configuration. ([#2471](https://github.com/containous/traefik/pull/2471) by [ldez](https://github.com/ldez)) +- **[tls]** Fix doc dynamic certificates ([#2737](https://github.com/containous/traefik/pull/2737) by [emilevauge](https://github.com/emilevauge)) +- **[tls]** Add link to crypto/tls godoc. ([#2470](https://github.com/containous/traefik/pull/2470) by [ldez](https://github.com/ldez)) +- Move rate limit documentation. ([#2588](https://github.com/containous/traefik/pull/2588) by [ldez](https://github.com/ldez)) +- Grammar ([#2562](https://github.com/containous/traefik/pull/2562) by [geraldcroes](https://github.com/geraldcroes)) +- Fix some doc links ([#2731](https://github.com/containous/traefik/pull/2731) by [eldondev](https://github.com/eldondev)) +- Fix broken links and improve ResponseCodeRatio() description ([#2538](https://github.com/containous/traefik/pull/2538) by [mvasin](https://github.com/mvasin)) +- Fix typo in anonymous usage log message. ([#2711](https://github.com/containous/traefik/pull/2711) by [Yggdrasil](https://github.com/Yggdrasil)) +- Fix typos in changelog ([#2387](https://github.com/containous/traefik/pull/2387) by [ferhatelmas](https://github.com/ferhatelmas)) +- Add mmatur to maintainers ([#2303](https://github.com/containous/traefik/pull/2303) by [emilevauge](https://github.com/emilevauge)) +- Add a note about redirection rule to precise how regex/replacement work. ([#2243](https://github.com/containous/traefik/pull/2243) by [nmengin](https://github.com/nmengin)) +- Add docker things for documentation ([#2020](https://github.com/containous/traefik/pull/2020) by [tcoupin](https://github.com/tcoupin)) +- Prepare release v1.5.0-rc5 ([#2707](https://github.com/containous/traefik/pull/2707) by [mmatur](https://github.com/mmatur)) +- Prepare release v1.5.0-rc4 ([#2656](https://github.com/containous/traefik/pull/2656) by [Juliens](https://github.com/Juliens)) +- Prepare release v1.5.0-rc3 ([#2599](https://github.com/containous/traefik/pull/2599) by [ldez](https://github.com/ldez)) +- Prepare release v1.5.0-rc2 ([#2533](https://github.com/containous/traefik/pull/2533) by [ldez](https://github.com/ldez)) +- Prepare release v1.5.0-rc1 ([#2480](https://github.com/containous/traefik/pull/2480) by [ldez](https://github.com/ldez)) + +**Misc:** +- **[acme]** dumpcerts.sh: Fix call to "base64" for Alpine ([#2344](https://github.com/containous/traefik/pull/2344) by [nknapp](https://github.com/nknapp)) +- **[acme]** dumpcerts.sh: fixed sed, extracted domain keys ([#2161](https://github.com/containous/traefik/pull/2161) by [sjawhar](https://github.com/sjawhar)) +- **[etcd,kv,tls]** Add tests for TLS dynamic configuration in ETCD3 ([#2606](https://github.com/containous/traefik/pull/2606) by [dahefanteng](https://github.com/dahefanteng)) +- Upgrade libkermit/compose version ([#2074](https://github.com/containous/traefik/pull/2074) by [nmengin](https://github.com/nmengin)) +- Merge v1.4.6 into v1.5 ([#2642](https://github.com/containous/traefik/pull/2642) by [ldez](https://github.com/ldez)) +- Merge v1.4.5 into v1.5 ([#2530](https://github.com/containous/traefik/pull/2530) by [mmatur](https://github.com/mmatur)) +- Merge current v1.4 into master ([#2479](https://github.com/containous/traefik/pull/2479) by [ldez](https://github.com/ldez)) +- Merge v1.4.3 into master ([#2415](https://github.com/containous/traefik/pull/2415) by [ldez](https://github.com/ldez)) +- Merge v1.4.4 into master ([#2457](https://github.com/containous/traefik/pull/2457) by [ldez](https://github.com/ldez)) +- Merge v1.4.3 into master ([#2406](https://github.com/containous/traefik/pull/2406) by [ldez](https://github.com/ldez)) +- Revert "Merge v1.4.2 into master" ([#2414](https://github.com/containous/traefik/pull/2414) by [ldez](https://github.com/ldez)) +- Merge v1.4.2 into master ([#2358](https://github.com/containous/traefik/pull/2358) by [ldez](https://github.com/ldez)) +- Merge v1.4.1 into master ([#2318](https://github.com/containous/traefik/pull/2318) by [ldez](https://github.com/ldez)) +- Merge v1.4.0 ([#2271](https://github.com/containous/traefik/pull/2271) by [ldez](https://github.com/ldez)) +- Merge v1.4.0-rc5 into master ([#2242](https://github.com/containous/traefik/pull/2242) by [ldez](https://github.com/ldez)) +- Merge v1.4.0-rc4 into master ([#2202](https://github.com/containous/traefik/pull/2202) by [ldez](https://github.com/ldez)) +- Merge current v1.4 into master ([#2469](https://github.com/containous/traefik/pull/2469) by [ldez](https://github.com/ldez)) +- Merge current v1.4 ([#2154](https://github.com/containous/traefik/pull/2154) by [ldez](https://github.com/ldez)) +- Merge v1.4.0-rc3 into master ([#2140](https://github.com/containous/traefik/pull/2140) by [ldez](https://github.com/ldez)) +- Merge v1.4.0-rc2 into master ([#2092](https://github.com/containous/traefik/pull/2092) by [ldez](https://github.com/ldez)) +- Merge current 1.4 ([#2064](https://github.com/containous/traefik/pull/2064) by [ldez](https://github.com/ldez)) + ## [v1.5.0-rc5](https://github.com/containous/traefik/tree/v1.5.0-rc5) (2018-01-15) [All Commits](https://github.com/containous/traefik/compare/v1.5.0-rc4...v1.5.0-rc5) diff --git a/acme/acme.go b/acme/acme.go index 0599dc864..81ec7a91e 100644 --- a/acme/acme.go +++ b/acme/acme.go @@ -114,6 +114,20 @@ type Domain struct { } func (a *ACME) init() error { + // FIXME temporary fix, waiting for https://github.com/xenolf/lego/pull/478 + acme.HTTPClient = http.Client{ + Transport: &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 15 * time.Second, + ResponseHeaderTimeout: 15 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + }, + } + if a.ACMELogging { acme.Logger = fmtlog.New(os.Stderr, "legolog: ", fmtlog.LstdFlags) } else { diff --git a/autogen/gentemplates/gen.go b/autogen/gentemplates/gen.go index db79073cf..9b963dea7 100644 --- a/autogen/gentemplates/gen.go +++ b/autogen/gentemplates/gen.go @@ -791,9 +791,9 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend {{if $frontend.Redirect}} [frontends."{{$frontendName}}".redirect] - entryPoint = "{{$frontend.RedirectEntryPoint}}" - regex = "{{$frontend.RedirectRegex}}" - replacement = "{{$frontend.RedirectReplacement}}" + entryPoint = "{{$frontend.Redirect.EntryPoint}}" + regex = "{{$frontend.Redirect.Regex}}" + replacement = "{{$frontend.Redirect.Replacement}}" {{end}} {{if $frontend.Headers }} @@ -848,14 +848,14 @@ var _templatesKubernetesTmpl = []byte(`[backends]{{range $backendName, $backend {{end}} {{end}} -{{range $tlsConfiguration := .TLSConfiguration}} -[[tlsConfiguration]] - entryPoints = [{{range $tlsConfiguration.EntryPoints}} +{{range $tls := .TLS}} +[[tls]] + entryPoints = [{{range $tls.EntryPoints}} "{{.}}", {{end}}] - [tlsConfiguration.certificate] - certFile = """{{$tlsConfiguration.Certificate.CertFile}}""" - keyFile = """{{$tlsConfiguration.Certificate.KeyFile}}""" + [tls.certificate] + certFile = """{{$tls.Certificate.CertFile}}""" + keyFile = """{{$tls.Certificate.KeyFile}}""" {{end}} `) @@ -1037,16 +1037,16 @@ var _templatesKvTmpl = []byte(`[backends] {{end}} -{{range $tlsConfiguration := getTLSConfigurations .Prefix }} -[[tlsConfiguration]] +{{range $tls := getTLSSection .Prefix }} +[[tls]] - entryPoints = [{{range $tlsConfiguration.EntryPoints }} + entryPoints = [{{range $tls.EntryPoints }} "{{.}}", {{end}}] - [tlsConfiguration.certificate] - certFile = """{{ $tlsConfiguration.Certificate.CertFile }}""" - keyFile = """{{ $tlsConfiguration.Certificate.KeyFile }}""" + [tls.certificate] + certFile = """{{ $tls.Certificate.CertFile }}""" + keyFile = """{{ $tls.Certificate.KeyFile }}""" {{end}} `) diff --git a/cmd/traefik/configuration.go b/cmd/traefik/configuration.go index 554195d56..fd9da28b6 100644 --- a/cmd/traefik/configuration.go +++ b/cmd/traefik/configuration.go @@ -65,7 +65,8 @@ func NewTraefikDefaultPointersConfiguration() *TraefikConfiguration { // TODO: Deprecated - default Metrics defaultWeb.Metrics = &types.Metrics{ Prometheus: &types.Prometheus{ - Buckets: types.Buckets{0.1, 0.3, 1.2, 5}, + Buckets: types.Buckets{0.1, 0.3, 1.2, 5}, + EntryPoint: configuration.DefaultInternalEntryPointName, }, Datadog: &types.Datadog{ Address: "localhost:8125", @@ -242,7 +243,7 @@ func NewTraefikDefaultPointersConfiguration() *TraefikConfiguration { defaultMetrics := types.Metrics{ Prometheus: &types.Prometheus{ Buckets: types.Buckets{0.1, 0.3, 1.2, 5}, - EntryPoint: "traefik", + EntryPoint: configuration.DefaultInternalEntryPointName, }, Datadog: &types.Datadog{ Address: "localhost:8125", diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go index e29ace4c2..72ef530e6 100644 --- a/cmd/traefik/traefik.go +++ b/cmd/traefik/traefik.go @@ -261,14 +261,14 @@ func stats(globalConfiguration *configuration.GlobalConfiguration) { Stats collection is enabled. Many thanks for contributing to Traefik's improvement by allowing us to receive anonymous information from your configuration. Help us improve Traefik by leaving this feature on :) -More details on: https://docs.traefik.io/basic/#collected-data +More details on: https://docs.traefik.io/basics/#collected-data `) collect(globalConfiguration) } else { log.Info(` Stats collection is disabled. Help us improve Traefik by turning this feature on :) -More details on: https://docs.traefik.io/basic/#collected-data +More details on: https://docs.traefik.io/basics/#collected-data `) } } diff --git a/docs/archive.md b/docs/archive.md deleted file mode 100644 index 6f6c323ae..000000000 --- a/docs/archive.md +++ /dev/null @@ -1,23 +0,0 @@ -## Current versions documentation - -- [Latest stable](https://docs.traefik.io) - -## Future version documentation - -- [Experimental](https://master--traefik-docs.netlify.com/) - -## Previous versions documentation - -- [v1.5 aka Cancoillotte](http://v1-5.archive.docs.traefik.io/) - -- [v1.4 aka Roquefort](http://v1-4.archive.docs.traefik.io/) - -- [v1.3 aka Raclette](http://v1-3.archive.docs.traefik.io/) - -- [v1.2 aka Morbier](http://v1-2.archive.docs.traefik.io/) - -- [v1.1 aka Camembert](http://v1-1.archive.docs.traefik.io/) - -## More - -[Change log](https://github.com/containous/traefik/blob/master/CHANGELOG.md) diff --git a/docs/configuration/backends/file.md b/docs/configuration/backends/file.md index 9a23703bd..3424bdbe4 100644 --- a/docs/configuration/backends/file.md +++ b/docs/configuration/backends/file.md @@ -84,15 +84,21 @@ defaultEntryPoints = ["http", "https"] rule = "Path:/test" # HTTPS certificate -[[tlsConfiguration]] -entryPoints = ["https"] - [tlsConfiguration.certificate] - certFile = "integration/fixtures/https/snitest.com.cert" - keyFile = "integration/fixtures/https/snitest.com.key" +[[tls]] + entryPoints = ["https"] + [tls.certificate] + certFile = "path/to/my.cert" + keyFile = "path/to/my.key" + +[[tls]] + entryPoints = ["https"] + [tls.certificate] + certFile = "path/to/my/other.cert" + keyFile = "path/to/my/other.key" ``` !!! note - If `tlsConfiguration.entryPoints` is not defined, the certificate is attached to all the `defaultEntryPoints` with a TLS configuration. + If `tls.entryPoints` is not defined, the certificate is attached to all the `defaultEntryPoints` with a TLS configuration. !!! note Adding certificates directly to the entryPoint is still maintained but certificates declared in this way cannot be managed dynamically. @@ -160,18 +166,17 @@ filename = "rules.toml" rule = "Path:/test" # HTTPS certificate -[[tlsConfiguration]] +[[tls]] entryPoints = ["https"] - [tlsConfiguration.certificate] - certFile = "integration/fixtures/https/snitest.com.cert" - keyFile = "integration/fixtures/https/snitest.com.key" - -[[tlsConfiguration]] + [tls.certificate] + certFile = "path/to/my.cert" + keyFile = "path/to/my.key" + +[[tls]] entryPoints = ["https"] - [[tlsConfiguration.certificates]] - certFile = "integration/fixtures/https/snitest.org.cert" - keyFile = "integration/fixtures/https/snitest.org.key" -``` + [tls.certificate] + certFile = "path/to/my/other.cert" + keyFile = "path/to/my/other.key" ## Multiple `.toml` Files diff --git a/docs/configuration/entrypoints.md b/docs/configuration/entrypoints.md index a9b949f9b..878e34ee4 100644 --- a/docs/configuration/entrypoints.md +++ b/docs/configuration/entrypoints.md @@ -55,6 +55,8 @@ To redirect an entrypoint rewriting the URL. ## TLS +### Static Certificates + Define an entrypoint with SNI support. ```toml @@ -69,6 +71,12 @@ Define an entrypoint with SNI support. !!! note If an empty TLS configuration is done, default self-signed certificates are generated. + + +### Dynamic Certificates + +If you need to add or remove TLS certificates while Traefik is started, Dynamic TLS certificates are supported using the [file provider](/configuration/backends/file). + ## TLS Mutual Authentication diff --git a/docs/user-guide/kv-config.md b/docs/user-guide/kv-config.md index 07e6ed777..db2c551b0 100644 --- a/docs/user-guide/kv-config.md +++ b/docs/user-guide/kv-config.md @@ -274,13 +274,14 @@ Here is the toml configuration we would like to store in the store : backend = "backend2" rule = "Path:/test" -[[tlsConfiguration]] - [tlsConfiguration.certificate] +[[tls]] + [tls.certificate] certFile = "path/to/your.cert" keyFile = "path/to/your.key" -[[tlsConfiguration]] -entryPoints = ["https","other-https"] - [tlsConfiguration.certificate] + +[[tls]] + entryPoints = ["https","other-https"] + [tls.certificate] certFile = """-----BEGIN CERTIFICATE----- -----END CERTIFICATE-----""" @@ -334,21 +335,21 @@ And there, the same dynamic configuration in a KV Store (using `prefix = "traefi - certificate 1 -| Key | Value | -|----------------------------------------------------|--------------------| -| `/traefik/tlsconfiguration/1/certificate/certfile` | `path/to/your.cert`| -| `/traefik/tlsconfiguration/1/certificate/keyfile` | `path/to/your.key` | +| Key | Value | +|---------------------------------------|--------------------| +| `/traefik/tls/1/certificate/certfile` | `path/to/your.cert`| +| `/traefik/tls/1/certificate/keyfile` | `path/to/your.key` | !!! note - As `/traefik/tlsconfiguration/1/entrypoints` is not defined, the certificate will be attached to all `defaulEntryPoints` with a TLS configuration (in the example, the entryPoint `https`) + As `/traefik/tls/1/entrypoints` is not defined, the certificate will be attached to all `defaulEntryPoints` with a TLS configuration (in the example, the entryPoint `https`) - certificate 2 -| Key | Value | -|----------------------------------------------------|-----------------------| -| `/traefik/tlsconfiguration/2/entrypoints` | `https,other-https` | -| `/traefik/tlsconfiguration/2/certificate/certfile` | `` | -| `/traefik/tlsconfiguration/2/certificate/certfile` | `` | +| Key | Value | +|---------------------------------------|-----------------------| +| `/traefik/tls/2/entrypoints` | `https,other-https` | +| `/traefik/tls/2/certificate/certfile` | `` | +| `/traefik/tls/2/certificate/certfile` | `` | ### Atomic configuration changes @@ -409,7 +410,7 @@ Here, we have a 50% balance between the `http://172.17.0.3:80` and the `http://1 ## Store configuration in Key-value store !!! note - Don't forget to [setup the connection between Træfik and Key-value store](/user-guide/kv-config/#launch-trfk). + Don't forget to [setup the connection between Træfik and Key-value store](/user-guide/kv-config/#launch-trfik). The static Træfik configuration in a key-value store can be automatically created and updated, using the [`storeconfig` subcommand](/basics/#commands). @@ -417,7 +418,7 @@ The static Træfik configuration in a key-value store can be automatically creat traefik storeconfig [flags] ... ``` This command is here only to automate the [process which upload the configuration into the Key-value store](/user-guide/kv-config/#upload-the-configuration-in-the-key-value-store). -Træfik will not start but the [static configuration](/basics/#static-trfk-configuration) will be uploaded into the Key-value store. +Træfik will not start but the [static configuration](/basics/#static-trfik-configuration) will be uploaded into the Key-value store. If you configured ACME (Let's Encrypt), your registration account and your certificates will also be uploaded. diff --git a/examples/consul-config.sh b/examples/consul-config.sh index 94509e710..ee9066eeb 100755 --- a/examples/consul-config.sh +++ b/examples/consul-config.sh @@ -26,11 +26,11 @@ curl -i -H "Accept: application/json" -X PUT -d "Path:/test" ht # certificate 1 -curl -i -H "Accept: application/json" -X PUT -d "https" http://localhost:8500/v1/kv/traefik/tlsconfiguration/pair1/entrypoints -curl -i -H "Accept: application/json" -X PUT -d "/tmp/test1.crt" http://localhost:8500/v1/kv/traefik/tlsconfiguration/pair1/certificate/certfile -curl -i -H "Accept: application/json" -X PUT -d "/tmp/test1.key" http://localhost:8500/v1/kv/traefik/tlsconfiguration/pair1/certificate/keyfile +curl -i -H "Accept: application/json" -X PUT -d "https" http://localhost:8500/v1/kv/traefik/tls/pair1/entrypoints +curl -i -H "Accept: application/json" -X PUT -d "/tmp/test1.crt" http://localhost:8500/v1/kv/traefik/tls/pair1/certificate/certfile +curl -i -H "Accept: application/json" -X PUT -d "/tmp/test1.key" http://localhost:8500/v1/kv/traefik/tls/pair1/certificate/keyfile # certificate 2 -curl -i -H "Accept: application/json" -X PUT -d "http,https" http://localhost:8500/v1/kv/traefik/tlsconfiguration/pair2/entrypoints -curl -i -H "Accept: application/json" -X PUT -d "/tmp/test2.crt" http://localhost:8500/v1/kv/traefik/tlsconfiguration/pair2/certificate/certfile -curl -i -H "Accept: application/json" -X PUT -d "/tmp/test2.key" http://localhost:8500/v1/kv/traefik/tlsconfiguration/pair2/certificate/keyfile +curl -i -H "Accept: application/json" -X PUT -d "http,https" http://localhost:8500/v1/kv/traefik/tls/pair2/entrypoints +curl -i -H "Accept: application/json" -X PUT -d "/tmp/test2.crt" http://localhost:8500/v1/kv/traefik/tls/pair2/certificate/certfile +curl -i -H "Accept: application/json" -X PUT -d "/tmp/test2.key" http://localhost:8500/v1/kv/traefik/tls/pair2/certificate/keyfile diff --git a/examples/etcd-config.sh b/examples/etcd-config.sh index 6a5279957..0bb0b69c7 100755 --- a/examples/etcd-config.sh +++ b/examples/etcd-config.sh @@ -28,14 +28,14 @@ function insert_etcd2_data() { curl -i -H "Accept: application/json" -X PUT -d value="Path:/test" http://localhost:2379/v2/keys/traefik/frontends/frontend2/routes/test_2/rule # certificate 1 - curl -i -H "Accept: application/json" -X PUT -d value="https" http://localhost:2379/v2/keys/traefik/tlsconfiguration/pair1/entrypoints - curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test1.crt" http://localhost:2379/v2/keys/traefik/tlsconfiguration/pair1/certificate/certfile - curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test1.key" http://localhost:2379/v2/keys/traefik/tlsconfiguration/pair1/certificate/keyfile + curl -i -H "Accept: application/json" -X PUT -d value="https" http://localhost:2379/v2/keys/traefik/tls/pair1/entrypoints + curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test1.crt" http://localhost:2379/v2/keys/traefik/tls/pair1/certificate/certfile + curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test1.key" http://localhost:2379/v2/keys/traefik/tls/pair1/certificate/keyfile # certificate 2 - curl -i -H "Accept: application/json" -X PUT -d value="http,https" http://localhost:2379/v2/keys/traefik/tlsconfiguration/pair2/entrypoints - curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test2.crt" http://localhost:2379/v2/keys/traefik/tlsconfiguration/pair2/certificate/certfile - curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test2.key" http://localhost:2379/v2/keys/traefik/tlsconfiguration/pair2/certificate/keyfile + curl -i -H "Accept: application/json" -X PUT -d value="http,https" http://localhost:2379/v2/keys/traefik/tls/pair2/entrypoints + curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test2.crt" http://localhost:2379/v2/keys/traefik/tls/pair2/certificate/certfile + curl -i -H "Accept: application/json" -X PUT -d value="/tmp/test2.key" http://localhost:2379/v2/keys/traefik/tls/pair2/certificate/keyfile } # @@ -71,14 +71,14 @@ function insert_etcd3_data() { docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/frontends/frontend2/routes/test_2/rule" "Path:/test" # certificate 1 - docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tlsconfiguration/pair1/entrypoints" "https" - docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tlsconfiguration/pair1/certificate/certfile" "/tmp/test1.crt" - docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tlsconfiguration/pair1/certificate/keyfile" "/tmp/test1.key" + docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tls/pair1/entrypoints" "https" + docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tls/pair1/certificate/certfile" "/tmp/test1.crt" + docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tls/pair1/certificate/keyfile" "/tmp/test1.key" # certificate 2 - docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tlsconfiguration/pair2/entrypoints" "https" - docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tlsconfiguration/pair2/certificate/certfile" "/tmp/test2.crt" - docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tlsconfiguration/pair2/certificate/keyfile" "/tmp/test2.key" + docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tls/pair2/entrypoints" "https" + docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tls/pair2/certificate/certfile" "/tmp/test2.crt" + docker container run --rm -ti -e ETCDCTL_DIAL_="TIMEOUT 10s" -e ETCDCTL_API="3" tenstartups/etcdctl --endpoints=[$etcd_ip:2379] put "/traefik/tls/pair2/certificate/keyfile" "/tmp/test2.key" } function show_usage() { diff --git a/integration/acme_test.go b/integration/acme_test.go index 078d9c230..a5474c8a0 100644 --- a/integration/acme_test.go +++ b/integration/acme_test.go @@ -92,6 +92,16 @@ func (s *AcmeSuite) TestOnHostRuleRetrieveAcmeCertificateHTTP01(c *check.C) { s.retrieveAcmeCertificate(c, testCase) } +// Test OnHostRule option with none provided certificate and challenge HTTP-01 and web path +func (s *AcmeSuite) TestOnHostRuleRetrieveAcmeCertificateHTTP01WithPath(c *check.C) { + testCase := AcmeTestCase{ + traefikConfFilePath: "fixtures/acme/acme_http01_web.toml", + onDemand: false, + domainToCheck: acmeDomain} + + s.retrieveAcmeCertificate(c, testCase) +} + // Test OnDemand option with a wildcard provided certificate func (s *AcmeSuite) TestOnDemandRetrieveAcmeCertificateWithWildcard(c *check.C) { testCase := AcmeTestCase{ diff --git a/integration/basic_test.go b/integration/basic_test.go index ec949d848..a1a6b0195 100644 --- a/integration/basic_test.go +++ b/integration/basic_test.go @@ -336,3 +336,25 @@ func (s *SimpleSuite) TestWithUnexistingEntrypoint(c *check.C) { err = try.GetRequest("http://127.0.0.1:8000/whoami", 1*time.Second, try.StatusCodeIs(http.StatusOK)) c.Assert(err, checker.IsNil) } + +func (s *SimpleSuite) TestMetricsPrometheusDefaultEntrypoint(c *check.C) { + + s.createComposeProject(c, "base") + s.composeProject.Start(c) + + cmd, output := s.traefikCmd("--defaultEntryPoints=http", "--entryPoints=Name:http Address::8000", "--web", "--web.metrics.prometheus.buckets=0.1,0.3,1.2,5.0", "--docker", "--debug") + defer output(c) + + err := cmd.Start() + c.Assert(err, checker.IsNil) + defer cmd.Process.Kill() + + err = try.GetRequest("http://127.0.0.1:8080/api/providers", 1*time.Second, try.BodyContains("PathPrefix")) + c.Assert(err, checker.IsNil) + + err = try.GetRequest("http://127.0.0.1:8000/whoami", 1*time.Second, try.StatusCodeIs(http.StatusOK)) + c.Assert(err, checker.IsNil) + + err = try.GetRequest("http://127.0.0.1:8080/metrics", 1*time.Second, try.StatusCodeIs(http.StatusOK)) + c.Assert(err, checker.IsNil) +} diff --git a/integration/consul_test.go b/integration/consul_test.go index d2178e47e..b404ae57f 100644 --- a/integration/consul_test.go +++ b/integration/consul_test.go @@ -564,15 +564,15 @@ func (s *ConsulSuite) TestSNIDynamicTlsConfig(c *check.C) { } tlsconfigure1 := map[string]string{ - "traefik/tlsconfiguration/snitestcom/entrypoints": "https", - "traefik/tlsconfiguration/snitestcom/certificate/keyfile": string(snitestComKey), - "traefik/tlsconfiguration/snitestcom/certificate/certfile": string(snitestComCert), + "traefik/tls/snitestcom/entrypoints": "https", + "traefik/tls/snitestcom/certificate/keyfile": string(snitestComKey), + "traefik/tls/snitestcom/certificate/certfile": string(snitestComCert), } tlsconfigure2 := map[string]string{ - "traefik/tlsconfiguration/snitestorg/entrypoints": "https", - "traefik/tlsconfiguration/snitestorg/certificate/keyfile": string(snitestOrgKey), - "traefik/tlsconfiguration/snitestorg/certificate/certfile": string(snitestOrgCert), + "traefik/tls/snitestorg/entrypoints": "https", + "traefik/tls/snitestorg/certificate/keyfile": string(snitestOrgKey), + "traefik/tls/snitestorg/certificate/certfile": string(snitestOrgCert), } // config backends,frontends and first tls keypair @@ -613,7 +613,7 @@ func (s *ConsulSuite) TestSNIDynamicTlsConfig(c *check.C) { // wait for consul err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("traefik/tlsconfiguration/snitestcom/certificate/keyfile", nil) + _, err := s.kv.Get("traefik/tls/snitestcom/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) @@ -642,7 +642,7 @@ func (s *ConsulSuite) TestSNIDynamicTlsConfig(c *check.C) { // wait for consul err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("traefik/tlsconfiguration/snitestorg/certificate/keyfile", nil) + _, err := s.kv.Get("traefik/tls/snitestorg/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) diff --git a/integration/etcd3_test.go b/integration/etcd3_test.go index 9c4dd8ed0..04bf068ef 100644 --- a/integration/etcd3_test.go +++ b/integration/etcd3_test.go @@ -474,15 +474,15 @@ func (s *Etcd3Suite) TestSNIDynamicTlsConfig(c *check.C) { } tlsconfigure1 := map[string]string{ - "/traefik/tlsconfiguration/snitestcom/entrypoints": "https", - "/traefik/tlsconfiguration/snitestcom/certificate/keyfile": string(snitestComKey), - "/traefik/tlsconfiguration/snitestcom/certificate/certfile": string(snitestComCert), + "/traefik/tls/snitestcom/entrypoints": "https", + "/traefik/tls/snitestcom/certificate/keyfile": string(snitestComKey), + "/traefik/tls/snitestcom/certificate/certfile": string(snitestComCert), } tlsconfigure2 := map[string]string{ - "/traefik/tlsconfiguration/snitestorg/entrypoints": "https", - "/traefik/tlsconfiguration/snitestorg/certificate/keyfile": string(snitestOrgKey), - "/traefik/tlsconfiguration/snitestorg/certificate/certfile": string(snitestOrgCert), + "/traefik/tls/snitestorg/entrypoints": "https", + "/traefik/tls/snitestorg/certificate/keyfile": string(snitestOrgKey), + "/traefik/tls/snitestorg/certificate/certfile": string(snitestOrgCert), } // config backends,frontends and first tls keypair @@ -523,7 +523,7 @@ func (s *Etcd3Suite) TestSNIDynamicTlsConfig(c *check.C) { // wait for etcd err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("/traefik/tlsconfiguration/snitestcom/certificate/keyfile", nil) + _, err := s.kv.Get("/traefik/tls/snitestcom/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) @@ -557,7 +557,7 @@ func (s *Etcd3Suite) TestSNIDynamicTlsConfig(c *check.C) { // wait for etcd err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("/traefik/tlsconfiguration/snitestorg/certificate/keyfile", nil) + _, err := s.kv.Get("/traefik/tls/snitestorg/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) @@ -609,9 +609,9 @@ func (s *Etcd3Suite) TestDeleteSNIDynamicTlsConfig(c *check.C) { } tlsconfigure1 := map[string]string{ - "/traefik/tlsconfiguration/snitestcom/entrypoints": "https", - "/traefik/tlsconfiguration/snitestcom/certificate/keyfile": string(snitestComKey), - "/traefik/tlsconfiguration/snitestcom/certificate/certfile": string(snitestComCert), + "/traefik/tls/snitestcom/entrypoints": "https", + "/traefik/tls/snitestcom/certificate/keyfile": string(snitestComKey), + "/traefik/tls/snitestcom/certificate/certfile": string(snitestComCert), } // config backends,frontends and first tls keypair @@ -637,7 +637,7 @@ func (s *Etcd3Suite) TestDeleteSNIDynamicTlsConfig(c *check.C) { // wait for etcd err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("/traefik/tlsconfiguration/snitestcom/certificate/keyfile", nil) + _, err := s.kv.Get("/traefik/tls/snitestcom/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) diff --git a/integration/etcd_test.go b/integration/etcd_test.go index 856d3814a..4368b2a64 100644 --- a/integration/etcd_test.go +++ b/integration/etcd_test.go @@ -490,15 +490,15 @@ func (s *EtcdSuite) TestSNIDynamicTlsConfig(c *check.C) { } tlsconfigure1 := map[string]string{ - "/traefik/tlsconfiguration/snitestcom/entrypoints": "https", - "/traefik/tlsconfiguration/snitestcom/certificate/keyfile": string(snitestComKey), - "/traefik/tlsconfiguration/snitestcom/certificate/certfile": string(snitestComCert), + "/traefik/tls/snitestcom/entrypoints": "https", + "/traefik/tls/snitestcom/certificate/keyfile": string(snitestComKey), + "/traefik/tls/snitestcom/certificate/certfile": string(snitestComCert), } tlsconfigure2 := map[string]string{ - "/traefik/tlsconfiguration/snitestorg/entrypoints": "https", - "/traefik/tlsconfiguration/snitestorg/certificate/keyfile": string(snitestOrgKey), - "/traefik/tlsconfiguration/snitestorg/certificate/certfile": string(snitestOrgCert), + "/traefik/tls/snitestorg/entrypoints": "https", + "/traefik/tls/snitestorg/certificate/keyfile": string(snitestOrgKey), + "/traefik/tls/snitestorg/certificate/certfile": string(snitestOrgCert), } // config backends,frontends and first tls keypair @@ -539,7 +539,7 @@ func (s *EtcdSuite) TestSNIDynamicTlsConfig(c *check.C) { // wait for etcd err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("/traefik/tlsconfiguration/snitestcom/certificate/keyfile", nil) + _, err := s.kv.Get("/traefik/tls/snitestcom/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) @@ -573,7 +573,7 @@ func (s *EtcdSuite) TestSNIDynamicTlsConfig(c *check.C) { // wait for etcd err = try.Do(60*time.Second, func() error { - _, err := s.kv.Get("/traefik/tlsconfiguration/snitestorg/certificate/keyfile", nil) + _, err := s.kv.Get("/traefik/tls/snitestorg/certificate/keyfile", nil) return err }) c.Assert(err, checker.IsNil) diff --git a/integration/fixtures/acme/acme_http01_web.toml b/integration/fixtures/acme/acme_http01_web.toml new file mode 100644 index 000000000..346af1e63 --- /dev/null +++ b/integration/fixtures/acme/acme_http01_web.toml @@ -0,0 +1,38 @@ +logLevel = "DEBUG" + +defaultEntryPoints = ["http", "https"] + +[entryPoints] + [entryPoints.http] + address = ":5002" + [entryPoints.https] + address = ":5001" + [entryPoints.https.tls] + + +[web] +path="/traefik" + +[acme] +email = "test@traefik.io" +storage = "/dev/null" +entryPoint = "https" +onDemand = {{.OnDemand}} +OnHostRule = {{.OnHostRule}} +caServer = "http://{{.BoulderHost}}:4000/directory" +[acme.httpchallenge] +entrypoint="http" + +[file] + +[backends] + [backends.backend] + [backends.backend.servers.server1] + url = "http://127.0.0.1:9010" + + +[frontends] + [frontends.frontend] + backend = "backend" + [frontends.frontend.routes.test] + rule = "Host:traefik.acme.wtf" diff --git a/integration/fixtures/acme/certificates.toml b/integration/fixtures/acme/certificates.toml index 5e0693f96..c0bdc831b 100644 --- a/integration/fixtures/acme/certificates.toml +++ b/integration/fixtures/acme/certificates.toml @@ -9,8 +9,8 @@ [frontends.frontend.routes.test] rule = "Host:traefik.acme.wtf" -[[tlsConfiguration]] +[[tls]] entryPoints = ["https"] - [tlsConfiguration.certificate] + [tls.certificate] certFile = "fixtures/acme/ssl/wildcard.crt" keyFile = "fixtures/acme/ssl/wildcard.key" \ No newline at end of file diff --git a/integration/fixtures/https/dynamic_https.toml b/integration/fixtures/https/dynamic_https.toml index aa513ba6d..ad530081a 100644 --- a/integration/fixtures/https/dynamic_https.toml +++ b/integration/fixtures/https/dynamic_https.toml @@ -16,9 +16,9 @@ [frontends.frontend2.routes.test_2] rule = "Host:snitest.org" -[[tlsConfiguration]] +[[tls]] entryPoints = ["https"] - [tlsConfiguration.certificate] + [tls.certificate] certFile = """-----BEGIN CERTIFICATE----- MIIC/zCCAeegAwIBAgIJALAYHG/vGqWEMA0GCSqGSIb3DQEBBQUAMBYxFDASBgNV BAMMC3NuaXRlc3Qub3JnMB4XDTE1MTEyMzIyMDU0NFoXDTI1MTEyMDIyMDU0NFow diff --git a/integration/fixtures/tracing/simple.toml b/integration/fixtures/tracing/simple.toml index 3b41dfb98..b7bbb79cf 100644 --- a/integration/fixtures/tracing/simple.toml +++ b/integration/fixtures/tracing/simple.toml @@ -3,7 +3,7 @@ defaultEntryPoints = ["http"] logLevel = "DEBUG" debug = true -[web] +[api] [entryPoints] [entryPoints.http] diff --git a/integration/https_test.go b/integration/https_test.go index 2582dfcda..533b16fc2 100644 --- a/integration/https_test.go +++ b/integration/https_test.go @@ -525,7 +525,7 @@ func (s *HTTPSSuite) TestWithSNIDynamicConfigRouteWithChange(c *check.C) { c.Assert(resp.StatusCode, checker.Equals, http.StatusNotFound) } -// TestWithSNIDynamicConfigRouteWithChangeForEmptyTlsConfiguration involves a client sending HTTPS requests with +// TestWithSNIDynamicConfigRouteWithTlsConfigurationDeletion involves a client sending HTTPS requests with // SNI hostnames of "snitest.org" and "snitest.com". The test verifies // that traefik updates its configuration when the HTTPS configuration is modified, even if it totally deleted, and // it routes the requests to the expected backends thanks to given certificate if possible @@ -624,7 +624,7 @@ func modifyCertificateConfFileContent(c *check.C, certFileName, confFileName, en // If certificate file is not provided, just truncate the configuration file if len(certFileName) > 0 { tlsConf := types.Configuration{ - TLSConfiguration: []*traefikTls.Configuration{ + TLS: []*traefikTls.Configuration{ { Certificate: &traefikTls.Certificate{ CertFile: traefikTls.FileOrContent("fixtures/https/" + certFileName + ".cert"), diff --git a/integration/tracing_test.go b/integration/tracing_test.go index d24cc79ce..6216cb74c 100644 --- a/integration/tracing_test.go +++ b/integration/tracing_test.go @@ -129,6 +129,9 @@ func (s *TracingSuite) TestZipkinAuth(c *check.C) { c.Assert(err, checker.IsNil) defer cmd.Process.Kill() + err = try.GetRequest("http://127.0.0.1:8080/api", 1*time.Second, try.StatusCodeIs(http.StatusOK)) + c.Assert(err, checker.IsNil) + err = try.GetRequest("http://127.0.0.1:8000/auth", 500*time.Millisecond, try.StatusCodeIs(http.StatusUnauthorized)) c.Assert(err, checker.IsNil) diff --git a/mkdocs.yml b/mkdocs.yml index 0dd67ebe7..88d1d9cbc 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -101,4 +101,3 @@ pages: - 'gRPC Example': 'user-guide/grpc.md' - 'Traefik cluster example with Swarm': 'user-guide/cluster-docker-consul.md' - Benchmarks: benchmarks.md - - 'Archive': 'archive.md' diff --git a/provider/file/file.go b/provider/file/file.go index e33d0141a..137b20cf3 100644 --- a/provider/file/file.go +++ b/provider/file/file.go @@ -186,7 +186,7 @@ func loadFileConfigFromDirectory(directory string, configuration *types.Configur } } - for _, conf := range c.TLSConfiguration { + for _, conf := range c.TLS { if _, exists := configTLSMaps[conf]; exists { log.Warnf("TLS Configuration %v already configured, skipping", conf) } else { @@ -196,7 +196,7 @@ func loadFileConfigFromDirectory(directory string, configuration *types.Configur } for conf := range configTLSMaps { - configuration.TLSConfiguration = append(configuration.TLSConfiguration, conf) + configuration.TLS = append(configuration.TLS, conf) } return configuration, nil } diff --git a/provider/file/file_test.go b/provider/file/file_test.go index af622d741..649fc32ae 100644 --- a/provider/file/file_test.go +++ b/provider/file/file_test.go @@ -26,7 +26,7 @@ func TestProvideSingleFileAndWatch(t *testing.T) { tempDir, "simple.toml", createFrontendConfiguration(expectedNumFrontends), createBackendConfiguration(expectedNumBackends), - createTLSConfiguration(expectedNumTLSConf)) + createTLS(expectedNumTLSConf)) configurationChan, signal := createConfigurationRoutine(t, &expectedNumFrontends, &expectedNumBackends, &expectedNumTLSConf) @@ -45,7 +45,7 @@ func TestProvideSingleFileAndWatch(t *testing.T) { tempDir, "simple.toml", createFrontendConfiguration(expectedNumFrontends), createBackendConfiguration(expectedNumBackends), - createTLSConfiguration(expectedNumTLSConf)) + createTLS(expectedNumTLSConf)) err = waitForSignal(signal, 2*time.Second, "single frontend, backend, TLS configuration") assert.NoError(t, err) @@ -63,7 +63,7 @@ func TestProvideSingleFileAndNotWatch(t *testing.T) { tempDir, "simple.toml", createFrontendConfiguration(expectedNumFrontends), createBackendConfiguration(expectedNumBackends), - createTLSConfiguration(expectedNumTLSConf)) + createTLS(expectedNumTLSConf)) configurationChan, signal := createConfigurationRoutine(t, &expectedNumFrontends, &expectedNumBackends, &expectedNumTLSConf) @@ -82,7 +82,7 @@ func TestProvideSingleFileAndNotWatch(t *testing.T) { tempDir, "simple.toml", createFrontendConfiguration(expectedNumFrontends), createBackendConfiguration(expectedNumBackends), - createTLSConfiguration(expectedNumTLSConf)) + createTLS(expectedNumTLSConf)) // Must fail because we don't watch the changes err = waitForSignal(signal, 2*time.Second, "single frontend, backend and TLS configuration") @@ -99,7 +99,7 @@ func TestProvideDirectoryAndWatch(t *testing.T) { tempFile1 := createRandomFile(t, tempDir, createFrontendConfiguration(expectedNumFrontends)) tempFile2 := createRandomFile(t, tempDir, createBackendConfiguration(expectedNumBackends)) - tempFile3 := createRandomFile(t, tempDir, createTLSConfiguration(expectedNumTLSConf)) + tempFile3 := createRandomFile(t, tempDir, createTLS(expectedNumTLSConf)) configurationChan, signal := createConfigurationRoutine(t, &expectedNumFrontends, &expectedNumBackends, &expectedNumTLSConf) @@ -145,7 +145,7 @@ func TestProvideDirectoryAndNotWatch(t *testing.T) { createRandomFile(t, tempDir, createFrontendConfiguration(expectedNumFrontends)) tempFile2 := createRandomFile(t, tempDir, createBackendConfiguration(expectedNumBackends)) - createRandomFile(t, tempTLSDir, createTLSConfiguration(expectedNumTLSConf)) + createRandomFile(t, tempTLSDir, createTLS(expectedNumTLSConf)) configurationChan, signal := createConfigurationRoutine(t, &expectedNumFrontends, &expectedNumBackends, &expectedNumTLSConf) @@ -167,7 +167,7 @@ func TestProvideDirectoryAndNotWatch(t *testing.T) { } -func createConfigurationRoutine(t *testing.T, expectedNumFrontends *int, expectedNumBackends *int, expectedNumTLSConfigurations *int) (chan types.ConfigMessage, chan interface{}) { +func createConfigurationRoutine(t *testing.T, expectedNumFrontends *int, expectedNumBackends *int, expectedNumTLSes *int) (chan types.ConfigMessage, chan interface{}) { configurationChan := make(chan types.ConfigMessage) signal := make(chan interface{}) @@ -177,7 +177,7 @@ func createConfigurationRoutine(t *testing.T, expectedNumFrontends *int, expecte assert.Equal(t, "file", data.ProviderName) assert.Len(t, data.Configuration.Frontends, *expectedNumFrontends) assert.Len(t, data.Configuration.Backends, *expectedNumBackends) - assert.Len(t, data.Configuration.TLSConfiguration, *expectedNumTLSConfigurations) + assert.Len(t, data.Configuration.TLS, *expectedNumTLSes) signal <- nil } }) @@ -297,13 +297,13 @@ func createBackendConfiguration(n int) string { return conf } -// createTLSConfiguration Helper -func createTLSConfiguration(n int) string { +// createTLS Helper +func createTLS(n int) string { var conf string for i := 1; i <= n; i++ { - conf += fmt.Sprintf(`[[TLSConfiguration]] + conf += fmt.Sprintf(`[[TLS]] EntryPoints = ["https"] - [TLSConfiguration.Certificate] + [TLS.Certificate] CertFile = "integration/fixtures/https/snitest%[1]d.com.cert" KeyFile = "integration/fixtures/https/snitest%[1]d.com.key" `, i) diff --git a/provider/kubernetes/builder_configuration_test.go b/provider/kubernetes/builder_configuration_test.go index f673b5e91..d162571b3 100644 --- a/provider/kubernetes/builder_configuration_test.go +++ b/provider/kubernetes/builder_configuration_test.go @@ -202,17 +202,17 @@ func route(name string, rule string) func(*types.Route) string { } } -func tlsConfigurations(opts ...func(*tls.Configuration)) func(*types.Configuration) { +func tlsesSection(opts ...func(*tls.Configuration)) func(*types.Configuration) { return func(c *types.Configuration) { for _, opt := range opts { tlsConf := &tls.Configuration{} opt(tlsConf) - c.TLSConfiguration = append(c.TLSConfiguration, tlsConf) + c.TLS = append(c.TLS, tlsConf) } } } -func tlsConfiguration(opts ...func(*tls.Configuration)) func(*tls.Configuration) { +func tlsSection(opts ...func(*tls.Configuration)) func(*tls.Configuration) { return func(c *tls.Configuration) { for _, opt := range opts { opt(c) @@ -281,8 +281,8 @@ func TestBuildConfiguration(t *testing.T) { ), ), ), - tlsConfigurations( - tlsConfiguration( + tlsesSection( + tlsSection( tlsEntryPoints("https"), certificate("certificate", "key"), ), @@ -375,7 +375,7 @@ func sampleConfiguration() *types.Configuration { }, }, }, - TLSConfiguration: []*tls.Configuration{ + TLS: []*tls.Configuration{ { EntryPoints: []string{"https"}, Certificate: &tls.Certificate{ diff --git a/provider/kubernetes/kubernetes.go b/provider/kubernetes/kubernetes.go index 75d6464af..7c440bfc6 100644 --- a/provider/kubernetes/kubernetes.go +++ b/provider/kubernetes/kubernetes.go @@ -175,12 +175,12 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error) continue } - tlsConfigs, err := getTLSConfigurations(i, k8sClient) + tlsSection, err := getTLS(i, k8sClient) if err != nil { log.Errorf("Error configuring TLS for ingress %s/%s: %v", i.Namespace, i.Name, err) continue } - templateObjects.TLSConfiguration = append(templateObjects.TLSConfiguration, tlsConfigs...) + templateObjects.TLS = append(templateObjects.TLS, tlsSection...) for _, r := range i.Spec.Rules { if r.HTTP == nil { @@ -449,7 +449,7 @@ func loadAuthCredentials(namespace, secretName string, k8sClient Client) ([]stri return creds, nil } -func getTLSConfigurations(ingress *v1beta1.Ingress, k8sClient Client) ([]*tls.Configuration, error) { +func getTLS(ingress *v1beta1.Ingress, k8sClient Client) ([]*tls.Configuration, error) { var tlsConfigs []*tls.Configuration for _, t := range ingress.Spec.TLS { diff --git a/provider/kubernetes/kubernetes_test.go b/provider/kubernetes/kubernetes_test.go index 3cfce6dba..87058393c 100644 --- a/provider/kubernetes/kubernetes_test.go +++ b/provider/kubernetes/kubernetes_test.go @@ -1323,8 +1323,8 @@ func TestTLSSecretLoad(t *testing.T) { ), ), ), - tlsConfigurations( - tlsConfiguration( + tlsesSection( + tlsSection( tlsEntryPoints("ep1", "ep2"), certificate( "-----BEGIN CERTIFICATE-----\n-----END CERTIFICATE-----", @@ -1336,7 +1336,7 @@ func TestTLSSecretLoad(t *testing.T) { assert.Equal(t, expected, actual) } -func TestGetTLSConfigurations(t *testing.T) { +func TestGetTLS(t *testing.T) { testIngressWithoutHostname := buildIngress( iNamespace("testing"), iRules( @@ -1503,7 +1503,7 @@ func TestGetTLSConfigurations(t *testing.T) { t.Run(test.desc, func(t *testing.T) { t.Parallel() - tlsConfigs, err := getTLSConfigurations(test.ingress, test.client) + tlsConfigs, err := getTLS(test.ingress, test.client) if test.errResult != "" { assert.EqualError(t, err, test.errResult) diff --git a/provider/kv/keynames.go b/provider/kv/keynames.go index 662adf2e9..dd97e9c25 100644 --- a/provider/kv/keynames.go +++ b/provider/kv/keynames.go @@ -62,10 +62,10 @@ const ( pathFrontendRoutes = "/routes/" pathFrontendRule = "/rule" - pathTLSConfiguration = "/tlsconfiguration/" - pathTLSConfigurationEntryPoints = "/entrypoints" - pathTLSConfigurationCertFile = "/certificate/certfile" - pathTLSConfigurationKeyFile = "/certificate/keyfile" + pathTLS = "/tls/" + pathTLSEntryPoints = "/entrypoints" + pathTLSCertFile = "/certificate/certfile" + pathTLSKeyFile = "/certificate/keyfile" pathTags = "/tags" pathAlias = "/alias" diff --git a/provider/kv/kv_config.go b/provider/kv/kv_config.go index ec2e5a360..0dc4f7df1 100644 --- a/provider/kv/kv_config.go +++ b/provider/kv/kv_config.go @@ -38,7 +38,7 @@ func (p *Provider) buildConfiguration() *types.Configuration { "Last": p.last, "Has": p.has, - "getTLSConfigurations": p.getTLSConfigurations, + "getTLSSection": p.getTLSSection, // Frontend functions "getBackendName": p.getFuncString(pathFrontendBackend, ""), @@ -273,19 +273,19 @@ func (p *Provider) getHealthCheck(rootPath string) *types.HealthCheck { } } -func (p *Provider) getTLSConfigurations(prefix string) []*tls.Configuration { - var tlsConfiguration []*tls.Configuration +func (p *Provider) getTLSSection(prefix string) []*tls.Configuration { + var tlsSection []*tls.Configuration - for _, tlsConfPath := range p.list(prefix, pathTLSConfiguration) { - certFile := p.get("", tlsConfPath, pathTLSConfigurationCertFile) - keyFile := p.get("", tlsConfPath, pathTLSConfigurationKeyFile) + for _, tlsConfPath := range p.list(prefix, pathTLS) { + certFile := p.get("", tlsConfPath, pathTLSCertFile) + keyFile := p.get("", tlsConfPath, pathTLSKeyFile) if len(certFile) == 0 && len(keyFile) == 0 { log.Warnf("Invalid TLS configuration (no cert and no key): %s", tlsConfPath) continue } - entryPoints := p.getList(tlsConfPath, pathTLSConfigurationEntryPoints) + entryPoints := p.getList(tlsConfPath, pathTLSEntryPoints) if len(entryPoints) == 0 { log.Warnf("Invalid TLS configuration (no entry points): %s", tlsConfPath) continue @@ -299,10 +299,10 @@ func (p *Provider) getTLSConfigurations(prefix string) []*tls.Configuration { }, } - tlsConfiguration = append(tlsConfiguration, tlsConf) + tlsSection = append(tlsSection, tlsConf) } - return tlsConfiguration + return tlsSection } func (p *Provider) getRoutes(rootPath string) map[string]types.Route { diff --git a/provider/kv/kv_config_test.go b/provider/kv/kv_config_test.go index db37d9369..62b4e3462 100644 --- a/provider/kv/kv_config_test.go +++ b/provider/kv/kv_config_test.go @@ -125,11 +125,11 @@ func TestProviderBuildConfiguration(t *testing.T) { withPair("routes/route1/rule", "Host:test.localhost"), withPair("routes/route2/rule", "Path:/foo")), - entry("tlsconfiguration/foo", + entry("tls/foo", withPair("entrypoints", "http,https"), withPair("certificate/certfile", "certfile1"), withPair("certificate/keyfile", "keyfile1")), - entry("tlsconfiguration/bar", + entry("tls/bar", withPair("entrypoints", "http,https"), withPair("certificate/certfile", "certfile2"), withPair("certificate/keyfile", "keyfile2")), @@ -246,7 +246,7 @@ func TestProviderBuildConfiguration(t *testing.T) { }, }, }, - TLSConfiguration: []*tls.Configuration{ + TLS: []*tls.Configuration{ { EntryPoints: []string{"http", "https"}, Certificate: &tls.Certificate{ @@ -1700,7 +1700,7 @@ func TestProviderGetHealthCheck(t *testing.T) { } } -func TestProviderGetTLSConfigurations(t *testing.T) { +func TestProviderGetTLSes(t *testing.T) { testCases := []struct { desc string kvPairs []*store.KVPair @@ -1709,11 +1709,11 @@ func TestProviderGetTLSConfigurations(t *testing.T) { { desc: "when several TLS configuration defined", kvPairs: filler("traefik", - entry("tlsconfiguration/foo", + entry("tls/foo", withPair("entrypoints", "http,https"), withPair("certificate/certfile", "certfile1"), withPair("certificate/keyfile", "keyfile1")), - entry("tlsconfiguration/bar", + entry("tls/bar", withPair("entrypoints", "http,https"), withPair("certificate/certfile", "certfile2"), withPair("certificate/keyfile", "keyfile2"))), @@ -1736,13 +1736,13 @@ func TestProviderGetTLSConfigurations(t *testing.T) { }, { desc: "should return nil when no TLS configuration", - kvPairs: filler("traefik", entry("tlsconfiguration/foo")), + kvPairs: filler("traefik", entry("tls/foo")), expected: nil, }, { desc: "should return nil when no entry points", kvPairs: filler("traefik", - entry("tlsconfiguration/foo", + entry("tls/foo", withPair("certificate/certfile", "certfile2"), withPair("certificate/keyfile", "keyfile2"))), expected: nil, @@ -1750,7 +1750,7 @@ func TestProviderGetTLSConfigurations(t *testing.T) { { desc: "should return nil when no cert file and no key file", kvPairs: filler("traefik", - entry("tlsconfiguration/foo", + entry("tls/foo", withPair("entrypoints", "http,https"))), expected: nil, }, @@ -1764,7 +1764,7 @@ func TestProviderGetTLSConfigurations(t *testing.T) { p := newProviderMock(test.kvPairs) - result := p.getTLSConfigurations(prefix) + result := p.getTLSSection(prefix) assert.Equal(t, test.expected, result) }) diff --git a/provider/rancher/api.go b/provider/rancher/api.go index 728e9d88c..3f831c579 100644 --- a/provider/rancher/api.go +++ b/provider/rancher/api.go @@ -91,19 +91,24 @@ func (p *Provider) apiProvide(configurationChan chan<- types.ConfigMessage, pool for { select { case <-ticker.C: + checkAPI, errAPI := rancherClient.ApiKey.List(withoutPagination) - log.Debugf("Refreshing new Data from Provider API") - var stacks = listRancherStacks(rancherClient) - var services = listRancherServices(rancherClient) - var container = listRancherContainer(rancherClient) + if errAPI != nil { + log.Errorf("Cannot establish connection: %+v, Rancher API return: %+v; Skipping refresh Data from Rancher API.", errAPI, checkAPI) + } else { + log.Debugf("Refreshing new Data from Rancher API") + stacks := listRancherStacks(rancherClient) + services := listRancherServices(rancherClient) + container := listRancherContainer(rancherClient) - rancherData := parseAPISourcedRancherData(stacks, services, container) + rancherData := parseAPISourcedRancherData(stacks, services, container) - configuration := p.buildConfiguration(rancherData) - if configuration != nil { - configurationChan <- types.ConfigMessage{ - ProviderName: "rancher", - Configuration: configuration, + configuration := p.buildConfiguration(rancherData) + if configuration != nil { + configurationChan <- types.ConfigMessage{ + ProviderName: "rancher", + Configuration: configuration, + } } } case <-stop: diff --git a/script/test-integration b/script/test-integration index 95d32af32..0cf7ccf8b 100755 --- a/script/test-integration +++ b/script/test-integration @@ -4,7 +4,7 @@ set -e export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" export DEST=. -TESTFLAGS="${TESTFLAGS} -test.timeout=9m -check.v" +TESTFLAGS="${TESTFLAGS} -test.timeout=20m -check.v" if [ -n "$VERBOSE" ]; then TESTFLAGS="${TESTFLAGS} -v" diff --git a/server/server.go b/server/server.go index 49cb5b45c..37b8f8f42 100644 --- a/server/server.go +++ b/server/server.go @@ -67,6 +67,7 @@ type Server struct { stopChan chan bool providers []provider.Provider currentConfigurations safe.Safe + providerConfigUpdateMap map[string]chan types.ConfigMessage globalConfiguration configuration.GlobalConfiguration accessLoggerMiddleware *accesslog.LogHandler tracingMiddleware *tracing.Tracing @@ -107,6 +108,7 @@ func NewServer(globalConfiguration configuration.GlobalConfiguration) *Server { server.configureSignals() currentConfigurations := make(types.Configurations) server.currentConfigurations.Set(currentConfigurations) + server.providerConfigUpdateMap = make(map[string]chan types.ConfigMessage) server.globalConfiguration = globalConfiguration if server.globalConfiguration.API != nil { server.globalConfiguration.API.CurrentConfigurations = &server.currentConfigurations @@ -362,25 +364,25 @@ func (s *Server) listenProviders(stop chan bool) { } func (s *Server) preLoadConfiguration(configMsg types.ConfigMessage) { - providerConfigUpdateMap := map[string]chan types.ConfigMessage{} providersThrottleDuration := time.Duration(s.globalConfiguration.ProvidersThrottleDuration) s.defaultConfigurationValues(configMsg.Configuration) currentConfigurations := s.currentConfigurations.Get().(types.Configurations) jsonConf, _ := json.Marshal(configMsg.Configuration) log.Debugf("Configuration received from provider %s: %s", configMsg.ProviderName, string(jsonConf)) - if configMsg.Configuration == nil || configMsg.Configuration.Backends == nil && configMsg.Configuration.Frontends == nil && configMsg.Configuration.TLSConfiguration == nil { + if configMsg.Configuration == nil || configMsg.Configuration.Backends == nil && configMsg.Configuration.Frontends == nil && configMsg.Configuration.TLS == nil { log.Infof("Skipping empty Configuration for provider %s", configMsg.ProviderName) } else if reflect.DeepEqual(currentConfigurations[configMsg.ProviderName], configMsg.Configuration) { log.Infof("Skipping same configuration for provider %s", configMsg.ProviderName) } else { - if _, ok := providerConfigUpdateMap[configMsg.ProviderName]; !ok { - providerConfigUpdate := make(chan types.ConfigMessage) - providerConfigUpdateMap[configMsg.ProviderName] = providerConfigUpdate + providerConfigUpdateCh, ok := s.providerConfigUpdateMap[configMsg.ProviderName] + if !ok { + providerConfigUpdateCh = make(chan types.ConfigMessage) + s.providerConfigUpdateMap[configMsg.ProviderName] = providerConfigUpdateCh s.routinesPool.Go(func(stop chan bool) { - throttleProviderConfigReload(providersThrottleDuration, s.configurationValidatedChan, providerConfigUpdate, stop) + throttleProviderConfigReload(providersThrottleDuration, s.configurationValidatedChan, providerConfigUpdateCh, stop) }) } - providerConfigUpdateMap[configMsg.ProviderName] <- configMsg + providerConfigUpdateCh <- configMsg } } @@ -472,8 +474,8 @@ func (s *Server) loadHTTPSConfiguration(configurations types.Configurations, def newEPCertificates := make(map[string]*traefikTls.DomainsCertificates) // Get all certificates for _, configuration := range configurations { - if configuration.TLSConfiguration != nil && len(configuration.TLSConfiguration) > 0 { - if err := traefikTls.SortTLSConfigurationPerEntryPoints(configuration.TLSConfiguration, newEPCertificates, defaultEntryPoints); err != nil { + if configuration.TLS != nil && len(configuration.TLS) > 0 { + if err := traefikTls.SortTLSPerEntryPoints(configuration.TLS, newEPCertificates, defaultEntryPoints); err != nil { return nil, err } } @@ -770,7 +772,9 @@ func (s *Server) addInternalPublicRoutes(entryPointName string, router *mux.Rout if s.globalConfiguration.Ping != nil && s.globalConfiguration.Ping.EntryPoint != "" && s.globalConfiguration.Ping.EntryPoint == entryPointName { s.globalConfiguration.Ping.AddRoutes(router) } +} +func (s *Server) addACMERoutes(entryPointName string, router *mux.Router) { if s.globalConfiguration.ACME != nil && s.globalConfiguration.ACME.HTTPChallenge != nil && s.globalConfiguration.ACME.HTTPChallenge.EntryPoint == entryPointName { s.globalConfiguration.ACME.AddRoutes(router) } @@ -851,6 +855,9 @@ func (s *Server) buildInternalRouter(entryPointName, path string, internalMiddle internalMuxRouter.Walk(wrapRoute(internalMiddlewares)) s.addInternalPublicRoutes(entryPointName, internalMuxSubrouter) + + s.addACMERoutes(entryPointName, internalMuxRouter) + return internalMuxRouter } diff --git a/server/server_test.go b/server/server_test.go index 4340f62ed..6e96af6fa 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -463,7 +463,7 @@ func TestServerLoadConfigHealthCheckOptions(t *testing.T) { HealthCheck: healthCheck, }, }, - TLSConfiguration: []*tls.Configuration{ + TLS: []*tls.Configuration{ { Certificate: &tls.Certificate{ CertFile: localhostCert, @@ -664,7 +664,7 @@ func TestServerLoadCertificateWithDefaultEntryPoint(t *testing.T) { dynamicConfigs := types.Configurations{ "config": &types.Configuration{ - TLSConfiguration: []*tls.Configuration{ + TLS: []*tls.Configuration{ { Certificate: &tls.Certificate{ CertFile: localhostCert, diff --git a/templates/kubernetes.tmpl b/templates/kubernetes.tmpl index f848800e4..e24e89b02 100644 --- a/templates/kubernetes.tmpl +++ b/templates/kubernetes.tmpl @@ -37,9 +37,9 @@ {{if $frontend.Redirect}} [frontends."{{$frontendName}}".redirect] - entryPoint = "{{$frontend.RedirectEntryPoint}}" - regex = "{{$frontend.RedirectRegex}}" - replacement = "{{$frontend.RedirectReplacement}}" + entryPoint = "{{$frontend.Redirect.EntryPoint}}" + regex = "{{$frontend.Redirect.Regex}}" + replacement = "{{$frontend.Redirect.Replacement}}" {{end}} {{if $frontend.Headers }} @@ -94,12 +94,12 @@ {{end}} {{end}} -{{range $tlsConfiguration := .TLSConfiguration}} -[[tlsConfiguration]] - entryPoints = [{{range $tlsConfiguration.EntryPoints}} +{{range $tls := .TLS}} +[[tls]] + entryPoints = [{{range $tls.EntryPoints}} "{{.}}", {{end}}] - [tlsConfiguration.certificate] - certFile = """{{$tlsConfiguration.Certificate.CertFile}}""" - keyFile = """{{$tlsConfiguration.Certificate.KeyFile}}""" + [tls.certificate] + certFile = """{{$tls.Certificate.CertFile}}""" + keyFile = """{{$tls.Certificate.KeyFile}}""" {{end}} diff --git a/templates/kv.tmpl b/templates/kv.tmpl index efa9c359d..56765ecfd 100644 --- a/templates/kv.tmpl +++ b/templates/kv.tmpl @@ -161,15 +161,15 @@ {{end}} -{{range $tlsConfiguration := getTLSConfigurations .Prefix }} -[[tlsConfiguration]] +{{range $tls := getTLSSection .Prefix }} +[[tls]] - entryPoints = [{{range $tlsConfiguration.EntryPoints }} + entryPoints = [{{range $tls.EntryPoints }} "{{.}}", {{end}}] - [tlsConfiguration.certificate] - certFile = """{{ $tlsConfiguration.Certificate.CertFile }}""" - keyFile = """{{ $tlsConfiguration.Certificate.KeyFile }}""" + [tls.certificate] + certFile = """{{ $tls.Certificate.CertFile }}""" + keyFile = """{{ $tls.Certificate.KeyFile }}""" {{end}} diff --git a/tls/tls.go b/tls/tls.go index 2b3276c0e..a1600210a 100644 --- a/tls/tls.go +++ b/tls/tls.go @@ -93,8 +93,8 @@ func (r *RootCAs) Type() string { return "rootcas" } -// SortTLSConfigurationPerEntryPoints converts TLS configuration sorted by Certificates into TLS configuration sorted by EntryPoints -func SortTLSConfigurationPerEntryPoints(configurations []*Configuration, epConfiguration map[string]*DomainsCertificates, defaultEntryPoints []string) error { +// SortTLSPerEntryPoints converts TLS configuration sorted by Certificates into TLS configuration sorted by EntryPoints +func SortTLSPerEntryPoints(configurations []*Configuration, epConfiguration map[string]*DomainsCertificates, defaultEntryPoints []string) error { if epConfiguration == nil { epConfiguration = make(map[string]*DomainsCertificates) } diff --git a/types/types.go b/types/types.go index e89d7ebc7..fba8835ed 100644 --- a/types/types.go +++ b/types/types.go @@ -197,9 +197,9 @@ type Configurations map[string]*Configuration // Configuration of a provider. type Configuration struct { - Backends map[string]*Backend `json:"backends,omitempty"` - Frontends map[string]*Frontend `json:"frontends,omitempty"` - TLSConfiguration []*traefikTls.Configuration `json:"tlsConfiguration,omitempty"` + Backends map[string]*Backend `json:"backends,omitempty"` + Frontends map[string]*Frontend `json:"frontends,omitempty"` + TLS []*traefikTls.Configuration `json:"tls,omitempty"` } // ConfigMessage hold configuration information exchanged between parts of traefik.