本文整理汇总了Golang中github.com/openshift/origin/pkg/cmd/server/api/latest.ReadAndResolveNodeConfig函数的典型用法代码示例。如果您正苦于以下问题:Golang ReadAndResolveNodeConfig函数的具体用法?Golang ReadAndResolveNodeConfig怎么用?Golang ReadAndResolveNodeConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadAndResolveNodeConfig函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Check
func (d NodeConfigCheck) Check() types.DiagnosticResult {
r := types.NewDiagnosticResult(NodeConfigCheckName)
r.Debug("DH1001", fmt.Sprintf("Looking for node config file at '%s'", d.NodeConfigFile))
nodeConfig, err := configapilatest.ReadAndResolveNodeConfig(d.NodeConfigFile)
if err != nil {
r.Error("DH1002", err, fmt.Sprintf("Could not read node config file '%s':\n(%T) %[2]v", d.NodeConfigFile, err))
return r
}
r.Info("DH1003", fmt.Sprintf("Found a node config file: %[1]s", d.NodeConfigFile))
results := configvalidation.ValidateNodeConfig(nodeConfig, nil)
if len(results.Errors) > 0 {
errText := fmt.Sprintf("Validation of node config file '%s' failed:\n", d.NodeConfigFile)
for _, err := range results.Errors {
errText += fmt.Sprintf("%v\n", err)
}
r.Error("DH1004", nil, errText)
}
if len(results.Warnings) > 0 {
warnText := fmt.Sprintf("Validation of node config file '%s' warned:\n", d.NodeConfigFile)
for _, warn := range results.Warnings {
warnText += fmt.Sprintf("%v\n", warn)
}
r.Warn("DH1005", nil, warnText)
}
return r
}
开发者ID:asiainfoLDP,项目名称:datafactory,代码行数:28,代码来源:check_node_config.go
示例2: Run
// Run runs the node config validation and returns the result of the validation as a boolean as well as any errors
// that occurred trying to validate the file
func (o *ValidateNodeConfigOptions) Run() (ok bool, err error) {
nodeConfig, err := configapilatest.ReadAndResolveNodeConfig(o.NodeConfigFile)
if err != nil {
return true, err
}
results := validation.ValidateNodeConfig(nodeConfig, nil)
writer := tabwriter.NewWriter(o.Out, minColumnWidth, tabWidth, padding, padchar, flags)
err = prettyPrintValidationResults(results, writer)
if err != nil {
return len(results.Errors) == 0, fmt.Errorf("could not print results: %v", err)
}
writer.Flush()
return len(results.Errors) == 0, nil
}
开发者ID:erinboyd,项目名称:origin,代码行数:17,代码来源:node.go
示例3: Check
func (d NodeConfigCheck) Check() types.DiagnosticResult {
r := types.NewDiagnosticResult(NodeConfigCheckName)
r.Debug("DH1001", fmt.Sprintf("Looking for node config file at '%s'", d.NodeConfigFile))
nodeConfig, err := configapilatest.ReadAndResolveNodeConfig(d.NodeConfigFile)
if err != nil {
r.Error("DH1002", err, fmt.Sprintf("Could not read node config file '%s':\n(%T) %[2]v", d.NodeConfigFile, err))
return r
}
r.Info("DH1003", fmt.Sprintf("Found a node config file: %[1]s", d.NodeConfigFile))
for _, err := range configvalidation.ValidateNodeConfig(nodeConfig) {
r.Error("DH1004", err, fmt.Sprintf("Validation of node config file '%s' failed:\n(%T) %[2]v", d.NodeConfigFile, err))
}
return r
}
开发者ID:nitintutlani,项目名称:origin,代码行数:16,代码来源:check_node_config.go
示例4: RunNode
// RunNode takes the options and:
// 1. Creates certs if needed
// 2. Reads fully specified node config OR builds a fully specified node config from the args
// 3. Writes the fully specified node config and exits if needed
// 4. Starts the node based on the fully specified config
func (o NodeOptions) RunNode() error {
if !o.IsRunFromConfig() || o.IsWriteConfigOnly() {
glog.V(2).Infof("Generating node configuration")
if err := o.CreateNodeConfig(); err != nil {
return err
}
}
if o.IsWriteConfigOnly() {
return nil
}
var nodeConfig *configapi.NodeConfig
var err error
if o.IsRunFromConfig() {
nodeConfig, err = configapilatest.ReadAndResolveNodeConfig(o.ConfigFile)
} else {
nodeConfig, err = o.NodeArgs.BuildSerializeableNodeConfig()
}
if err != nil {
return err
}
validationResults := validation.ValidateNodeConfig(nodeConfig, nil)
if len(validationResults.Warnings) != 0 {
for _, warning := range validationResults.Warnings {
glog.Warningf("%v", warning)
}
}
if len(validationResults.Errors) != 0 {
return kerrors.NewInvalid("NodeConfig", o.ConfigFile, validationResults.Errors)
}
_, kubeClientConfig, err := configapi.GetKubeClient(nodeConfig.MasterKubeConfig)
if err != nil {
return err
}
glog.Infof("Starting a node connected to %s", kubeClientConfig.Host)
if err := StartNode(*nodeConfig); err != nil {
return err
}
return nil
}
开发者ID:erinboyd,项目名称:origin,代码行数:50,代码来源:start_node.go
示例5: RunNode
// RunNode takes the options and:
// 1. Creates certs if needed
// 2. Reads fully specified node config OR builds a fully specified node config from the args
// 3. Writes the fully specified node config and exits if needed
// 4. Starts the node based on the fully specified config
func (o NodeOptions) RunNode() error {
if !o.IsRunFromConfig() || o.IsWriteConfigOnly() {
glog.V(2).Infof("Generating node configuration")
if err := o.CreateNodeConfig(); err != nil {
return err
}
}
if o.IsWriteConfigOnly() {
return nil
}
var nodeConfig *configapi.NodeConfig
var err error
if o.IsRunFromConfig() {
nodeConfig, err = configapilatest.ReadAndResolveNodeConfig(o.ConfigFile)
} else {
nodeConfig, err = o.NodeArgs.BuildSerializeableNodeConfig()
}
if err != nil {
return err
}
validationResults := validation.ValidateNodeConfig(nodeConfig, nil)
if len(validationResults.Warnings) != 0 {
for _, warning := range validationResults.Warnings {
glog.Warningf("%v", warning)
}
}
if len(validationResults.Errors) != 0 {
return kerrors.NewInvalid(configapi.Kind("NodeConfig"), o.ConfigFile, validationResults.Errors)
}
if err := ValidateRuntime(nodeConfig, o.NodeArgs.Components); err != nil {
return err
}
if err := StartNode(*nodeConfig, o.NodeArgs.Components); err != nil {
return err
}
return nil
}
开发者ID:poomsujarit,项目名称:origin,代码行数:48,代码来源:start_node.go
示例6: executeAllInOneCommandWithConfigs
func executeAllInOneCommandWithConfigs(args []string) (*MasterArgs, *configapi.MasterConfig, error, *NodeArgs, *configapi.NodeConfig, error) {
argsToUse := make([]string, 0, 4+len(args))
argsToUse = append(argsToUse, "start")
argsToUse = append(argsToUse, args...)
argsToUse = append(argsToUse, "--write-config="+getCleanAllInOneConfigDir())
argsToUse = append(argsToUse, "--create-certs=false")
root := &cobra.Command{
Use: "openshift",
Short: "test",
Long: "",
Run: func(c *cobra.Command, args []string) {
c.Help()
},
}
openshiftStartCommand, cfg := NewCommandStartAllInOne("openshift start", os.Stdout)
root.AddCommand(openshiftStartCommand)
root.SetArgs(argsToUse)
root.Execute()
masterCfg, masterErr := configapilatest.ReadAndResolveMasterConfig(path.Join(getAllInOneConfigDir(), "master", "master-config.yaml"))
var nodeCfg *configapi.NodeConfig
var nodeErr error
nodeConfigs, nodeErr := filepath.Glob(getNodeConfigGlob())
if nodeErr == nil {
if len(nodeConfigs) != 1 {
nodeErr = fmt.Errorf("found wrong number of node configs: %v", nodeConfigs)
} else {
nodeCfg, nodeErr = configapilatest.ReadAndResolveNodeConfig(nodeConfigs[0])
}
}
if nodeCfg == nil && nodeErr == nil {
nodeErr = errors.New("did not find node config")
}
return cfg.MasterOptions.MasterArgs, masterCfg, masterErr, cfg.NodeArgs, nodeCfg, nodeErr
}
开发者ID:Waxolunist,项目名称:origin,代码行数:40,代码来源:command_test.go
注:本文中的github.com/openshift/origin/pkg/cmd/server/api/latest.ReadAndResolveNodeConfig函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论