Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't parse CRD #108

Open
Tchoupinax opened this issue Jun 23, 2022 · 2 comments
Open

Can't parse CRD #108

Tchoupinax opened this issue Jun 23, 2022 · 2 comments

Comments

@Tchoupinax
Copy link

Hello,

I tried your project to parse an IngressRoute, that is a CRD provided by Traefik.

8:46PM Warn | could not parse file                                          error="2 errors occurred:\n\t* could not decode yaml object with main scheme #1: no kind \"IngressRoute\" is registered for version \"traefik.containo.us/v1alpha1\" in scheme \"pkg/runtime/scheme.go:100\"\n\t* could not decode yaml object with aggregator scheme #1: no kind \"IngressRoute\" is registered for version \"traefik.containo.us/v1alpha1\" in scheme \"pkg/runtime/scheme.go:100\"\n\n"

The file

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: dashboard
spec:
  entryPoints:
    - web
  routes:
    - match: Host(`traefik.localhost`) && (PathPrefix(`/dashboard`) || PathPrefix(`/api`))
      kind: Rule
      services:
        - name: api@internal
          kind: TraefikService

And the command used is the following

k2tf -f ok.yml -o df.tf

Hope it will help you to improve your tool!

Have a nice day

@WitoldSlawko
Copy link

Hey got same problem. Are there any plans to support CRDs ???

@yuriy-yarosh
Copy link

yuriy-yarosh commented Aug 11, 2022

@Tchoupinax @WitoldSlawko k2tf needs refactoring... but kubernetes provider itself can work with CRD's only as plain kubernetes_manifests.

There are a couple multistage deployment caveats - you'll be forced to deploy CRD's first using targeted application terraform apply -target module.k8s_crds. Kubernetes provider will try to validate the existing CR manifests according to the CRDs that haven't been loaded yet and will fail during initialization.

Terraform multi-stage deployments had been broken since 2015...

I had some success with tfk8s, it's much dumber than k2tf but just able to translate the CRDs to the kubernetes_manifest resources directly, which is enough.

Targeted multistage + k2tf + tfk8s worked for me... translated all the helm charts (about 30) to Terraform, pretty happy with the consolidated infra state for everything.

Maybe one day I'll contribute proper depends_on for TF provider blocks, which should fix things with deferred refresh and multistage planning.

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

No branches or pull requests

3 participants