本文整理汇总了Golang中k8s/io/kubernetes/cmd/libs/go2idl/client-gen/generators.NameSystems函数的典型用法代码示例。如果您正苦于以下问题:Golang NameSystems函数的具体用法?Golang NameSystems怎么用?Golang NameSystems使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NameSystems函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
arguments := args.Default()
// Override defaults. These are Kubernetes specific input and output
// locations.
arguments.InputDirs = []string{
"k8s.io/kubernetes/pkg/api",
"k8s.io/kubernetes/pkg/apis/extensions",
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
"k8s.io/kubernetes/pkg/watch",
"k8s.io/kubernetes/pkg/client/unversioned",
"k8s.io/kubernetes/pkg/api/latest",
}
// We may change the output path later.
arguments.OutputPackagePath = "k8s.io/kubernetes/pkg/client/clientset/unversioned"
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
generators.Packages,
); err != nil {
glog.Fatalf("Error: %v", err)
}
}
示例2: main
func main() {
arguments := args.Default()
flag.Parse()
dependencies := []string{
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
"k8s.io/kubernetes/pkg/watch",
"k8s.io/kubernetes/pkg/client/unversioned",
"k8s.io/kubernetes/pkg/client/testing/fake",
"k8s.io/kubernetes/pkg/apimachinery/registered",
}
if *test {
arguments.InputDirs = append(dependencies, []string{
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
}...)
// We may change the output path later.
arguments.OutputPackagePath = "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput"
arguments.CustomArgs = generators.ClientGenArgs{
[]unversioned.GroupVersion{{"testgroup", ""}},
map[unversioned.GroupVersion]string{
unversioned.GroupVersion{"testgroup", ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
},
"test_internalclientset",
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/",
false,
false,
}
} else {
inputPath, groupVersions, gvToPath, err := parseInputVersions()
if err != nil {
glog.Fatalf("Error: %v", err)
}
glog.Infof("going to generate clientset from these input paths: %v", inputPath)
arguments.InputDirs = append(inputPath, dependencies...)
// TODO: we need to make OutPackagePath a map[string]string. For example,
// we need clientset and the individual typed clients be output to different
// output path.
// We may change the output path later.
arguments.OutputPackagePath = "k8s.io/kubernetes/pkg/client/typed/generated"
arguments.CustomArgs = generators.ClientGenArgs{
groupVersions,
gvToPath,
*clientsetName,
*clientsetPath,
*clientsetOnly,
*fakeClient,
}
}
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
generators.Packages,
); err != nil {
glog.Fatalf("Error: %v", err)
}
}
示例3: main
func main() {
arguments := args.Default()
flag.Parse()
if *test {
// Override defaults. These are Kubernetes specific input and output
// locations.
arguments.InputDirs = []string{
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
"k8s.io/kubernetes/pkg/watch",
"k8s.io/kubernetes/pkg/client/unversioned",
"k8s.io/kubernetes/pkg/api/latest",
}
// We may change the output path later.
arguments.OutputPackagePath = "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput"
} else {
// Override defaults. These are Kubernetes specific input and output
// locations.
arguments.InputDirs = []string{
"k8s.io/kubernetes/pkg/api",
"k8s.io/kubernetes/pkg/apis/extensions",
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
"k8s.io/kubernetes/pkg/watch",
"k8s.io/kubernetes/pkg/client/unversioned",
"k8s.io/kubernetes/pkg/api/latest",
}
// We may change the output path later.
arguments.OutputPackagePath = "k8s.io/kubernetes/pkg/client/typed/generated"
}
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
generators.Packages,
); err != nil {
glog.Fatalf("Error: %v", err)
}
}
示例4: main
func main() {
arguments := args.Default()
arguments.GoHeaderFilePath = filepath.Join(args.DefaultSourceTree(), "k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt")
flag.Parse()
var cmdArgs string
flag.VisitAll(func(f *flag.Flag) {
if !f.Changed || f.Name == "verify-only" {
return
}
cmdArgs = cmdArgs + fmt.Sprintf("--%s=%s ", f.Name, f.Value)
})
dependencies := []string{
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
"k8s.io/kubernetes/pkg/watch",
"k8s.io/kubernetes/pkg/client/unversioned",
"k8s.io/kubernetes/pkg/apimachinery/registered",
}
if *test {
arguments.InputDirs = append(dependencies, []string{
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup.k8s.io",
}...)
arguments.CustomArgs = clientgenargs.Args{
GroupVersions: []unversioned.GroupVersion{{Group: "testgroup.k8s.io", Version: ""}},
GroupVersionToInputPath: map[unversioned.GroupVersion]string{
unversioned.GroupVersion{Group: "testgroup.k8s.io", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/test_apis/testgroup.k8s.io",
},
ClientsetName: "test_internalclientset",
ClientsetOutputPath: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/",
ClientsetOnly: false,
FakeClient: true,
CmdArgs: cmdArgs,
}
} else {
inputPath, groupVersions, gvToPath, err := parseInputVersions()
if err != nil {
glog.Fatalf("Error: %v", err)
}
includedTypesOverrides, err := parseIncludedTypesOverrides()
if err != nil {
glog.Fatalf("Unexpected error: %v", err)
}
glog.Infof("going to generate clientset from these input paths: %v", inputPath)
arguments.InputDirs = append(inputPath, dependencies...)
arguments.CustomArgs = clientgenargs.Args{
GroupVersions: groupVersions,
GroupVersionToInputPath: gvToPath,
ClientsetName: *clientsetName,
ClientsetOutputPath: *clientsetPath,
ClientsetOnly: *clientsetOnly,
FakeClient: *fakeClient,
CmdArgs: cmdArgs,
IncludedTypesOverrides: includedTypesOverrides,
}
glog.Infof("==arguments: %v\n", arguments)
}
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
generators.Packages,
); err != nil {
glog.Fatalf("Error: %v", err)
}
}
示例5: main
func main() {
arguments := args.Default()
flag.Parse()
var cmdArgs string
flag.VisitAll(func(f *flag.Flag) {
if !f.Changed || f.Name == "verify-only" {
return
}
cmdArgs = cmdArgs + fmt.Sprintf("--%s=%s ", f.Name, f.Value)
})
dependencies := []string{
"k8s.io/kubernetes/pkg/fields",
"k8s.io/kubernetes/pkg/labels",
"k8s.io/kubernetes/pkg/watch",
"k8s.io/kubernetes/pkg/client/unversioned",
"k8s.io/kubernetes/pkg/apimachinery/registered",
}
if *test {
arguments.InputDirs = append(dependencies, []string{
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
}...)
arguments.CustomArgs = clientgenargs.Args{
[]unversioned.GroupVersion{{Group: "testgroup", Version: ""}},
map[unversioned.GroupVersion]string{
unversioned.GroupVersion{Group: "testgroup", Version: ""}: "k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup",
},
"test_internalclientset",
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/",
false,
false,
cmdArgs,
}
} else {
inputPath, groupVersions, gvToPath, err := parseInputVersions()
if err != nil {
glog.Fatalf("Error: %v", err)
}
glog.Infof("going to generate clientset from these input paths: %v", inputPath)
arguments.InputDirs = append(inputPath, dependencies...)
arguments.CustomArgs = clientgenargs.Args{
groupVersions,
gvToPath,
*clientsetName,
*clientsetPath,
*clientsetOnly,
*fakeClient,
cmdArgs,
}
}
if err := arguments.Execute(
generators.NameSystems(),
generators.DefaultNameSystem(),
generators.Packages,
); err != nil {
glog.Fatalf("Error: %v", err)
}
}