feat(tiller): delete operation runs against Kubernetes

Also fixed a minor formatting issue with Alpine chart in docs.
pull/649/head
Matt Butcher 9 years ago
parent fb8dd39268
commit 6b68e7891f

@ -39,7 +39,7 @@ func rmRelease(cmd *cobra.Command, args []string) error {
// TODO: Handle dry run use case. // TODO: Handle dry run use case.
if removeDryRun { if removeDryRun {
fmt.Printf("Deleting %s\n", args[0]) fmt.Printf("DRY RUN: Deleting %s\n", args[0])
return nil return nil
} }

@ -128,11 +128,15 @@ type KubeClient interface {
// //
// reader must contain a YAML stream (one or more YAML documents separated // reader must contain a YAML stream (one or more YAML documents separated
// by "\n---\n"). // by "\n---\n").
//
// config is optional. If nil, the client will use its existing configuration.
// If set, the client will override its default configuration with the
// passed in one.
Create(namespace string, reader io.Reader) error Create(namespace string, reader io.Reader) error
// Delete destroys one or more resources.
//
// namespace must contain a valid existing namespace.
//
// reader must contain a YAML stream (one or more YAML documents separated
// by "\n---\n").
Delete(namespace string, reader io.Reader) error
} }
// PrintingKubeClient implements KubeClient, but simply prints the reader to // PrintingKubeClient implements KubeClient, but simply prints the reader to
@ -146,6 +150,10 @@ func (p *PrintingKubeClient) Create(ns string, r io.Reader) error {
_, err := io.Copy(p.Out, r) _, err := io.Copy(p.Out, r)
return err return err
} }
func (p *PrintingKubeClient) Delete(ns string, r io.Reader) error {
_, err := io.Copy(p.Out, r)
return err
}
// Environment provides the context for executing a client request. // Environment provides the context for executing a client request.
// //

@ -53,6 +53,9 @@ type mockKubeClient struct {
func (k *mockKubeClient) Create(ns string, r io.Reader) error { func (k *mockKubeClient) Create(ns string, r io.Reader) error {
return nil return nil
} }
func (k *mockKubeClient) Delete(ns string, r io.Reader) error {
return nil
}
var _ Engine = &mockEngine{} var _ Engine = &mockEngine{}
var _ ReleaseStorage = &mockReleaseStorage{} var _ ReleaseStorage = &mockReleaseStorage{}

@ -207,8 +207,12 @@ func (s *releaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR
rel.Info.Status.Code = release.Status_DELETED rel.Info.Status.Code = release.Status_DELETED
rel.Info.Deleted = timeconv.Now() rel.Info.Deleted = timeconv.Now()
// TODO: Once KubeClient is ready, delete the resources. b := bytes.NewBuffer([]byte(rel.Manifest))
log.Println("WARNING: Currently not deleting resources from k8s")
if err := s.env.KubeClient.Delete(s.env.Namespace, b); err != nil {
log.Printf("uninstall: Failed deletion of %q: %s", req.Name, err)
return nil, err
}
if err := s.env.Releases.Update(rel); err != nil { if err := s.env.Releases.Update(rel); err != nil {
log.Printf("uninstall: Failed to store updated release: %s", err) log.Printf("uninstall: Failed to store updated release: %s", err)

@ -5,9 +5,9 @@ metadata:
labels: labels:
heritage: {{.Release.Service}} heritage: {{.Release.Service}}
chartName: {{.Chart.Name}} chartName: {{.Chart.Name}}
chartVersion: {{.Chart.Version}} chartVersion: {{.Chart.Version | quote}}
annotations: annotations:
"helm.sh/created": {{.Release.Time.Seconds}} "helm.sh/created": "{{.Release.Time.Seconds}}"
spec: spec:
restartPolicy: {{default "Never" .restart_policy}} restartPolicy: {{default "Never" .restart_policy}}
containers: containers:

Loading…
Cancel
Save