本文整理汇总了Golang中github.com/openshift/origin/pkg/cmd/cli/describe.NewLatestDeploymentsDescriber函数的典型用法代码示例。如果您正苦于以下问题:Golang NewLatestDeploymentsDescriber函数的具体用法?Golang NewLatestDeploymentsDescriber怎么用?Golang NewLatestDeploymentsDescriber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewLatestDeploymentsDescriber函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RunDeploy
func (o *DeployOptions) RunDeploy() error {
r := o.builder.
NamespaceParam(o.namespace).
ResourceTypeOrNameArgs(false, o.deploymentConfigName).
SingleResourceType().
Do()
resultObj, err := r.Object()
if err != nil {
return err
}
config, ok := resultObj.(*deployapi.DeploymentConfig)
if !ok {
return fmt.Errorf("%s is not a valid deploymentconfig", o.deploymentConfigName)
}
switch {
case o.deployLatest:
err = o.deploy(config, o.out)
case o.retryDeploy:
err = o.retry(config, o.out)
case o.cancelDeploy:
err = o.cancel(config, o.out)
case o.enableTriggers:
err = o.reenableTriggers(config, o.out)
default:
describer := describe.NewLatestDeploymentsDescriber(o.osClient, o.kubeClient, -1)
desc, err := describer.Describe(config.Namespace, config.Name)
if err != nil {
return err
}
fmt.Fprint(o.out, desc)
}
return err
}
示例2: RunDeploy
func (o DeployOptions) RunDeploy() error {
config, err := o.osClient.DeploymentConfigs(o.namespace).Get(o.deploymentConfigName)
if err != nil {
return err
}
commandClient := &deployCommandClientImpl{
GetDeploymentFn: func(namespace, name string) (*kapi.ReplicationController, error) {
return o.kubeClient.ReplicationControllers(namespace).Get(name)
},
ListDeploymentsForConfigFn: func(namespace, configName string) (*kapi.ReplicationControllerList, error) {
list, err := o.kubeClient.ReplicationControllers(namespace).List(deployutil.ConfigSelector(configName))
if err != nil {
return nil, err
}
return list, nil
},
UpdateDeploymentConfigFn: func(config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
return o.osClient.DeploymentConfigs(config.Namespace).Update(config)
},
UpdateDeploymentFn: func(deployment *kapi.ReplicationController) (*kapi.ReplicationController, error) {
return o.kubeClient.ReplicationControllers(deployment.Namespace).Update(deployment)
},
ListDeployerPodsForFn: func(namespace, deploymentName string) (*kapi.PodList, error) {
selector, err := labels.Parse(fmt.Sprintf("%s=%s", deployapi.DeployerPodForDeploymentLabel, deploymentName))
if err != nil {
return nil, err
}
return o.kubeClient.Pods(namespace).List(selector, fields.Everything())
},
DeletePodFn: func(pod *kapi.Pod) error {
return o.kubeClient.Pods(pod.Namespace).Delete(pod.Name, nil)
},
}
switch {
case o.deployLatest:
c := &deployLatestCommand{client: commandClient}
err = c.deploy(config, o.out)
case o.retryDeploy:
c := &retryDeploymentCommand{client: commandClient}
err = c.retry(config, o.out)
case o.cancelDeploy:
c := &cancelDeploymentCommand{client: commandClient}
err = c.cancel(config, o.out)
case o.enableTriggers:
t := &triggerEnabler{
updateConfig: func(namespace string, config *deployapi.DeploymentConfig) (*deployapi.DeploymentConfig, error) {
return o.osClient.DeploymentConfigs(namespace).Update(config)
},
}
err = t.enableTriggers(config, o.out)
default:
describer := describe.NewLatestDeploymentsDescriber(o.osClient, o.kubeClient, -1)
desc, err := describer.Describe(config.Namespace, config.Name)
if err != nil {
return err
}
fmt.Fprint(o.out, desc)
}
return err
}