當前位置: 首頁>>代碼示例>>Golang>>正文


Golang DeploymentConfig.Annotations方法代碼示例

本文整理匯總了Golang中github.com/openshift/origin/pkg/deploy/api.DeploymentConfig.Annotations方法的典型用法代碼示例。如果您正苦於以下問題:Golang DeploymentConfig.Annotations方法的具體用法?Golang DeploymentConfig.Annotations怎麽用?Golang DeploymentConfig.Annotations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/openshift/origin/pkg/deploy/api.DeploymentConfig的用法示例。


在下文中一共展示了DeploymentConfig.Annotations方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: deploy

// deploy launches a new deployment unless there's already a deployment
// process in progress for config.
func (o DeployOptions) deploy(config *deployapi.DeploymentConfig, out io.Writer) error {
	// TODO: This implies that deploymentconfig.status.latestVersion is always synced. Currently,
	// that's the case because clients (oc, trigger controllers) are updating the status directly.
	// Clients should be acting either on spec or on annotations and status updates should be a
	// responsibility of the main controller. We need to start by unplugging this assumption from
	// our client tools.
	deploymentName := deployutil.LatestDeploymentNameForConfig(config)
	deployment, err := o.kubeClient.ReplicationControllers(config.Namespace).Get(deploymentName)
	if err == nil {
		// Reject attempts to start a concurrent deployment.
		status := deployutil.DeploymentStatusFor(deployment)
		if status != deployapi.DeploymentStatusComplete && status != deployapi.DeploymentStatusFailed {
			return fmt.Errorf("#%d is already in progress (%s).\nOptionally, you can cancel this deployment using the --cancel option.", config.Status.LatestVersion, status)
		}
	} else {
		if !kerrors.IsNotFound(err) {
			return err
		}
	}

	if config.Annotations == nil {
		config.Annotations = make(map[string]string)
	}
	config.Annotations[deployapi.DeploymentInstantiatedAnnotation] = deployapi.DeploymentInstantiatedAnnotationValue
	dc, err := o.osClient.DeploymentConfigs(config.Namespace).Update(config)
	if err != nil {
		return err
	}
	fmt.Fprintf(out, "Started deployment #%d\n", dc.Status.LatestVersion)
	fmt.Fprintf(out, "Use '%s logs -f dc/%s' to track its progress.\n", o.baseCommandName, dc.Name)
	return nil
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:34,代碼來源:deploy.go

示例2: Instantiate

func Instantiate(dc deployapi.DeploymentConfig) *deployapi.DeploymentConfig {
	if dc.Annotations == nil {
		dc.Annotations = make(map[string]string)
	}
	dc.Annotations[deployapi.DeploymentInstantiatedAnnotation] = deployapi.DeploymentInstantiatedAnnotationValue
	return &dc
}
開發者ID:RomainVabre,項目名稱:origin,代碼行數:7,代碼來源:util.go


注:本文中的github.com/openshift/origin/pkg/deploy/api.DeploymentConfig.Annotations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。