Can't parse CRD
Tchoupinax opened this issue · comments
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
Hey got same problem. Are there any plans to support CRDs ???
@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.