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

ref(*): kubernetes v1.12 support
pull/4762/head
Adam Reese 6 years ago committed by GitHub
commit de5a6a931b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

97
glide.lock generated

@ -1,5 +1,5 @@
hash: a4a7df055da2413c8e42cb127833a77d6a2910396efdabf5a7dc5af956478fef
updated: 2018-09-13T18:30:19.732109-06:00
hash: 30b1d3f31b7bd310a9434e081bae3d5dc18c0a79b3674c0adffccc8d602e9227
updated: 2018-10-04T17:11:58.043264Z
imports:
- name: cloud.google.com/go
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
@ -11,22 +11,23 @@ imports:
- name: github.com/asaskevich/govalidator
version: 7664702784775e51966f0885f5cd27435916517b
- name: github.com/Azure/go-ansiterm
version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e
version: d6e3b3328b783f23731bc4d058875b0371ff8109
subpackages:
- winterm
- name: github.com/Azure/go-autorest
version: 1ff28809256a84bb6966640ff3d0371af82ccba4
version: bca49d5b51a50dc5bb17bbf6204c711c6dbded06
subpackages:
- autorest
- autorest/adal
- autorest/azure
- autorest/date
- version
- name: github.com/beorn7/perks
version: 3ac7bf7a47d159a033b107610db8a1b6575507a4
subpackages:
- quantile
- name: github.com/BurntSushi/toml
version: b26d9c308763d68093482582cea63d69be07a0f0
version: 3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005
- name: github.com/chai2010/gettext-go
version: c6fed771bfd517099caf0f7a961671fa8ed08723
subpackages:
@ -52,7 +53,7 @@ imports:
- digestset
- reference
- name: github.com/docker/docker
version: 4f3616fb1c112e206b88cb7a9922bf49067a7756
version: a9fbbdc8dd8794b20af358382ab780559bca589d
subpackages:
- api
- api/types
@ -71,19 +72,15 @@ imports:
- api/types/versions
- api/types/volume
- client
- pkg/ioutils
- pkg/jsonlog
- daemon/logger/jsonfilelog/jsonlog
- pkg/jsonmessage
- pkg/longpath
- pkg/mount
- pkg/parsers
- pkg/parsers/operatingsystem
- pkg/stdcopy
- pkg/sysinfo
- pkg/system
- pkg/term
- pkg/term/windows
- pkg/tlsconfig
- name: github.com/docker/go-connections
version: 3ede32e2033de7505e6500d6c868c2b9ed9f169d
subpackages:
@ -97,7 +94,7 @@ imports:
subpackages:
- spdy
- name: github.com/evanphx/json-patch
version: 94e38aa1586e8a6c8a75770bddf5ff84c48a106b
version: 36442dbdb585210f8d5a1b45e67aa323c197d5c4
- name: github.com/exponent-io/jsonpath
version: d6023ce2651d8eafb5c75bb0c7167536102ec9f5
- name: github.com/fatih/camelcase
@ -180,7 +177,7 @@ imports:
- name: github.com/huandu/xstrings
version: 3959339b333561bf62a38b424fd41517c2c90f40
- name: github.com/imdario/mergo
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
version: 9316a62528ac99aaecb4e47eadd6dc8aa6533d58
- name: github.com/inconshreveable/mousetrap
version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
- name: github.com/json-iterator/go
@ -202,7 +199,7 @@ imports:
- name: github.com/mattn/go-runewidth
version: d6bea18f789704b5f83375793155289da36a3c7f
- name: github.com/matttproud/golang_protobuf_extensions
version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a
version: c12348ce28de40eed0136aa2b644d0ee0650e56c
subpackages:
- pbutil
- name: github.com/mitchellh/go-wordwrap
@ -256,11 +253,11 @@ imports:
subpackages:
- doc
- name: github.com/spf13/pflag
version: 583c0c0531f06d5278b7d917446061adc344b5cd
version: 298182f68c66c05229eb03ac171abe6e309ee79a
- name: github.com/technosophos/moniker
version: a5dbd03a2245d554160e3ae6bfdcf969fe58b431
- name: golang.org/x/crypto
version: 49796115aa4b964c318aad4f3084fdb41e9aa067
version: de0752318171da717af4ce24d0a2e8626afaeb11
subpackages:
- cast5
- ed25519
@ -294,7 +291,7 @@ imports:
- jws
- jwt
- name: golang.org/x/sys
version: 43eea11bc92608addb41b8a406b0407495c106f6
version: 95c6576299259db960f6c5b9b69ea52422860fce
subpackages:
- unix
- windows
@ -361,7 +358,7 @@ imports:
- name: gopkg.in/inf.v0
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
- name: gopkg.in/square/go-jose.v2
version: f8f38de21b4dcd69d0413faf231983f5fd6634b1
version: 89060dee6a84df9a4dae49f676f0c755037834f1
subpackages:
- cipher
- json
@ -369,7 +366,7 @@ imports:
- name: gopkg.in/yaml.v2
version: 670d4cfef0544295bc27a114dbac37980d83185a
- name: k8s.io/api
version: 2d6f90ab1293a1fb871cf149423ebb72aa7423aa
version: fd83cbc87e7632ccd8bbab63d2b673d4e0c631cc
subpackages:
- admission/v1beta1
- admissionregistration/v1alpha1
@ -383,10 +380,12 @@ imports:
- authorization/v1beta1
- autoscaling/v1
- autoscaling/v2beta1
- autoscaling/v2beta2
- batch/v1
- batch/v1beta1
- batch/v2alpha1
- certificates/v1beta1
- coordination/v1beta1
- core/v1
- events/v1beta1
- extensions/v1beta1
@ -403,11 +402,11 @@ imports:
- storage/v1alpha1
- storage/v1beta1
- name: k8s.io/apiextensions-apiserver
version: 898b0eda132e1aeac43a459785144ee4bf9b0a2e
version: 05e89e265cc594459a3d33a63e779d94e6614c63
subpackages:
- pkg/features
- name: k8s.io/apimachinery
version: 103fd098999dc9c0c88536f5c9ad2e5da39373ae
version: 6dd46049f39503a1fc8d65de4bd566829e95faff
subpackages:
- pkg/api/equality
- pkg/api/errors
@ -447,6 +446,7 @@ imports:
- pkg/util/intstr
- pkg/util/json
- pkg/util/mergepatch
- pkg/util/naming
- pkg/util/net
- pkg/util/rand
- pkg/util/remotecommand
@ -463,7 +463,7 @@ imports:
- third_party/forked/golang/netutil
- third_party/forked/golang/reflect
- name: k8s.io/apiserver
version: 8b122ec9e3bbab91a262d17a39325e69349dc44d
version: e85ad7b666fef0476185731329f4cff1536efff8
subpackages:
- pkg/apis/audit
- pkg/authentication/authenticator
@ -472,8 +472,14 @@ imports:
- pkg/endpoints/request
- pkg/features
- pkg/util/feature
- name: k8s.io/cli-runtime
version: 79bf4e0b64544d8c490247abae089bea572ddae6
subpackages:
- pkg/genericclioptions
- pkg/genericclioptions/printers
- pkg/genericclioptions/resource
- name: k8s.io/client-go
version: 59698c7d9724b0f95f9dc9e7f7dfdcc3dfeceb82
version: 1638f8970cefaa404ff3a62950f88b08292b2696
subpackages:
- discovery
- discovery/fake
@ -504,6 +510,8 @@ imports:
- kubernetes/typed/autoscaling/v1/fake
- kubernetes/typed/autoscaling/v2beta1
- kubernetes/typed/autoscaling/v2beta1/fake
- kubernetes/typed/autoscaling/v2beta2
- kubernetes/typed/autoscaling/v2beta2/fake
- kubernetes/typed/batch/v1
- kubernetes/typed/batch/v1/fake
- kubernetes/typed/batch/v1beta1
@ -512,6 +520,8 @@ imports:
- kubernetes/typed/batch/v2alpha1/fake
- kubernetes/typed/certificates/v1beta1
- kubernetes/typed/certificates/v1beta1/fake
- kubernetes/typed/coordination/v1beta1
- kubernetes/typed/coordination/v1beta1/fake
- kubernetes/typed/core/v1
- kubernetes/typed/core/v1/fake
- kubernetes/typed/events/v1beta1
@ -540,8 +550,6 @@ imports:
- kubernetes/typed/storage/v1alpha1/fake
- kubernetes/typed/storage/v1beta1
- kubernetes/typed/storage/v1beta1/fake
- listers/apps/v1
- listers/core/v1
- pkg/apis/clientauthentication
- pkg/apis/clientauthentication/v1alpha1
- pkg/apis/clientauthentication/v1beta1
@ -578,6 +586,7 @@ imports:
- tools/record
- tools/reference
- tools/remotecommand
- tools/watch
- transport
- transport/spdy
- util/buffer
@ -590,13 +599,13 @@ imports:
- util/jsonpath
- util/retry
- name: k8s.io/kube-openapi
version: 91cfa479c814065e420cee7ed227db0f63a5854e
version: 0cf8f7e6ed1d2e3d47d02e3b6e559369af24d803
subpackages:
- pkg/util/proto
- pkg/util/proto/testing
- pkg/util/proto/validation
- name: k8s.io/kubernetes
version: 2e809eed16445fff9dcbfc56e9936cf76ccbdadc
version: 54a352dda957bce0f88e49b65a6ee8bba8c0ba74
subpackages:
- pkg/api/events
- pkg/api/legacyscheme
@ -630,6 +639,7 @@ imports:
- pkg/apis/autoscaling/install
- pkg/apis/autoscaling/v1
- pkg/apis/autoscaling/v2beta1
- pkg/apis/autoscaling/v2beta2
- pkg/apis/batch
- pkg/apis/batch/install
- pkg/apis/batch/v1
@ -638,9 +648,9 @@ imports:
- pkg/apis/certificates
- pkg/apis/certificates/install
- pkg/apis/certificates/v1beta1
- pkg/apis/componentconfig
- pkg/apis/componentconfig/install
- pkg/apis/componentconfig/v1alpha1
- pkg/apis/coordination
- pkg/apis/coordination/install
- pkg/apis/coordination/v1beta1
- pkg/apis/core
- pkg/apis/core/helper
- pkg/apis/core/helper/qos
@ -684,40 +694,24 @@ imports:
- pkg/apis/storage/v1beta1
- pkg/capabilities
- pkg/client/clientset_generated/internalclientset
- pkg/client/clientset_generated/internalclientset/fake
- pkg/client/clientset_generated/internalclientset/scheme
- pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion
- pkg/client/clientset_generated/internalclientset/typed/admissionregistration/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/apps/internalversion
- pkg/client/clientset_generated/internalclientset/typed/apps/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion
- pkg/client/clientset_generated/internalclientset/typed/authentication/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion
- pkg/client/clientset_generated/internalclientset/typed/authorization/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion
- pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/batch/internalversion
- pkg/client/clientset_generated/internalclientset/typed/batch/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion
- pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/coordination/internalversion
- pkg/client/clientset_generated/internalclientset/typed/core/internalversion
- pkg/client/clientset_generated/internalclientset/typed/core/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/events/internalversion
- pkg/client/clientset_generated/internalclientset/typed/events/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion
- pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/networking/internalversion
- pkg/client/clientset_generated/internalclientset/typed/networking/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/policy/internalversion
- pkg/client/clientset_generated/internalclientset/typed/policy/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/rbac/internalversion
- pkg/client/clientset_generated/internalclientset/typed/rbac/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/scheduling/internalversion
- pkg/client/clientset_generated/internalclientset/typed/scheduling/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/settings/internalversion
- pkg/client/clientset_generated/internalclientset/typed/settings/internalversion/fake
- pkg/client/clientset_generated/internalclientset/typed/storage/internalversion
- pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake
- pkg/controller
- pkg/controller/deployment/util
- pkg/credentialprovider
@ -733,9 +727,6 @@ imports:
- pkg/kubectl/cmd/util/openapi
- pkg/kubectl/cmd/util/openapi/testing
- pkg/kubectl/cmd/util/openapi/validation
- pkg/kubectl/genericclioptions
- pkg/kubectl/genericclioptions/printers
- pkg/kubectl/genericclioptions/resource
- pkg/kubectl/scheme
- pkg/kubectl/util
- pkg/kubectl/util/hash
@ -763,16 +754,16 @@ imports:
- pkg/util/net/sets
- pkg/util/node
- pkg/util/parsers
- pkg/util/pointer
- pkg/util/slice
- pkg/util/taints
- pkg/version
- name: k8s.io/utils
version: 258e2a2fa64568210fbd6267cf1d8fd87c3cb86e
version: 66066c83e385e385ccc3c964b44fd7dcd413d0ed
subpackages:
- clock
- exec
- exec/testing
- pointer
- name: vbom.ml/util
version: db5cfe13f5cc80a4990d98e2e1b0707a4d1a5394
subpackages:
@ -783,7 +774,7 @@ testImports:
subpackages:
- difflib
- name: github.com/stretchr/testify
version: e3a8ff8ce36581f87a15341206f205b1da467059
version: c679ae2cc0cb27ec3293fea7e254e47386f05d69
subpackages:
- assert
- require

@ -1,69 +1,64 @@
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 {

Loading…
Cancel
Save