mirror of https://github.com/helm/helm
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
57 lines
1.5 KiB
package environment
|
|
|
|
import (
|
|
"github.com/deis/tiller/pkg/hapi"
|
|
)
|
|
|
|
// EngineYard maps engine names to engine implementations.
|
|
type EngineYard map[string]Engine
|
|
|
|
func (y EngineYard) Get(k string) (Engine, bool) {
|
|
e, ok := y[k]
|
|
return e, ok
|
|
}
|
|
|
|
// Engine represents a template engine that can render templates.
|
|
//
|
|
// For some engines, "rendering" includes both compiling and executing. (Other
|
|
// engines do not distinguish between phases.)
|
|
//
|
|
// An Engine must be capable of executing multiple concurrent requests, but
|
|
// without tainting one request's environment with data from another request.
|
|
type Engine interface {
|
|
Render(*hapi.Chart, *hapi.Values) ([]byte, error)
|
|
}
|
|
|
|
// ReleaseStorage represents a storage engine for a Release.
|
|
//
|
|
// Release storage must be concurrency safe.
|
|
type ReleaseStorage interface {
|
|
Get(key string) (*hapi.Release, error)
|
|
Set(key string, val *hapi.Release) error
|
|
}
|
|
|
|
// KubeClient represents a client capable of communicating with the Kubernetes API.
|
|
//
|
|
// A KubeClient must be concurrency safe.
|
|
type KubeClient interface {
|
|
Install(manifest []byte) error
|
|
}
|
|
|
|
// Environment provides the context for executing a client request.
|
|
//
|
|
// All services in a context are concurrency safe.
|
|
type Environment struct {
|
|
// EngineYard provides access to the known template engines.
|
|
EngineYard EngineYard
|
|
// Releases stores records of releases.
|
|
Releases ReleaseStorage
|
|
// KubeClient is a Kubernetes API client.
|
|
KubeClient KubeClient
|
|
}
|
|
|
|
// New returns an environment initialized with the defaults.
|
|
func New() *Environment {
|
|
return &Environment{}
|
|
}
|