本文整理匯總了Golang中k8s/io/kubernetes/pkg/kubectl/cmd/util.Factory.ExperimentalClient方法的典型用法代碼示例。如果您正苦於以下問題:Golang Factory.ExperimentalClient方法的具體用法?Golang Factory.ExperimentalClient怎麽用?Golang Factory.ExperimentalClient使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/kubernetes/pkg/kubectl/cmd/util.Factory
的用法示例。
在下文中一共展示了Factory.ExperimentalClient方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RunApiVersions
func RunApiVersions(f *cmdutil.Factory, w io.Writer) error {
if len(os.Args) > 1 && os.Args[1] == "apiversions" {
printDeprecationWarning("api-versions", "apiversions")
}
client, err := f.Client()
if err != nil {
return err
}
apiVersions, err := client.ServerAPIVersions()
if err != nil {
fmt.Printf("Couldn't get available api versions from server: %v\n", err)
os.Exit(1)
}
var expAPIVersions *api.APIVersions
showExpVersions := false
expClient, err := f.ExperimentalClient()
if err == nil {
expAPIVersions, err = expClient.ServerAPIVersions()
showExpVersions = err == nil
}
fmt.Fprintf(w, "Available Server Api Versions: %#v\n", *apiVersions)
if showExpVersions {
fmt.Fprintf(w, "Available Server Experimental Api Versions: %#v\n", *expAPIVersions)
}
return nil
}