fix(environment): make KubeClient take multiple files

Rather than just taking a []byte for Install, take a map of
filenames->contents.
pull/613/head
Matt Butcher 9 years ago
parent 6563f55cfb
commit b8bf4db347

@ -38,7 +38,13 @@ type ReleaseStorage interface {
//
// A KubeClient must be concurrency safe.
type KubeClient interface {
Install(manifest []byte) error
// Install takes a map where the key is a "file name" (read: unique relational
// id) and the value is a Kubernetes manifest containing one or more resource
// definitions.
//
// TODO: Can these be in YAML or JSON, or must they be in one particular
// format?
Install(manifests map[string]string) error
}
// Environment provides the context for executing a client request.

@ -30,7 +30,7 @@ func (r *mockReleaseStorage) Set(k string, v *hapi.Release) error {
type mockKubeClient struct {
}
func (k *mockKubeClient) Install(manifest []byte) error {
func (k *mockKubeClient) Install(manifests map[string]string) error {
return nil
}
@ -76,7 +76,9 @@ func TestKubeClient(t *testing.T) {
env := New()
env.KubeClient = kc
if err := env.KubeClient.Install([]byte("apiVersion: v1\n")); err != nil {
manifests := map[string]string{}
if err := env.KubeClient.Install(manifests); err != nil {
t.Errorf("Kubeclient failed: %s", err)
}
}

Loading…
Cancel
Save