本文整理汇总了Golang中github.com/openshift/origin/pkg/cmd/server/api.Kind函数的典型用法代码示例。如果您正苦于以下问题:Golang Kind函数的具体用法?Golang Kind怎么用?Golang Kind使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Kind函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: RunEtcdServer
// RunEtcdServer takes the options and starts the etcd server
func (o *EtcdOptions) RunEtcdServer() error {
masterConfig, err := configapilatest.ReadAndResolveMasterConfig(o.ConfigFile)
if err != nil {
return err
}
validationResults := validation.ValidateMasterConfig(masterConfig, 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("MasterConfig"), o.ConfigFile, validationResults.Errors)
}
if masterConfig.EtcdConfig == nil {
return kerrors.NewInvalid(configapi.Kind("MasterConfig.EtcConfig"), o.ConfigFile, field.ErrorList{field.Required(field.NewPath("etcdConfig"), "")})
}
etcdserver.RunEtcd(masterConfig.EtcdConfig)
return nil
}
开发者ID:pweil-,项目名称:origin,代码行数:24,代码来源:start_etcd.go
示例2: 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)
}
_, 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:rrati,项目名称:origin,代码行数:50,代码来源:start_node.go
示例3: 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("Warning: %v, node start will continue.", 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:php-coder,项目名称:origin,代码行数:48,代码来源:start_node.go
示例4: RunMaster
// RunMaster takes the options and:
// 1. Creates certs if needed
// 2. Reads fully specified master config OR builds a fully specified master config from the args
// 3. Writes the fully specified master config and exits if needed
// 4. Starts the master based on the fully specified config
func (o MasterOptions) RunMaster() error {
startUsingConfigFile := !o.IsWriteConfigOnly() && o.IsRunFromConfig()
if !startUsingConfigFile && o.CreateCertificates {
glog.V(2).Infof("Generating master configuration")
if err := o.CreateCerts(); err != nil {
return err
}
if err := o.CreateBootstrapPolicy(); err != nil {
return err
}
}
var masterConfig *configapi.MasterConfig
var err error
if startUsingConfigFile {
masterConfig, err = configapilatest.ReadAndResolveMasterConfig(o.ConfigFile)
} else {
masterConfig, err = o.MasterArgs.BuildSerializeableMasterConfig()
}
if err != nil {
return err
}
if o.IsWriteConfigOnly() {
// Resolve relative to CWD
cwd, err := os.Getwd()
if err != nil {
return err
}
if err := configapi.ResolveMasterConfigPaths(masterConfig, cwd); err != nil {
return err
}
// Relativize to config file dir
base, err := cmdutil.MakeAbs(filepath.Dir(o.MasterArgs.GetConfigFileToWrite()), cwd)
if err != nil {
return err
}
if err := configapi.RelativizeMasterConfigPaths(masterConfig, base); err != nil {
return err
}
content, err := configapilatest.WriteYAML(masterConfig)
if err != nil {
return err
}
if err := os.MkdirAll(path.Dir(o.MasterArgs.GetConfigFileToWrite()), os.FileMode(0755)); err != nil {
return err
}
if err := ioutil.WriteFile(o.MasterArgs.GetConfigFileToWrite(), content, 0644); err != nil {
return err
}
fmt.Fprintf(o.Output, "Wrote master config to: %s\n", o.MasterArgs.GetConfigFileToWrite())
return nil
}
if o.MasterArgs.OverrideConfig != nil {
if err := o.MasterArgs.OverrideConfig(masterConfig); err != nil {
return err
}
}
// Inject disabled feature flags based on distribution being used and
// regardless of configuration. They aren't written to config file to
// prevent upgrade path issues.
masterConfig.DisabledFeatures.Add(o.DisabledFeatures...)
validationResults := validation.ValidateMasterConfig(masterConfig, 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("MasterConfig"), o.ConfigFile, validationResults.Errors)
}
if !o.MasterArgs.StartControllers {
masterConfig.Controllers = configapi.ControllersDisabled
}
m := &Master{
config: masterConfig,
api: o.MasterArgs.StartAPI,
controllers: o.MasterArgs.StartControllers,
}
return m.Start()
}
开发者ID:sgallagher,项目名称:origin,代码行数:97,代码来源:start_master.go
注:本文中的github.com/openshift/origin/pkg/cmd/server/api.Kind函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论