コード例 #1
0
ファイル: uninstall.go プロジェクト: colonelmo/helm
// deleteChart deletes all of the Kubernetes manifests associated with this chart.
func deleteChart(c *chart.Chart, ns string, dry bool, client kubectl.Runner) error {
	// Unknown kinds get uninstalled first because we know that core kinds
	// do not depend on them.
	for _, kind := range c.UnknownKinds(UninstallOrder) {
		uninstallKind(c.Kind[kind], ns, kind, dry, client)
	}

	// Uninstall all of the known kinds in a particular order.
	for _, kind := range UninstallOrder {
		uninstallKind(c.Kind[kind], ns, kind, dry, client)
	}

	return nil
}
コード例 #2
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
}