traefik / traefik-migration-tool

A migration tool from Traefik v1 to Traefik v2
https://docs.traefik.io/migration/v1-to-v2/
Apache License 2.0
151 stars 35 forks source link

migration of ingress do not work #11

Closed fragtom closed 4 years ago

fragtom commented 4 years ago

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?

ldez commented 4 years ago

hello,

It's related to items, currently the migration tool don't support that.

If you extract your ingress into files with the following format, the migration will work.

apiVersion: extensions/v1beta1
kind: Ingress

#...

---
apiVersion: extensions/v1beta1
kind: Ingress

#...
ldez commented 4 years ago

When I try to use your file, I have an error:

error while decoding YAML object. Err was: Object 'Kind' is missing in 'apiVersion: v1
...
ldez commented 4 years ago

Fixed by a41334769ee0776dcf90730e35071a20933ef146