Code Monkey home page Code Monkey logo

traefik-migration-tool's Introduction

traefik-migration-tool

GitHub release Build Status

A migration tool from Traefik v1 to Traefik v2.

Features:

  • โ›ต Migrate 'Ingress' to Traefik 'IngressRoute' resources.
  • ๐Ÿ”’ Migrate acme.json file from Traefik v1 to Traefik v2.
  • ๐Ÿ–น Migrate the static configuration contained in the file traefik.toml to a Traefik v2 file.

Usage

Install

From Binaries

You can use pre-compiled binaries:

  • To get the binary just download the latest release for your OS/Arch from the releases page
  • Unzip the archive.
  • Add traefik-migration-tool in your PATH.

With Docker

You can use a Docker image:

docker run --rm -w /data -v ${PWD}:/data traefik/traefik-migration-tool <options here>

Limits

Unsupported annotations:

  • ingress.kubernetes.io/preserve-host
  • ingress.kubernetes.io/session-cookie-name
  • ingress.kubernetes.io/affinity
  • ingress.kubernetes.io/buffering
  • ingress.kubernetes.io/circuit-breaker-expression
  • ingress.kubernetes.io/max-conn-amount
  • ingress.kubernetes.io/max-conn-extractor-func
  • ingress.kubernetes.io/responseforwarding-flushinterval
  • ingress.kubernetes.io/load-balancer-method
  • ingress.kubernetes.io/auth-realm
  • ingress.kubernetes.io/service-weights
  • ingress.kubernetes.io/error-pages

traefik-migration-tool's People

Contributors

dependabot[bot] avatar juliens avatar kevinpollet avatar ldez avatar purplebabar avatar rtribotte avatar tommoulard avatar twin avatar welcomattic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

traefik-migration-tool's Issues

Converting ACME JSON Yeilds null "Certificates" Section

I just used the traefik-migration-tool to convert my acme.json file by running traefik-migration-tool acme in the directory with the json file, but it seems like the acme-new.json isn't actually migrating any of the data and just producing a blank config stub:

{
  "default": {
    "Account": null,
    "Certificates": null
  }
}

I'm assuming this wont be a huge deal because I can just regenerate the certs, but still it seems like a bug.

Helm/Kubernetes

How do I use this migration tool in my Kubernetes cluster? I installed traefik with helm.

migration of ingress do not work

Promising tool for migration did not work on my ingresses. So, there we have a k8s distribution, where the previously used traefik 1.7~ version should be migrated.

docker run --rm -v ${PWD}:/data containous/traefik-migration-tool ingress --input /data/in --output /data/out 

Produces output, that is identically to input:

apiVersion: v1
items:
- apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      ingress.kubernetes.io/auth-secret: basic-auth-document-db
      ingress.kubernetes.io/auth-type: basic
      ingress.kubernetes.io/custom-request-headers: XYZ-My-Custom-Header:dev
      kubernetes.io/ingress.class: traefik
    creationTimestamp: "2018-02-27T10:03:59Z"
    generation: 9
    name: dev-protected
    namespace: dev
    resourceVersion: "277178439"
    selfLink: /apis/extensions/v1beta1/namespaces/dev/ingresses/dev-protected
    uid: 87d8d657-1ba5-11e8-a9cd-06fa2d724cac
  spec:
    rules:
    - host: svc.test.migrate.traefik.to.v2.com
      http:
        paths:
        - backend:
            serviceName: v2
            servicePort: 80

What could be the trick?

PathPrefixStrip migration may cause invalid resource names

Considering the following v1 example from https://opensource.com/article/20/3/kubernetes-traefik:

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: mydog-nginx-ingress
  annotations:
    kubernetes.io/ingress.class: "traefik"
    traefik.frontend.rule.type: PathPrefixStrip
spec:
  rules:
  - http:
      paths:
      - path: /mydog
        backend:
          serviceName: mydog-nginx-service
          servicePort: 80

migration will include the leading / for a middleware name, producing errors like:

# kubectl apply -f mydog.yaml 
deployment.apps/mydog-nginx created
service/mydog-nginx-service created
ingressroute.traefik.containo.us/mydog-nginx-ingress created
error: error when retrieving current configuration of:
Resource: "traefik.containo.us/v1alpha1, Resource=middlewares", GroupVersionKind: "traefik.containo.us/v1alpha1, Kind=Middleware"
Name: "/mydog", Namespace: "default"
from server for: "mydog.yaml": invalid resource name "/mydog": [may not contain '/']

networking.k8s.io/v1 support

The k8s 1.19+ networking.k8s.io/v1 ingress definitions are incompatible with the migration tool, would be it be possible to add support?

Dockerized command

Hey folks !

Thanks for the tool it's been helpful :)
I've containerized the traefik migration tool :) would you like me to do a PR ?

Cheerz

Middlewares created with invalid names

When running the traefik-migration-tool (from release v0.13.4) it will create a Middleware with a name from the rules match, and this can contain dots, and hence the Middleware is created with an invalid name, and the IngressRoute using that Middleware will not work.

Dest case:
I have created a test case that shows this behaviour. Here are the test case files:

traefik-migration-tool-bug.zip

Steps to reproduce:

kubectl apply -f bug-setup.yaml
traefik-migration-tool ingress -i ingress.yaml -o output
mv output/ingress.yaml ingressroute.yaml
kubectl apply -f ingressroute.yaml 

When you now go to the Traefik Dashboard, you will notice that the new IngressRoute for "Host(somehost.somedomain.sometld) && PathPrefix(/nginx)" has an error status. If you investigate the error, you will see a screen like this:

migration-bug

Workaround:
The workaround if of course to manually edit ingressroute.yaml prior to applying it, and ensure the name of the Middleware doesn't contain dots/period characters. But if you have a large number of ingresses to migrate done by various teams and persons, it is quite a high toil and high possibility of human errors.

Suggested fix:
The traefik-migration-tool should replace all the dots in the Middleware name with dashes prior to saving the output file.

acme subcommand generates invalid v2 acme.json

I used the acme subcommand of this migration tool and then used the resulting acme-new.json with traefik v2. This would result in this error:

Unable to add ACME provider to the providers list: unable to get ACME account: json: cannot unmarshal array into Go value of type acme.StoredData

v2 to v3

Hi Guys,

A couple of weeks ago a new version of Traefik was released, do you plan to create a tool for v2 to v3 migration?

Thank you)

apiVersion: networking.k8s.io/v1beta1 kind: Ingress

Hello,
ingress with this kind of definition are ignored :

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        backend:
          serviceName: test
          servicePort: 80

this example is from official documentation :
https://kubernetes.io/docs/concepts/services-networking/ingress/

error :
ingress.go:90: object is not an ingress ignore it: *v1beta1.Ingress

error loading module requirements

Greetings dear Traefik team,

I get an error when I try to build your migration tool.

Go Version: go version go1.12.9 linux/amd64

  • make
make: golangci-lint: Command not found
Makefile:22: recipe for target 'check' failed
make: *** [check] Error 127
  • make build
rm -rf dist/
Version: 1d2642ad5fde46168c9c491df3cc7b51f310c2d4
go build -v -ldflags '-X "main.Version=1d2642ad5fde46168c9c491df3cc7b51f310c2d4" -X "main.ShortCommit=1d2642ad5fde46168c9c491df3cc7b51f310c2d4"' .
go: finding github.com/labbsr0x/goh v0.0.0-20190417202808-8b16b4848295
go: github.com/labbsr0x/[email protected]: unknown revision 8b16b4848295
go: error loading module requirements
Makefile:18: recipe for target 'build' failed
make: *** [build] Error 1

Any idea how to fix that?

kind regards

Enhance documentation for docker command

https://github.com/containous/traefik-migration-tool#with-docker

The current docker command is not working out of the box. An input and output has to be specified as the volume is mapped into /data and the standard value points to ./[file]. I got the setup for acme e.g. running like:
docker run --rm -v ${PWD}:/data containous/traefik-migration-tool acme -i /data/acme.json -o /data/acme-new.json
Don't know if there is an easier way - if not IMHO the documentation needs to be enhanced or implementation needs to be adapted. I could support with the documentation ๐Ÿ˜Ž

Source tarball does not build on NixOS

To reproduce:

$ tar -zxf traefik-migration-tool-0.9.0.tar.gz 
$ cd traefik-migration-tool-0.9.0/
$ make
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
golangci-lint run
WARN Failed to discover go env: failed to run 'go env': exit status 2 
ERRO Running error: context loading failed: failed to load program with go/packages: unsupported version of go: exit status 2: flag provided but not defined: -compiled
usage: list [-e] [-f format] [-json] [build flags] [packages]
[โ€ฆ]

Looks like it's not meant to be built outside of a Git repo, and it doesn't say which version of Go it needs. For reference:

$ go version
go version go1.4-bootstrap-20161024 linux/amd64

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.