|
|
|
@ -29,8 +29,8 @@ import (
|
|
|
|
|
"k8s.io/helm/pkg/engine"
|
|
|
|
|
"k8s.io/helm/pkg/kube"
|
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/chart"
|
|
|
|
|
"k8s.io/helm/pkg/proto/hapi/release"
|
|
|
|
|
"k8s.io/helm/pkg/storage"
|
|
|
|
|
"k8s.io/helm/pkg/storage/driver"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// GoTplEngine is the name of the Go template engine, as registered in the EngineYard.
|
|
|
|
@ -85,56 +85,6 @@ type Engine interface {
|
|
|
|
|
Render(*chart.Chart, chartutil.Values) (map[string]string, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ReleaseStorage represents a storage engine for a Release.
|
|
|
|
|
//
|
|
|
|
|
// Release storage must be concurrency safe.
|
|
|
|
|
type ReleaseStorage interface {
|
|
|
|
|
|
|
|
|
|
// Create stores a release in the storage.
|
|
|
|
|
//
|
|
|
|
|
// If a release with the same name exists, this returns an error.
|
|
|
|
|
//
|
|
|
|
|
// It may return other errors in cases where it cannot write to storage.
|
|
|
|
|
Create(*release.Release) error
|
|
|
|
|
// Read takes a name and returns a release that has that name.
|
|
|
|
|
//
|
|
|
|
|
// It will only return releases that are not deleted and not superseded.
|
|
|
|
|
//
|
|
|
|
|
// It will return an error if no relevant release can be found, or if storage
|
|
|
|
|
// is not properly functioning.
|
|
|
|
|
Read(name string) (*release.Release, error)
|
|
|
|
|
|
|
|
|
|
// Update looks for a release with the same name and updates it with the
|
|
|
|
|
// present release contents.
|
|
|
|
|
//
|
|
|
|
|
// For immutable storage backends, this may result in a new release record
|
|
|
|
|
// being created, and the previous release being marked as superseded.
|
|
|
|
|
//
|
|
|
|
|
// It will return an error if a previous release is not found. It may also
|
|
|
|
|
// return an error if the storage backend encounters an error.
|
|
|
|
|
Update(*release.Release) error
|
|
|
|
|
|
|
|
|
|
// Delete marks a Release as deleted.
|
|
|
|
|
//
|
|
|
|
|
// It returns the deleted record. If the record is not found or if the
|
|
|
|
|
// underlying storage encounters an error, this will return an error.
|
|
|
|
|
Delete(name string) (*release.Release, error)
|
|
|
|
|
|
|
|
|
|
// List lists all active (non-deleted, non-superseded) releases.
|
|
|
|
|
//
|
|
|
|
|
// To get deleted or superseded releases, use Query.
|
|
|
|
|
List() ([]*release.Release, error)
|
|
|
|
|
|
|
|
|
|
// Query takes a map of labels and returns any releases that match.
|
|
|
|
|
//
|
|
|
|
|
// Query will search all releases, including deleted and superseded ones.
|
|
|
|
|
// The provided map will be used to filter results.
|
|
|
|
|
Query(map[string]string) ([]*release.Release, error)
|
|
|
|
|
|
|
|
|
|
// History takes a release name and returns the history of releases.
|
|
|
|
|
History(name string) ([]*release.Release, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// KubeClient represents a client capable of communicating with the Kubernetes API.
|
|
|
|
|
//
|
|
|
|
|
// A KubeClient must be concurrency safe.
|
|
|
|
@ -196,7 +146,7 @@ type Environment struct {
|
|
|
|
|
// EngineYard provides access to the known template engines.
|
|
|
|
|
EngineYard EngineYard
|
|
|
|
|
// Releases stores records of releases.
|
|
|
|
|
Releases ReleaseStorage
|
|
|
|
|
Releases *storage.Storage
|
|
|
|
|
// KubeClient is a Kubernetes API client.
|
|
|
|
|
KubeClient KubeClient
|
|
|
|
|
}
|
|
|
|
@ -211,7 +161,7 @@ func New() *Environment {
|
|
|
|
|
}
|
|
|
|
|
return &Environment{
|
|
|
|
|
EngineYard: ey,
|
|
|
|
|
Releases: storage.NewMemory(),
|
|
|
|
|
Releases: storage.Init(driver.NewMemory()),
|
|
|
|
|
KubeClient: kube.New(nil), //&PrintingKubeClient{Out: os.Stdout},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|