Exemple #1
0
func New() *Generator {
	sourceTree := args.DefaultSourceTree()
	common := args.GeneratorArgs{
		OutputBase:       sourceTree,
		GoHeaderFilePath: filepath.Join(sourceTree, "k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt"),
	}
	defaultProtoImport := filepath.Join(sourceTree, "k8s.io", "kubernetes", "Godeps", "_workspace", "src", "github.com", "gogo", "protobuf", "protobuf")
	return &Generator{
		Common:      common,
		OutputBase:  sourceTree,
		ProtoImport: []string{defaultProtoImport},
		Packages: strings.Join([]string{
			`+k8s.io/kubernetes/pkg/util/intstr`,
			`+k8s.io/kubernetes/pkg/api/resource`,
			`+k8s.io/kubernetes/pkg/runtime`,
			`+k8s.io/kubernetes/pkg/watch/versioned`,
			`k8s.io/kubernetes/pkg/api/unversioned`,
			`k8s.io/kubernetes/pkg/api/v1`,
			`k8s.io/kubernetes/pkg/apis/extensions/v1beta1`,
			`k8s.io/kubernetes/pkg/apis/autoscaling/v1`,
			`k8s.io/kubernetes/pkg/apis/batch/v1`,
			`k8s.io/kubernetes/pkg/apis/apps/v1alpha1`,
			`k8s.io/kubernetes/federation/apis/federation/v1alpha1`,
		}, ","),
		DropEmbeddedFields: "k8s.io/kubernetes/pkg/api/unversioned.TypeMeta",
	}
}
Exemple #2
0
func init() {
	sourceTree := args.DefaultSourceTree()
	g.Common.GoHeaderFilePath = filepath.Join("hack", "boilerplate.txt")
	g.ProtoImport = []string{
		filepath.Join("vendor"),
		filepath.Join("vendor", "k8s.io", "kubernetes", "third_party", "protobuf"),
	}
	g.OutputBase = sourceTree
	g.Packages = strings.Join([]string{
		`-k8s.io/kubernetes/pkg/util/intstr`,
		`-k8s.io/kubernetes/pkg/api/resource`,
		`-k8s.io/kubernetes/pkg/runtime`,
		`-k8s.io/kubernetes/pkg/watch/versioned`,
		`-k8s.io/kubernetes/pkg/api/unversioned`,
		`-k8s.io/kubernetes/pkg/api/v1`,
		`-k8s.io/kubernetes/pkg/apis/policy/v1alpha1`,
		`-k8s.io/kubernetes/pkg/apis/extensions/v1beta1`,
		`-k8s.io/kubernetes/pkg/apis/autoscaling/v1`,
		`-k8s.io/kubernetes/pkg/apis/batch/v1`,
		`-k8s.io/kubernetes/pkg/apis/batch/v2alpha1`,
		`-k8s.io/kubernetes/pkg/apis/apps/v1alpha1`,
		`-k8s.io/kubernetes/federation/apis/federation/v1beta1`,

		`github.com/openshift/origin/pkg/authorization/api/v1`,
		`github.com/openshift/origin/pkg/build/api/v1`,
		`github.com/openshift/origin/pkg/deploy/api/v1`,
		`github.com/openshift/origin/pkg/image/api/v1`,
		`github.com/openshift/origin/pkg/oauth/api/v1`,
		`github.com/openshift/origin/pkg/project/api/v1`,
		`github.com/openshift/origin/pkg/quota/api/v1`,
		`github.com/openshift/origin/pkg/route/api/v1`,
		`github.com/openshift/origin/pkg/sdn/api/v1`,
		`github.com/openshift/origin/pkg/security/api/v1`,
		`github.com/openshift/origin/pkg/template/api/v1`,
		`github.com/openshift/origin/pkg/user/api/v1`,
	}, ",")

	g.BindFlags(flag.CommandLine)
}