How do I import traefik CRD for kubernetes into a golang project?

I have a golang project to create kubernetes resources. I also need to create traefik resources, the traefik CRD available here traefik/pkg/provider/kubernetes/crd at v2.2.11 · traefik/traefik · GitHub but I am looking for a help, how do I add them into my project?

Thanks,
-Kuppa

I am able to add the CRD by adding the traefik project as a dependent project github.com/traefik/traefik/v2 and I also need to add additional replace module

// Docker v19.03.6
replace github.com/docker/docker => github.com/docker/engine v1.4.2-0.20200204220554-5f6d6f3f2203

// Containous forks
replace (
	github.com/abbot/go-http-auth => github.com/containous/go-http-auth v0.4.1-0.20200324110947-a37a7636d23e
	github.com/go-check/check => github.com/containous/check v0.0.0-20170915194414-ca0bf163426a
	github.com/gorilla/mux => github.com/containous/mux v0.0.0-20181024131434-c33f32e26898
	github.com/mailgun/minheap => github.com/containous/minheap v0.0.0-20190809180810-6e71eb837595
	github.com/mailgun/multibuf => github.com/containous/multibuf v0.0.0-20190809014333-8b6c9a7e6bba
)

Is this correct way? or Do we have a separate project for CRD only?

Added the CRD into schema so yaml file can be parsed.

	// Add traefik schema
	err2 := v1alpha1.AddToScheme(scheme.Scheme)
	if err2 != nil {
		logger.Errorw("Adding traefik schema failed", err2)
	}
	decode := scheme.Codecs.UniversalDeserializer().Decode

Thanks.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.