예제 #1
0
파일: target.go 프로젝트: michelleN/helm
// 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))
}
예제 #2
0
파일: install.go 프로젝트: colonelmo/helm
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)
}
예제 #3
0
파일: uninstall.go 프로젝트: colonelmo/helm
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))
		}
	}
}
예제 #4
0
파일: install.go 프로젝트: colonelmo/helm
// 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
}