本文整理匯總了Golang中github.com/openshift/origin/pkg/cmd/server/api.ResolveNodeConfigPaths函數的典型用法代碼示例。如果您正苦於以下問題:Golang ResolveNodeConfigPaths函數的具體用法?Golang ResolveNodeConfigPaths怎麽用?Golang ResolveNodeConfigPaths使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ResolveNodeConfigPaths函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ReadAndResolveNodeConfig
func ReadAndResolveNodeConfig(filename string) (*configapi.NodeConfig, error) {
nodeConfig, err := ReadNodeConfig(filename)
if err != nil {
return nil, err
}
if err := configapi.ResolveNodeConfigPaths(nodeConfig, path.Dir(filename)); err != nil {
return nil, err
}
return nodeConfig, nil
}
示例2: MakeNodeConfig
func (o CreateNodeConfigOptions) MakeNodeConfig(serverCertFile, serverKeyFile, nodeClientCAFile, kubeConfigFile, nodeConfigFile string) error {
config := &configapi.NodeConfig{
NodeName: o.NodeName,
ServingInfo: configapi.ServingInfo{
BindAddress: net.JoinHostPort(o.ListenAddr.Host, strconv.Itoa(ports.KubeletPort)),
},
VolumeDirectory: o.VolumeDir,
AllowDisabledDocker: o.AllowDisabledDocker,
ImageConfig: configapi.ImageConfig{
Format: o.ImageTemplate.Format,
Latest: o.ImageTemplate.Latest,
},
DNSDomain: o.DNSDomain,
DNSIP: o.DNSIP,
MasterKubeConfig: kubeConfigFile,
NetworkConfig: configapi.NodeNetworkConfig{
NetworkPluginName: o.NetworkPluginName,
},
}
if o.UseTLS() {
config.ServingInfo.ServerCert = configapi.CertInfo{
CertFile: serverCertFile,
KeyFile: serverKeyFile,
}
config.ServingInfo.ClientCA = nodeClientCAFile
}
// Resolve relative to CWD
cwd, err := os.Getwd()
if err != nil {
return err
}
if err := configapi.ResolveNodeConfigPaths(config, cwd); err != nil {
return err
}
// Relativize to config file dir
base, err := cmdutil.MakeAbs(o.NodeConfigDir, cwd)
if err != nil {
return err
}
if err := configapi.RelativizeNodeConfigPaths(config, base); err != nil {
return err
}
// Roundtrip the config to v1 and back to ensure proper defaults are set.
ext, err := configapi.Scheme.ConvertToVersion(config, latestconfigapi.Version)
if err != nil {
return err
}
internal, err := configapi.Scheme.ConvertToVersion(ext, configapi.SchemeGroupVersion)
if err != nil {
return err
}
content, err := latestconfigapi.WriteYAML(internal)
if err != nil {
return err
}
if err := ioutil.WriteFile(nodeConfigFile, content, 0644); err != nil {
return err
}
return nil
}