Merge pull request #13 from technosophos/fix/kubeclient-iface

fix(environment): make KubeClient take multiple files
pull/613/head
Matt Butcher 8 years ago
commit a4a0c79fc4

@ -57,7 +57,13 @@ type ReleaseStorage interface {
// //
// A KubeClient must be concurrency safe. // A KubeClient must be concurrency safe.
type KubeClient interface { 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. // 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 { type mockKubeClient struct {
} }
func (k *mockKubeClient) Install(manifest []byte) error { func (k *mockKubeClient) Install(manifests map[string]string) error {
return nil return nil
} }
@ -76,7 +76,9 @@ func TestKubeClient(t *testing.T) {
env := New() env := New()
env.KubeClient = kc 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) t.Errorf("Kubeclient failed: %s", err)
} }
} }

Loading…
Cancel
Save