k3s/pkg/codegen/main.go

81 lines
1.6 KiB
Go
Raw Normal View History

2019-01-01 08:23:01 +00:00
package main
import (
2019-05-09 22:05:51 +00:00
"os"
bindata "github.com/go-bindata/go-bindata"
2019-05-09 22:05:51 +00:00
v1 "github.com/rancher/k3s/pkg/apis/k3s.cattle.io/v1"
controllergen "github.com/rancher/wrangler/pkg/controller-gen"
"github.com/rancher/wrangler/pkg/controller-gen/args"
2019-01-01 08:23:01 +00:00
"github.com/sirupsen/logrus"
)
var (
2019-01-09 16:54:15 +00:00
basePackage = "github.com/rancher/k3s/types"
2019-01-01 08:23:01 +00:00
)
func main() {
2019-05-09 22:05:51 +00:00
os.Unsetenv("GOPATH")
2019-01-09 16:54:15 +00:00
bc := &bindata.Config{
Input: []bindata.InputConfig{
{
Path: "build/data",
Recursive: true,
},
},
Package: "data",
NoCompress: true,
NoMemCopy: true,
NoMetadata: true,
Output: "pkg/data/zz_generated_bindata.go",
}
if err := bindata.Translate(bc); err != nil {
logrus.Fatal(err)
}
2019-01-22 21:14:58 +00:00
bc = &bindata.Config{
Input: []bindata.InputConfig{
{
Path: "manifests",
Recursive: true,
2019-01-22 21:14:58 +00:00
},
},
Package: "deploy",
NoMetadata: true,
Prefix: "manifests/",
Output: "pkg/deploy/zz_generated_bindata.go",
}
if err := bindata.Translate(bc); err != nil {
logrus.Fatal(err)
}
bc = &bindata.Config{
Input: []bindata.InputConfig{
{
Path: "build/static",
Recursive: true,
},
},
Package: "static",
NoMetadata: true,
Prefix: "build/static/",
Output: "pkg/static/zz_generated_bindata.go",
}
if err := bindata.Translate(bc); err != nil {
logrus.Fatal(err)
}
2019-05-09 22:05:51 +00:00
controllergen.Run(args.Options{
OutputPackage: "github.com/rancher/k3s/pkg/generated",
Boilerplate: "scripts/boilerplate.go.txt",
Groups: map[string]args.Group{
"k3s.cattle.io": {
Types: []interface{}{
v1.Addon{},
},
GenerateTypes: true,
},
},
})
2019-01-01 08:23:01 +00:00
}