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


Golang kubectl.Runner類代碼示例

本文整理匯總了Golang中github.com/helm/helm/kubectl.Runner的典型用法代碼示例。如果您正苦於以下問題:Golang Runner類的具體用法?Golang Runner怎麽用?Golang Runner使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: Target

// Target displays information about the cluster
func Target(client kubectl.Runner) {
	out, err := client.ClusterInfo()
	if err != nil {
		log.Err(err.Error())
	}
	log.Msg(string(out))
}
開發者ID:michelleN,項目名稱:helm,代碼行數:8,代碼來源:target.go

示例2: marshalAndCreate

func marshalAndCreate(o interface{}, ns string, client kubectl.Runner) ([]byte, error) {
	var b bytes.Buffer
	if err := codec.JSON.Encode(&b).One(o); err != nil {
		return nil, err
	}
	data := b.Bytes()
	log.Debug("File: %s", string(data))
	return client.Create(data, ns)
}
開發者ID:colonelmo,項目名稱:helm,代碼行數:9,代碼來源:install.go

示例3: uninstallKind

func uninstallKind(kind []*manifest.Manifest, ns, ktype string, dry bool, client kubectl.Runner) {
	for _, o := range kind {
		if dry {
			log.Msg("%s/%s", ktype, o.Name)
		} else {
			out, err := client.Delete(o.Name, ktype, ns)
			if err != nil {
				log.Warn("Could not delete %s %s (Skipping): %s", ktype, o.Name, err)
			}
			log.Info(string(out))
		}
	}
}
開發者ID:colonelmo,項目名稱:helm,代碼行數:13,代碼來源:uninstall.go

示例4: uploadManifests

// uploadManifests sends manifests to Kubectl in a particular order.
func uploadManifests(c *chart.Chart, namespace string, client kubectl.Runner) error {

	// Install known kinds in a predictable order.
	for _, k := range InstallOrder {
		for _, m := range c.Kind[k] {
			o := m.VersionedObject
			o.AddAnnotations(map[string]string{
				chart.AnnFile:         m.Source,
				chart.AnnChartVersion: c.Chartfile.Version,
				chart.AnnChartDesc:    c.Chartfile.Description,
				chart.AnnChartName:    c.Chartfile.Name,
			})
			var data []byte
			var err error
			if data, err = o.JSON(); err != nil {
				return err
			}
			log.Debug("File: %s", string(data))
			out, err := client.Create(data, namespace)
			log.Msg(string(out))
			if err != nil {
				return err
			}
		}
	}

	// Install unknown kinds afterward. Order here is not predictable.
	for _, k := range c.UnknownKinds(InstallOrder) {
		for _, o := range c.Kind[k] {
			o.VersionedObject.AddAnnotations(map[string]string{chart.AnnFile: o.Source})
			out, err := marshalAndCreate(o.VersionedObject, namespace, client)
			log.Msg(string(out))
			if err != nil {
				return err
			}
		}
	}

	return nil
}
開發者ID:colonelmo,項目名稱:helm,代碼行數:41,代碼來源:install.go


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