Unverified Commit de5a6a93 authored by Adam Reese's avatar Adam Reese Committed by GitHub

Merge pull request #4734 from adamreese/ref/kube-1.12

ref(*): kubernetes v1.12 support
parents e7d93f23 dbf84cd2
......@@ -28,10 +28,10 @@ import (
"google.golang.org/grpc/status"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
// Import to initialize client auth plugins.
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/helm/pkg/helm"
helm_env "k8s.io/helm/pkg/helm/environment"
"k8s.io/helm/pkg/helm/portforwarder"
......@@ -256,21 +256,6 @@ func getKubeClient(context string, kubeconfig string) (*rest.Config, kubernetes.
return config, client, nil
}
// getInternalKubeClient creates a Kubernetes config and an "internal" client for a given kubeconfig context.
//
// Prefer the similar getKubeClient if you don't need to use such an internal client.
func getInternalKubeClient(context string, kubeconfig string) (internalclientset.Interface, error) {
config, err := configForContext(context, kubeconfig)
if err != nil {
return nil, err
}
client, err := internalclientset.NewForConfig(config)
if err != nil {
return nil, fmt.Errorf("could not get Kubernetes client: %s", err)
}
return client, nil
}
// ensureHelmClient returns a new helm client impl. if h is not nil.
func ensureHelmClient(h helm.Interface) helm.Interface {
if h != nil {
......
......@@ -19,8 +19,8 @@ package installer // import "k8s.io/helm/cmd/helm/installer"
import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
coreclient "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/client-go/kubernetes"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
)
const (
......@@ -30,7 +30,7 @@ const (
)
// Uninstall uses Kubernetes client to uninstall Tiller.
func Uninstall(client internalclientset.Interface, opts *Options) error {
func Uninstall(client kubernetes.Interface, opts *Options) error {
if err := deleteService(client.Core(), opts.Namespace); err != nil {
return err
}
......@@ -41,7 +41,7 @@ func Uninstall(client internalclientset.Interface, opts *Options) error {
}
// deleteService deletes the Tiller Service resource
func deleteService(client coreclient.ServicesGetter, namespace string) error {
func deleteService(client corev1.ServicesGetter, namespace string) error {
err := client.Services(namespace).Delete(serviceName, &metav1.DeleteOptions{})
return ingoreNotFound(err)
}
......@@ -49,13 +49,13 @@ func deleteService(client coreclient.ServicesGetter, namespace string) error {
// deleteDeployment deletes the Tiller Deployment resource
// We need to use the reaper instead of the kube API because GC for deployment dependents
// is not yet supported at the k8s server level (<= 1.5)
func deleteDeployment(client internalclientset.Interface, namespace string) error {
func deleteDeployment(client kubernetes.Interface, namespace string) error {
err := client.Extensions().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{})
return ingoreNotFound(err)
}
// deleteSecret deletes the Tiller Secret resource
func deleteSecret(client coreclient.SecretsGetter, namespace string) error {
func deleteSecret(client corev1.SecretsGetter, namespace string) error {
err := client.Secrets(namespace).Delete(secretName, &metav1.DeleteOptions{})
return ingoreNotFound(err)
}
......
......@@ -19,17 +19,17 @@ package installer // import "k8s.io/helm/cmd/helm/installer"
import (
"testing"
"k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/kubernetes/fake"
testcore "k8s.io/client-go/testing"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
)
func TestUninstall(t *testing.T) {
fc := &fake.Clientset{}
opts := &Options{Namespace: core.NamespaceDefault}
opts := &Options{Namespace: v1.NamespaceDefault}
if err := Uninstall(fc, opts); err != nil {
t.Errorf("unexpected error: %#+v", err)
}
......@@ -45,7 +45,7 @@ func TestUninstall_serviceNotFound(t *testing.T) {
return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "services"}, "1")
})
opts := &Options{Namespace: core.NamespaceDefault}
opts := &Options{Namespace: v1.NamespaceDefault}
if err := Uninstall(fc, opts); err != nil {
t.Errorf("unexpected error: %#+v", err)
}
......@@ -58,10 +58,10 @@ func TestUninstall_serviceNotFound(t *testing.T) {
func TestUninstall_deploymentNotFound(t *testing.T) {
fc := &fake.Clientset{}
fc.AddReactor("delete", "deployments", func(action testcore.Action) (bool, runtime.Object, error) {
return true, nil, apierrors.NewNotFound(core.Resource("deployments"), "1")
return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "deployments"}, "1")
})
opts := &Options{Namespace: core.NamespaceDefault}
opts := &Options{Namespace: v1.NamespaceDefault}
if err := Uninstall(fc, opts); err != nil {
t.Errorf("unexpected error: %#+v", err)
}
......@@ -74,10 +74,10 @@ func TestUninstall_deploymentNotFound(t *testing.T) {
func TestUninstall_secretNotFound(t *testing.T) {
fc := &fake.Clientset{}
fc.AddReactor("delete", "secrets", func(action testcore.Action) (bool, runtime.Object, error) {
return true, nil, apierrors.NewNotFound(core.Resource("secrets"), "1")
return true, nil, apierrors.NewNotFound(schema.GroupResource{Resource: "secrets"}, "1")
})
opts := &Options{Namespace: core.NamespaceDefault}
opts := &Options{Namespace: v1.NamespaceDefault}
if err := Uninstall(fc, opts); err != nil {
t.Errorf("unexpected error: %#+v", err)
}
......
......@@ -23,7 +23,8 @@ import (
"os"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/client-go/kubernetes"
"k8s.io/helm/cmd/helm/installer"
"k8s.io/helm/pkg/helm"
......@@ -44,7 +45,7 @@ type resetCmd struct {
out io.Writer
home helmpath.Home
client helm.Interface
kubeClient internalclientset.Interface
kubeClient kubernetes.Interface
}
func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command {
......@@ -90,7 +91,7 @@ func newResetCmd(client helm.Interface, out io.Writer) *cobra.Command {
// runReset uninstalls tiller from Kubernetes Cluster and deletes local config
func (d *resetCmd) run() error {
if d.kubeClient == nil {
c, err := getInternalKubeClient(settings.KubeContext, settings.KubeConfig)
_, c, err := getKubeClient(settings.KubeContext, settings.KubeConfig)
if err != nil {
return fmt.Errorf("could not get kubernetes client: %s", err)
}
......
......@@ -23,8 +23,8 @@ import (
"strings"
"testing"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm/helmpath"
......@@ -101,7 +101,7 @@ func verifyResetCmd(t *testing.T, tc resetCase) {
home: helmpath.Home(home),
client: c,
kubeClient: fc,
namespace: core.NamespaceDefault,
namespace: v1.NamespaceDefault,
}
err = cmd.run()
......
......@@ -21,12 +21,12 @@ import (
"fmt"
"net"
"github.com/spf13/pflag"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/client-go/kubernetes"
"github.com/spf13/pflag"
"k8s.io/helm/pkg/kube"
rudderAPI "k8s.io/helm/pkg/proto/hapi/rudder"
"k8s.io/helm/pkg/tiller"
......@@ -34,7 +34,7 @@ import (
)
var kubeClient *kube.Client
var clientset internalclientset.Interface
var clientset kubernetes.Interface
type options struct {
listen string
......@@ -59,7 +59,7 @@ func main() {
opts.regAndParseFlags()
var err error
kubeClient = kube.New(nil)
clientset, err = kubeClient.ClientSet()
clientset, err = kubeClient.KubernetesClientSet()
if err != nil {
grpclog.Fatalf("Cannot initialize Kubernetes connection: %s", err)
}
......
......@@ -39,6 +39,7 @@ import (
// Import to initialize client auth plugins.
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/proto/hapi/services"
"k8s.io/helm/pkg/storage"
......@@ -120,7 +121,7 @@ func start() {
healthSrv := health.NewServer()
healthSrv.SetServingStatus("Tiller", healthpb.HealthCheckResponse_NOT_SERVING)
clientset, err := kube.New(nil).ClientSet()
clientset, err := kube.New(nil).KubernetesClientSet()
if err != nil {
logger.Fatalf("Cannot initialize Kubernetes connection: %s", err)
}
......@@ -129,13 +130,13 @@ func start() {
case storageMemory:
env.Releases = storage.Init(driver.NewMemory())
case storageConfigMap:
cfgmaps := driver.NewConfigMaps(clientset.Core().ConfigMaps(namespace()))
cfgmaps := driver.NewConfigMaps(clientset.CoreV1().ConfigMaps(namespace()))
cfgmaps.Log = newLogger("storage/driver").Printf
env.Releases = storage.Init(cfgmaps)
env.Releases.Log = newLogger("storage").Printf
case storageSecret:
secrets := driver.NewSecrets(clientset.Core().Secrets(namespace()))
secrets := driver.NewSecrets(clientset.CoreV1().Secrets(namespace()))
secrets.Log = newLogger("storage/driver").Printf
env.Releases = storage.Init(secrets)
......
This diff is collapsed.
package: k8s.io/helm
import:
- package: golang.org/x/net
subpackages:
- context
- package: github.com/spf13/cobra
version: c439c4fa093711d42e1b01acb1235b52004753c1
- package: github.com/spf13/pflag
version: 583c0c0531f06d5278b7d917446061adc344b5cd
- package: github.com/Masterminds/vcs
version: ~1.11.0
- package: golang.org/x/net
subpackages:
- context
- package: github.com/spf13/cobra
version: c439c4fa093711d42e1b01acb1235b52004753c1
- package: github.com/spf13/pflag
version: ~1.0.1
- package: github.com/Masterminds/vcs
# Pin version of mergo that is compatible with both sprig and Kubernetes
- package: github.com/imdario/mergo
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
- package: github.com/Masterminds/sprig
version: ^2.16.0
- package: github.com/ghodss/yaml
- package: github.com/Masterminds/semver
version: ~1.3.1
- package: github.com/technosophos/moniker
version: ~0.2
- package: github.com/golang/protobuf
version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9
subpackages:
- proto
- ptypes/any
- ptypes/timestamp
- package: google.golang.org/grpc
version: 1.7.2
- package: github.com/gosuri/uitable
- package: github.com/asaskevich/govalidator
version: ^4.0.0
- package: golang.org/x/crypto
subpackages:
- openpgp
- ssh/terminal
# pin version of golang.org/x/sys that is compatible with golang.org/x/crypto
- package: golang.org/x/sys
version: 43eea11
subpackages:
- unix
- windows
- package: github.com/gobwas/glob
version: ^0.2.1
- package: github.com/evanphx/json-patch
- package: github.com/BurntSushi/toml
version: ~0.3.0
- package: github.com/prometheus/client_golang
version: 0.8.0
- package: github.com/grpc-ecosystem/go-grpc-prometheus
- package: github.com/imdario/mergo
version: v0.3.5
- package: github.com/Masterminds/sprig
version: ^2.16.0
- package: github.com/ghodss/yaml
- package: github.com/Masterminds/semver
version: ~1.3.1
- package: github.com/technosophos/moniker
version: ~0.2
- package: github.com/golang/protobuf
version: 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9
subpackages:
- proto
- ptypes/any
- ptypes/timestamp
- package: google.golang.org/grpc
version: 1.7.2
- package: github.com/gosuri/uitable
- package: github.com/asaskevich/govalidator
version: ^4.0.0
- package: golang.org/x/crypto
subpackages:
- openpgp
- ssh/terminal
- package: github.com/gobwas/glob
version: ^0.2.1
- package: github.com/evanphx/json-patch
- package: github.com/BurntSushi/toml
version: ~0.3.0
- package: github.com/prometheus/client_golang
version: 0.8.0
- package: github.com/grpc-ecosystem/go-grpc-prometheus
- package: k8s.io/kubernetes
version: release-1.11
- package: k8s.io/client-go
version: kubernetes-1.11.1
- package: k8s.io/api
version: kubernetes-1.11.1
- package: k8s.io/apimachinery
version: kubernetes-1.11.1
- package: k8s.io/apiserver
version: kubernetes-1.11.1
- package: github.com/cyphar/filepath-securejoin
version: ^0.2.1
- package: k8s.io/kubernetes
version: release-1.12
- package: k8s.io/client-go
version: kubernetes-1.12.0
- package: k8s.io/api
version: kubernetes-1.12.0
- package: k8s.io/apimachinery
version: kubernetes-1.12.0
- package: k8s.io/apiserver
version: kubernetes-1.12.0
- package: k8s.io/cli-runtime
version: kubernetes-1.12.0
- package: github.com/cyphar/filepath-securejoin
version: ^0.2.1
testImports:
- package: github.com/stretchr/testify
version: ^1.1.4
subpackages:
- assert
- package: github.com/stretchr/testify
version: ^1.1.4
subpackages:
- assert
......@@ -76,7 +76,7 @@ func TestGetFirstPod(t *testing.T) {
for _, tt := range tests {
client := fake.NewSimpleClientset(&v1.PodList{Items: tt.pods})
name, err := GetTillerPodName(client.Core(), v1.NamespaceDefault)
name, err := GetTillerPodName(client.CoreV1(), v1.NamespaceDefault)
if (err != nil) != tt.err {
t.Errorf("%q. expected error: %v, got %v", tt.name, tt.err, err)
}
......
......@@ -18,6 +18,7 @@ package kube // import "k8s.io/helm/pkg/kube"
import (
"bytes"
"context"
"encoding/json"
goerrors "errors"
"fmt"
......@@ -42,20 +43,19 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
watchtools "k8s.io/client-go/tools/watch"
"k8s.io/kubernetes/pkg/api/legacyscheme"
batchinternal "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl/cmd/get"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/kubernetes/pkg/kubectl/validation"
)
const (
// MissingGetHeader is added to Get's output when a resource is not found.
MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n"
)
// MissingGetHeader is added to Get's output when a resource is not found.
const MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n"
// ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found.
var ErrNoObjectsVisited = goerrors.New("no objects visited")
......@@ -86,7 +86,7 @@ type ResourceActorFunc func(*resource.Info) error
//
// Namespace will set the namespace.
func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shouldWait bool) error {
client, err := c.ClientSet()
client, err := c.KubernetesClientSet()
if err != nil {
return err
}
......@@ -163,7 +163,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) {
return "", err
}
var objPods = make(map[string][]core.Pod)
var objPods = make(map[string][]v1.Pod)
missing := []string{}
err = perform(infos, func(info *resource.Info) error {
......@@ -368,7 +368,7 @@ func perform(infos Result, fn ResourceActorFunc) error {
}
func createResource(info *resource.Info) error {
obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object)
obj, err := resource.NewHelper(info.Client, info.Mapping).Create(info.Namespace, true, info.Object, nil)
if err != nil {
return err
}
......@@ -438,7 +438,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
// send patch to server
helper := resource.NewHelper(target.Client, target.Mapping)
obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch)
obj, err := helper.Patch(target.Namespace, target.Name, patchType, patch, nil)
if err != nil {
kind := target.Mapping.GroupVersionKind.Kind
log.Printf("Cannot patch %s: %q (%v)", kind, target.Name, err)
......@@ -479,12 +479,12 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
return nil
}
client, err := c.ClientSet()
client, err := c.KubernetesClientSet()
if err != nil {
return err
}
pods, err := client.Core().Pods(target.Namespace).List(metav1.ListOptions{
pods, err := client.CoreV1().Pods(target.Namespace).List(metav1.ListOptions{
FieldSelector: fields.Everything().String(),
LabelSelector: labels.Set(selector).AsSelector().String(),
})
......@@ -497,7 +497,7 @@ func updateResource(c *Client, target *resource.Info, currentObj runtime.Object,
c.Log("Restarting pod: %v/%v", pod.Namespace, pod.Name)
// Delete each pod for get them restarted with changed spec.
if err := client.Core().Pods(pod.Namespace).Delete(pod.Name, metav1.NewPreconditionDeleteOptions(string(pod.UID))); err != nil {
if err := client.CoreV1().Pods(pod.Namespace).Delete(pod.Name, metav1.NewPreconditionDeleteOptions(string(pod.UID))); err != nil {
return err
}
}
......@@ -561,7 +561,9 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err
// In the future, we might want to add some special logic for types
// like Ingress, Volume, etc.
_, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) {
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout)
defer cancel()
_, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) {
switch e.Type {
case watch.Added, watch.Modified:
// For things like a secret or a config map, this is the best indicator
......@@ -623,26 +625,26 @@ func scrubValidationError(err error) error {
// WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase
// and returns said phase (PodSucceeded or PodFailed qualify).
func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) {
infos, err := c.Build(namespace, reader)
if err != nil {
return core.PodUnknown, err
return v1.PodUnknown, err
}
info := infos[0]
kind := info.Mapping.GroupVersionKind.Kind
if kind != "Pod" {
return core.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name)
return v1.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name)
}
if err := c.watchPodUntilComplete(timeout, info); err != nil {
return core.PodUnknown, err
return v1.PodUnknown, err
}
if err := info.Get(); err != nil {
return core.PodUnknown, err
return v1.PodUnknown, err
}
status := info.Object.(*core.Pod).Status.Phase
status := info.Object.(*v1.Pod).Status.Phase
return status, nil
}
......@@ -654,7 +656,9 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf
}
c.Log("Watching pod %s for completion with timeout of %v", info.Name, timeout)
_, err = watch.Until(timeout, w, func(e watch.Event) (bool, error) {
ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout)
defer cancel()
_, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) {
return isPodComplete(e)
})
......@@ -662,15 +666,15 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf
}
func isPodComplete(event watch.Event) (bool, error) {
o, ok := event.Object.(*core.Pod)
o, ok := event.Object.(*v1.Pod)
if !ok {
return true, fmt.Errorf("expected a *core.Pod, got %T", event.Object)
return true, fmt.Errorf("expected a *v1.Pod, got %T", event.Object)
}
if event.Type == watch.Deleted {
return false, fmt.Errorf("pod not found")
}
switch o.Status.Phase {
case core.PodFailed, core.PodSucceeded:
case v1.PodFailed, v1.PodSucceeded:
return true, nil
}
return false, nil
......@@ -678,7 +682,7 @@ func isPodComplete(event watch.Event) (bool, error) {
//get a kubernetes resources' relation pods
// kubernetes resource used select labels to relate pods
func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) {
func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]v1.Pod) (map[string][]v1.Pod, error) {
if info == nil {
return objPods, nil
}
......@@ -691,9 +695,9 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]
return objPods, nil
}
client, _ := c.ClientSet()
client, _ := c.KubernetesClientSet()
pods, err := client.Core().Pods(info.Namespace).List(metav1.ListOptions{
pods, err := client.CoreV1().Pods(info.Namespace).List(metav1.ListOptions{
FieldSelector: fields.Everything().String(),
LabelSelector: labels.Set(selector).AsSelector().String(),
})
......@@ -718,7 +722,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]
return objPods, nil
}
func isFoundPod(podItem []core.Pod, pod core.Pod) bool {
func isFoundPod(podItem []v1.Pod, pod v1.Pod) bool {
for _, value := range podItem {
if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) {
return true
......
......@@ -24,15 +24,15 @@ import (
"strings"
"testing"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/client-go/rest/fake"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/core"
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/kubernetes/pkg/kubectl/scheme"
)
......@@ -42,34 +42,34 @@ func objBody(codec runtime.Codec, obj runtime.Object) io.ReadCloser {
return ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(codec, obj))))
}
func newPod(name string) core.Pod {
return newPodWithStatus(name, core.PodStatus{}, "")
func newPod(name string) v1.Pod {
return newPodWithStatus(name, v1.PodStatus{}, "")
}
func newPodWithStatus(name string, status core.PodStatus, namespace string) core.Pod {
ns := core.NamespaceDefault
func newPodWithStatus(name string, status v1.PodStatus, namespace string) v1.Pod {
ns := v1.NamespaceDefault
if namespace != "" {
ns = namespace
}
return core.Pod{
return v1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: ns,
SelfLink: "/api/v1/namespaces/default/pods/" + name,
},
Spec: core.PodSpec{
Containers: []core.Container{{
Spec: v1.PodSpec{
Containers: []v1.Container{{
Name: "app:v4",
Image: "abc/app:v4",
Ports: []core.ContainerPort{{Name: "http", ContainerPort: 80}},
Ports: []v1.ContainerPort{{Name: "http", ContainerPort: 80}},
}},
},
Status: status,
}
}
func newPodList(names ...string) core.PodList {
var list core.PodList
func newPodList(names ...string) v1.PodList {
var list v1.PodList
for _, name := range names {
list.Items = append(list.Items, newPod(name))
}
......@@ -114,8 +114,8 @@ func TestUpdate(t *testing.T) {
listA := newPodList("starfish", "otter", "squid")
listB := newPodList("starfish", "otter", "dolphin")
listC := newPodList("starfish", "otter", "dolphin")
listB.Items[0].Spec.Containers[0].Ports = []core.ContainerPort{{Name: "https", ContainerPort: 443}}
listC.Items[0].Spec.Containers[0].Ports = []core.ContainerPort{{Name: "https", ContainerPort: 443}}
listB.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}}
listC.Items[0].Spec.Containers[0].Ports = []v1.ContainerPort{{Name: "https", ContainerPort: 443}}
var actions []string
......@@ -163,7 +163,7 @@ func TestUpdate(t *testing.T) {
}
codec := legacyscheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...)
if err := c.Update(core.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil {
if err := c.Update(v1.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil {
t.Fatal(err)
}
// TODO: Find a way to test methods that use Client Set
......
......@@ -17,14 +17,14 @@ limitations under the License.
package kube // import "k8s.io/helm/pkg/kube"
import (
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/client-go/kubernetes"
)
func createNamespace(client internalclientset.Interface, namespace string) error {
ns := &core.Namespace{
func createNamespace(client kubernetes.Interface, namespace string) error {
ns := &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: namespace,
Labels: map[string]string{
......@@ -32,15 +32,15 @@ func createNamespace(client internalclientset.Interface, namespace string) error
},
},
}
_, err := client.Core().Namespaces().Create(ns)
_, err := client.CoreV1().Namespaces().Create(ns)
return err
}
func getNamespace(client internalclientset.Interface, namespace string) (*core.Namespace, error) {
return client.Core().Namespaces().Get(namespace, metav1.GetOptions{})
func getNamespace(client kubernetes.Interface, namespace string) (*v1.Namespace, error) {
return client.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
}
func ensureNamespace(client internalclientset.Interface, namespace string) error {
func ensureNamespace(client kubernetes.Interface, namespace string) error {
_, err := getNamespace(client, namespace)
if err != nil && errors.IsNotFound(err) {
err = createNamespace(client, namespace)
......
......@@ -20,7 +20,7 @@ import (
"testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/client-go/kubernetes/fake"
)
func TestEnsureNamespace(t *testing.T) {
......@@ -31,7 +31,7 @@ func TestEnsureNamespace(t *testing.T) {
if err := ensureNamespace(client, "foo"); err != nil {
t.Fatalf("unexpected error: %s", err)
}
if _, err := client.Core().Namespaces().Get("foo", metav1.GetOptions{}); err != nil {
if _, err := client.CoreV1().Namespaces().Get("foo", metav1.GetOptions{}); err != nil {
t.Fatalf("unexpected error: %s", err)
}
}
......@@ -16,7 +16,7 @@ limitations under the License.
package kube // import "k8s.io/helm/pkg/kube"
import "k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
import "k8s.io/cli-runtime/pkg/genericclioptions/resource"
// Result provides convenience methods for comparing collections of Infos.
type Result []*resource.Info
......
......@@ -21,7 +21,7 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
)
func TestResult(t *testing.T) {
......
......@@ -22,7 +22,7 @@ import (
"log"
"time"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/api/core/v1"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/proto/hapi/services"
......@@ -49,7 +49,7 @@ func (env *Environment) createTestPod(test *test) error {
return nil
}
func (env *Environment) getTestPodStatus(test *test) (core.PodPhase, error) {
func (env *Environment) getTestPodStatus(test *test) (v1.PodPhase, error) {
b := bytes.NewBufferString(test.manifest)
status, err := env.KubeClient.WaitAndGetCompletedPodPhase(env.Namespace, b, time.Duration(env.Timeout)*time.Second)
if err != nil {
......
......@@ -22,7 +22,7 @@ import (
"github.com/ghodss/yaml"
"github.com/golang/protobuf/ptypes/timestamp"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/api/core/v1"
"k8s.io/helm/pkg/hooks"
"k8s.io/helm/pkg/proto/hapi/release"
......@@ -90,7 +90,7 @@ func (ts *TestSuite) Run(env *Environment) error {
}
resourceCleanExit := true
status := core.PodUnknown
status := v1.PodUnknown
if resourceCreated {
status, err = env.getTestPodStatus(test)
if err != nil {
......@@ -119,15 +119,15 @@ func (ts *TestSuite) Run(env *Environment) error {
return nil
}
func (t *test) assignTestResult(podStatus core.PodPhase) error {
func (t *test) assignTestResult(podStatus v1.PodPhase) error {
switch podStatus {
case core.PodSucceeded:
case v1.PodSucceeded:
if t.expectedSuccess {
t.result.Status = release.TestRun_SUCCESS
} else {
t.result.Status = release.TestRun_FAILURE
}
case core.PodFailed:
case v1.PodFailed:
if !t.expectedSuccess {
t.result.Status = release.TestRun_SUCCESS
} else {
......
......@@ -26,7 +26,7 @@ import (
"golang.org/x/net/context"
grpc "google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/api/core/v1"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/proto/hapi/chart"
......@@ -324,8 +324,8 @@ func newPodSucceededKubeClient() *podSucceededKubeClient {
}
}
func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodSucceeded, nil
func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) {
return v1.PodSucceeded, nil
}
type podFailedKubeClient struct {
......@@ -338,6 +338,6 @@ func newPodFailedKubeClient() *podFailedKubeClient {
}
}
func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodFailed, nil
func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (v1.PodPhase, error) {
return v1.PodFailed, nil
}
......@@ -22,12 +22,12 @@ import (
"strings"
"time"
"k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kblabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
rspb "k8s.io/helm/pkg/proto/hapi/release"
storageerrors "k8s.io/helm/pkg/storage/errors"
......@@ -41,13 +41,13 @@ const ConfigMapsDriverName = "ConfigMap"
// ConfigMaps is a wrapper around an implementation of a kubernetes
// ConfigMapsInterface.
type ConfigMaps struct {
impl internalversion.ConfigMapInterface
impl corev1.ConfigMapInterface
Log func(string, ...interface{})
}
// NewConfigMaps initializes a new ConfigMaps wrapping an implementation of
// the kubernetes ConfigMapsInterface.
func NewConfigMaps(impl internalversion.ConfigMapInterface) *ConfigMaps {
func NewConfigMaps(impl corev1.ConfigMapInterface) *ConfigMaps {
return &ConfigMaps{
impl: impl,
Log: func(_ string, _ ...interface{}) {},
......@@ -229,7 +229,7 @@ func (cfgmaps *ConfigMaps) Delete(key string) (rls *rspb.Release, err error) {
// "OWNER" - owner of the configmap, currently "TILLER".
// "NAME" - name of the release.
//
func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.ConfigMap, error) {
func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*v1.ConfigMap, error) {
const owner = "TILLER"
// encode the release
......@@ -249,7 +249,7 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.Confi
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
// create and return configmap object
return &core.ConfigMap{
return &v1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: key,
Labels: lbs.toMap(),
......
......@@ -19,7 +19,7 @@ import (
"testing"
"github.com/gogo/protobuf/proto"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/api/core/v1"
rspb "k8s.io/helm/pkg/proto/hapi/release"
)
......@@ -69,7 +69,7 @@ func TestUNcompressedConfigMapGet(t *testing.T) {
}
cfgmap.Data["release"] = base64.StdEncoding.EncodeToString(b)
var mock MockConfigMapsInterface
mock.objects = map[string]*core.ConfigMap{key: cfgmap}
mock.objects = map[string]*v1.ConfigMap{key: cfgmap}
cfgmaps := NewConfigMaps(&mock)
// get release with key
......
......@@ -20,10 +20,11 @@ import (
"fmt"
"testing"
"k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/apimachinery/pkg/runtime/schema"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
rspb "k8s.io/helm/pkg/proto/hapi/release"
)
......@@ -76,14 +77,14 @@ func newTestFixtureCfgMaps(t *testing.T, releases ...*rspb.Release) *ConfigMaps
// MockConfigMapsInterface mocks a kubernetes ConfigMapsInterface
type MockConfigMapsInterface struct {
internalversion.ConfigMapInterface
corev1.ConfigMapInterface
objects map[string]*core.ConfigMap
objects map[string]*v1.ConfigMap
}
// Init initializes the MockConfigMapsInterface with the set of releases.
func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Release) {
mock.objects = map[string]*core.ConfigMap{}
mock.objects = map[string]*v1.ConfigMap{}
for _, rls := range releases {
objkey := testKey(rls.Name, rls.Version)
......@@ -97,17 +98,17 @@ func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Releas
}
// Get returns the ConfigMap by name.
func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*core.ConfigMap, error) {
func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*v1.ConfigMap, error) {
object, ok := mock.objects[name]
if !ok {
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name)
}
return object, nil
}
// List returns the a of ConfigMaps.
func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.ConfigMapList, error) {
var list core.ConfigMapList
func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*v1.ConfigMapList, error) {
var list v1.ConfigMapList
for _, cfgmap := range mock.objects {
list.Items = append(list.Items, *cfgmap)
}
......@@ -115,20 +116,20 @@ func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.Config
}
// Create creates a new ConfigMap.
func (mock *MockConfigMapsInterface) Create(cfgmap *core.ConfigMap) (*core.ConfigMap, error) {
func (mock *MockConfigMapsInterface) Create(cfgmap *v1.ConfigMap) (*v1.ConfigMap, error) {
name := cfgmap.ObjectMeta.Name
if object, ok := mock.objects[name]; ok {
return object, apierrors.NewAlreadyExists(core.Resource("tests"), name)
return object, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "tests"}, name)
}
mock.objects[name] = cfgmap
return cfgmap, nil
}
// Update updates a ConfigMap.
func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.ConfigMap, error) {
func (mock *MockConfigMapsInterface) Update(cfgmap *v1.ConfigMap) (*v1.ConfigMap, error) {
name := cfgmap.ObjectMeta.Name
if _, ok := mock.objects[name]; !ok {
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
return nil, apierrors.NewNotFound(v1.Resource("tests"), name)
}
mock.objects[name] = cfgmap
return cfgmap, nil
......@@ -137,7 +138,7 @@ func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.Confi
// Delete deletes a ConfigMap by name.
func (mock *MockConfigMapsInterface) Delete(name string, opts *metav1.DeleteOptions) error {
if _, ok := mock.objects[name]; !ok {
return apierrors.NewNotFound(core.Resource("tests"), name)
return apierrors.NewNotFound(v1.Resource("tests"), name)
}
delete(mock.objects, name)
return nil
......@@ -154,14 +155,14 @@ func newTestFixtureSecrets(t *testing.T, releases ...*rspb.Release) *Secrets {
// MockSecretsInterface mocks a kubernetes SecretsInterface
type MockSecretsInterface struct {
internalversion.SecretInterface
corev1.SecretInterface
objects map[string]*core.Secret
objects map[string]*v1.Secret
}
// Init initializes the MockSecretsInterface with the set of releases.
func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release) {
mock.objects = map[string]*core.Secret{}
mock.objects = map[string]*v1.Secret{}
for _, rls := range releases {
objkey := testKey(rls.Name, rls.Version)
......@@ -175,17 +176,17 @@ func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release)
}
// Get returns the Secret by name.
func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*core.Secret, error) {
func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*v1.Secret, error) {
object, ok := mock.objects[name]
if !ok {
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name)
}
return object, nil
}
// List returns the a of Secret.
func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretList, error) {
var list core.SecretList
func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*v1.SecretList, error) {
var list v1.SecretList
for _, secret := range mock.objects {
list.Items = append(list.Items, *secret)
}
......@@ -193,20 +194,20 @@ func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretLis
}
// Create creates a new Secret.
func (mock *MockSecretsInterface) Create(secret *core.Secret) (*core.Secret, error) {
func (mock *MockSecretsInterface) Create(secret *v1.Secret) (*v1.Secret, error) {
name := secret.ObjectMeta.Name
if object, ok := mock.objects[name]; ok {
return object, apierrors.NewAlreadyExists(core.Resource("tests"), name)
return object, apierrors.NewAlreadyExists(schema.GroupResource{Resource: "tests"}, name)
}
mock.objects[name] = secret
return secret, nil
}
// Update updates a Secret.
func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, error) {
func (mock *MockSecretsInterface) Update(secret *v1.Secret) (*v1.Secret, error) {
name := secret.ObjectMeta.Name
if _, ok := mock.objects[name]; !ok {
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
return nil, apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name)
}
mock.objects[name] = secret
return secret, nil
......@@ -215,7 +216,7 @@ func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, err
// Delete deletes a Secret by name.
func (mock *MockSecretsInterface) Delete(name string, opts *metav1.DeleteOptions) error {
if _, ok := mock.objects[name]; !ok {
return apierrors.NewNotFound(core.Resource("tests"), name)
return apierrors.NewNotFound(schema.GroupResource{Resource: "tests"}, name)
}
delete(mock.objects, name)
return nil
......
......@@ -22,12 +22,12 @@ import (
"strings"
"time"
"k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kblabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
rspb "k8s.io/helm/pkg/proto/hapi/release"
storageerrors "k8s.io/helm/pkg/storage/errors"
......@@ -41,13 +41,13 @@ const SecretsDriverName = "Secret"
// Secrets is a wrapper around an implementation of a kubernetes
// SecretsInterface.
type Secrets struct {
impl internalversion.SecretInterface
impl corev1.SecretInterface
Log func(string, ...interface{})
}
// NewSecrets initializes a new Secrets wrapping an implmenetation of
// the kubernetes SecretsInterface.
func NewSecrets(impl internalversion.SecretInterface) *Secrets {
func NewSecrets(impl corev1.SecretInterface) *Secrets {
return &Secrets{
impl: impl,
Log: func(_ string, _ ...interface{}) {},
......@@ -229,7 +229,7 @@ func (secrets *Secrets) Delete(key string) (rls *rspb.Release, err error) {
// "OWNER" - owner of the secret, currently "TILLER".
// "NAME" - name of the release.
//
func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret, error) {
func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*v1.Secret, error) {
const owner = "TILLER"
// encode the release
......@@ -249,7 +249,7 @@ func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret,
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
// create and return secret object
return &core.Secret{
return &v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: key,
Labels: lbs.toMap(),
......
......@@ -19,7 +19,7 @@ import (
"testing"
"github.com/gogo/protobuf/proto"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/api/core/v1"
rspb "k8s.io/helm/pkg/proto/hapi/release"
)
......@@ -69,7 +69,7 @@ func TestUNcompressedSecretGet(t *testing.T) {
}
secret.Data["release"] = []byte(base64.StdEncoding.EncodeToString(b))
var mock MockSecretsInterface
mock.objects = map[string]*core.Secret{key: secret}
mock.objects = map[string]*v1.Secret{key: secret}
secrets := NewSecrets(&mock)
// get release with key
......
......@@ -26,8 +26,8 @@ import (
"io"
"time"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/api/core/v1"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/engine"
......@@ -140,7 +140,7 @@ type KubeClient interface {
// WaitAndGetCompletedPodPhase waits up to a timeout until a pod enters a completed phase
// and returns said phase (PodSucceeded or PodFailed qualify).
WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error)
WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error)
}
// PrintingKubeClient implements KubeClient, but simply prints the reader to
......@@ -192,9 +192,9 @@ func (p *PrintingKubeClient) BuildUnstructured(ns string, reader io.Reader) (kub
}
// WaitAndGetCompletedPodPhase implements KubeClient WaitAndGetCompletedPodPhase.
func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) {
_, err := io.Copy(p.Out, reader)
return core.PodUnknown, err
return v1.PodUnknown, err
}
// Environment provides the context for executing a client request.
......
......@@ -22,8 +22,8 @@ import (
"testing"
"time"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/api/core/v1"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/kube"
......@@ -61,11 +61,11 @@ func (k *mockKubeClient) Build(ns string, reader io.Reader) (kube.Result, error)
func (k *mockKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) {
return []*resource.Info{}, nil
}
func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodUnknown, nil
func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) {
return v1.PodUnknown, nil
}
func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) {
return "", nil
}
......
......@@ -23,7 +23,7 @@ import (
"log"
"strings"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/client-go/kubernetes"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/kube"
......@@ -46,7 +46,7 @@ type ReleaseModule interface {
// LocalReleaseModule is a local implementation of ReleaseModule
type LocalReleaseModule struct {
clientset internalclientset.Interface
clientset kubernetes.Interface
}
// Create creates a release via kubeclient from provided environment
......
......@@ -28,7 +28,7 @@ import (
"gopkg.in/yaml.v2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/discovery"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/client-go/kubernetes"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/hooks"
......@@ -83,12 +83,12 @@ var ValidName = regexp.MustCompile("^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+
type ReleaseServer struct {
ReleaseModule
env *environment.Environment
clientset internalclientset.Interface
clientset kubernetes.Interface
Log func(string, ...interface{})
}
// NewReleaseServer creates a new release server.
func NewReleaseServer(env *environment.Environment, clientset internalclientset.Interface, useRemote bool) *ReleaseServer {
func NewReleaseServer(env *environment.Environment, clientset kubernetes.Interface, useRemote bool) *ReleaseServer {
var releaseModule ReleaseModule
if useRemote {
releaseModule = &RemoteReleaseModule{}
......
......@@ -31,9 +31,9 @@ import (
"github.com/technosophos/moniker"
"golang.org/x/net/context"
"google.golang.org/grpc/metadata"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions/resource"
"k8s.io/api/core/v1"
"k8s.io/cli-runtime/pkg/genericclioptions/resource"
"k8s.io/client-go/kubernetes/fake"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/hooks"
......@@ -605,8 +605,8 @@ func (kc *mockHooksKubeClient) Build(ns string, reader io.Reader) (kube.Result,
func (kc *mockHooksKubeClient) BuildUnstructured(ns string, reader io.Reader) (kube.Result, error) {
return []*resource.Info{}, nil
}
func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodUnknown, nil
func (kc *mockHooksKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (v1.PodPhase, error) {
return v1.PodUnknown, nil
}
func deletePolicyStub(kubeClient *mockHooksKubeClient) *ReleaseServer {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment