ref(*): kubernetes v1.9 support (#3234)

pull/3310/merge
Adam Reese 7 years ago committed by GitHub
parent 170cff83c2
commit a31e3b8fe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -22,10 +22,10 @@ import (
"fmt"
"io"
"io/ioutil"
"net/url"
"os"
"path/filepath"
"strings"
"text/template"
"github.com/Masterminds/sprig"
@ -41,7 +41,6 @@ import (
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/repo"
"k8s.io/helm/pkg/strvals"
"net/url"
)
const installDesc = `

@ -30,6 +30,7 @@ import (
"k8s.io/client-go/kubernetes"
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
extensionsclient "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
"k8s.io/helm/pkg/chartutil"
)
@ -37,14 +38,14 @@ import (
//
// Returns an error if the command failed.
func Install(client kubernetes.Interface, opts *Options) error {
if err := createDeployment(client.Extensions(), opts); err != nil {
if err := createDeployment(client.ExtensionsV1beta1(), opts); err != nil {
return err
}
if err := createService(client.Core(), opts.Namespace); err != nil {
if err := createService(client.CoreV1(), opts.Namespace); err != nil {
return err
}
if opts.tls() {
if err := createSecret(client.Core(), opts); err != nil {
if err := createSecret(client.CoreV1(), opts); err != nil {
return err
}
}
@ -55,21 +56,21 @@ func Install(client kubernetes.Interface, opts *Options) error {
//
// Returns an error if the command failed.
func Upgrade(client kubernetes.Interface, opts *Options) error {
obj, err := client.Extensions().Deployments(opts.Namespace).Get(deploymentName, metav1.GetOptions{})
obj, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Get(deploymentName, metav1.GetOptions{})
if err != nil {
return err
}
obj.Spec.Template.Spec.Containers[0].Image = opts.selectImage()
obj.Spec.Template.Spec.Containers[0].ImagePullPolicy = opts.pullPolicy()
obj.Spec.Template.Spec.ServiceAccountName = opts.ServiceAccount
if _, err := client.Extensions().Deployments(opts.Namespace).Update(obj); err != nil {
if _, err := client.ExtensionsV1beta1().Deployments(opts.Namespace).Update(obj); err != nil {
return err
}
// If the service does not exists that would mean we are upgrading from a Tiller version
// that didn't deploy the service, so install it.
_, err = client.Core().Services(opts.Namespace).Get(serviceName, metav1.GetOptions{})
_, err = client.CoreV1().Services(opts.Namespace).Get(serviceName, metav1.GetOptions{})
if apierrors.IsNotFound(err) {
return createService(client.Core(), opts.Namespace)
return createService(client.CoreV1(), opts.Namespace)
}
return err
}

@ -23,13 +23,13 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
testcore "k8s.io/client-go/testing"
"k8s.io/kubernetes/pkg/api"
"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: api.NamespaceDefault}
opts := &Options{Namespace: core.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: api.NamespaceDefault}
opts := &Options{Namespace: core.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(api.Resource("deployments"), "1")
return true, nil, apierrors.NewNotFound(core.Resource("deployments"), "1")
})
opts := &Options{Namespace: api.NamespaceDefault}
opts := &Options{Namespace: core.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(api.Resource("secrets"), "1")
return true, nil, apierrors.NewNotFound(core.Resource("secrets"), "1")
})
opts := &Options{Namespace: api.NamespaceDefault}
opts := &Options{Namespace: core.NamespaceDefault}
if err := Uninstall(fc, opts); err != nil {
t.Errorf("unexpected error: %#+v", err)
}

@ -23,7 +23,7 @@ import (
"strings"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/helm/pkg/helm"
@ -46,7 +46,7 @@ func TestResetCmd(t *testing.T) {
home: helmpath.Home(home),
client: c,
kubeClient: fc,
namespace: api.NamespaceDefault,
namespace: core.NamespaceDefault,
}
if err := cmd.run(); err != nil {
t.Errorf("unexpected error: %v", err)
@ -80,7 +80,7 @@ func TestResetCmd_removeHelmHome(t *testing.T) {
home: helmpath.Home(home),
client: c,
kubeClient: fc,
namespace: api.NamespaceDefault,
namespace: core.NamespaceDefault,
}
if err := cmd.run(); err != nil {
t.Errorf("unexpected error: %v", err)
@ -118,7 +118,7 @@ func TestReset_deployedReleases(t *testing.T) {
home: helmpath.Home(home),
client: c,
kubeClient: fc,
namespace: api.NamespaceDefault,
namespace: core.NamespaceDefault,
}
err = cmd.run()
expected := "there are still 1 deployed releases (Tip: use --force)"
@ -151,7 +151,7 @@ func TestReset_forceFlag(t *testing.T) {
home: helmpath.Home(home),
client: c,
kubeClient: fc,
namespace: api.NamespaceDefault,
namespace: core.NamespaceDefault,
}
if err := cmd.run(); err != nil {
t.Errorf("unexpected error: %v", err)

@ -29,9 +29,9 @@ import (
"github.com/Masterminds/semver"
"github.com/spf13/cobra"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/engine"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/release"
util "k8s.io/helm/pkg/releaseutil"
@ -62,7 +62,6 @@ type templateCmd struct {
valueFiles valueFiles
chartPath string
out io.Writer
client helm.Interface
values []string
nameTemplate string
showNotes bool
@ -252,7 +251,7 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error {
}
for _, m := range tiller.SortByKind(listManifests) {
if len(t.renderFiles) > 0 && in(m.Name, rf) == false {
if len(t.renderFiles) > 0 && !in(m.Name, rf) {
continue
}
data := m.Content
@ -315,9 +314,5 @@ func ensureDirectoryForFile(file string) error {
return err
}
err = os.MkdirAll(baseDir, defaultDirectoryPermission)
if err != nil {
return err
}
return nil
return os.MkdirAll(baseDir, defaultDirectoryPermission)
}

@ -155,7 +155,7 @@ func TestTemplateCmd(t *testing.T) {
fmt.Fprintln(os.Stderr, "reading standard input:", err)
}
if v, ok := m[tt.expectKey]; ok {
if strings.Contains(v, tt.expectValue) == false {
if !strings.Contains(v, tt.expectValue) {
t.Errorf("failed to match expected value %s in %s", tt.expectValue, v)
}
} else {

229
glide.lock generated

@ -1,15 +1,56 @@
hash: cdacf92805a7371d74694ab6a82d7475639e4b20113ff3bca961f42b6554cbb0
updated: 2017-12-01T15:12:23.724268985-05:00
hash: 5d2ef5e5355854c577bb3f4844228c90548629959c4c0666952bea502b14bf0f
updated: 2018-01-04T22:28:37.378122Z
imports:
- name: cloud.google.com/go
version: 3b1ae45394a234c385be014e9a488f2bb6eef821
repo: https://github.com/GoogleCloudPlatform/google-cloud-go.git
subpackages:
- compute
- compute/metadata
- internal
- name: github.com/aokoli/goutils
version: 9c37978a95bd5c709a15883b6242714ea6709e64
- name: github.com/asaskevich/govalidator
version: 7664702784775e51966f0885f5cd27435916517b
- name: github.com/aws/aws-sdk-go
version: 760741802ad40f49ae9fc4a69ef6706d2527d62e
subpackages:
- aws
- aws/awserr
- aws/awsutil
- aws/client
- aws/client/metadata
- aws/corehandlers
- aws/credentials
- aws/credentials/ec2rolecreds
- aws/credentials/endpointcreds
- aws/credentials/stscreds
- aws/defaults
- aws/ec2metadata
- aws/endpoints
- aws/request
- aws/session
- aws/signer/v4
- internal/shareddefaults
- private/protocol
- private/protocol/ec2query
- private/protocol/json/jsonutil
- private/protocol/jsonrpc
- private/protocol/query
- private/protocol/query/queryutil
- private/protocol/rest
- private/protocol/xml/xmlutil
- service/autoscaling
- service/ec2
- service/ecr
- service/elb
- service/elbv2
- service/kms
- service/sts
- name: github.com/Azure/go-ansiterm
version: 19f72df4d05d31cbe1c56bfc8045c96babff6c7e
subpackages:
- winterm
- name: github.com/Azure/go-autorest
version: 58f6f26e200fa5dfb40c9cd1c83f3e2c860d779d
subpackages:
@ -97,6 +138,8 @@ imports:
version: f6a740d52f961c60348ebb109adde9f4635d7540
- name: github.com/ghodss/yaml
version: 73d445a93680fa1a78ae23a5839bad48f32ba1ee
- name: github.com/go-ini/ini
version: 300e940a926eb277d3901b20bdfcc54928ad3642
- name: github.com/go-openapi/jsonpointer
version: 46af16f9f7b149af66e5d1bd010e3574dc06de98
- name: github.com/go-openapi/jsonreference
@ -176,6 +219,8 @@ imports:
version: 6633656539c1639d9d78127b7d47c622b5d7b6dc
- name: github.com/inconshreveable/mousetrap
version: 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75
- name: github.com/jmespath/go-jmespath
version: 0b12d6b521d83fc7f755e7cfc1b1fbdd35a01a74
- name: github.com/json-iterator/go
version: 36b14963da70d11297d313183d7e6388c8510e1e
- name: github.com/juju/ratelimit
@ -186,6 +231,8 @@ imports:
- buffer
- jlexer
- jwriter
- name: github.com/MakeNowJust/heredoc
version: bb23615498cded5e105af4ce27de75b089cbe851
- name: github.com/Masterminds/semver
version: 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd
- name: github.com/Masterminds/sprig
@ -198,6 +245,8 @@ imports:
version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a
subpackages:
- pbutil
- name: github.com/mitchellh/go-wordwrap
version: ad45545899c7b13c020ea92b2072220eefad42b8
- name: github.com/naoina/go-stringutil
version: 6b638e95a32d0c1131db0e7fe83775cbea4a0d0b
- name: github.com/opencontainers/go-digest
@ -240,6 +289,8 @@ imports:
version: 879c5887cd475cd7864858769793b2ceb0d44feb
- name: github.com/shurcooL/sanitized_anchor_name
version: 10ef21a441db47d8b13ebcc5fd2310f636973c77
- name: github.com/sirupsen/logrus
version: 89742aefa4b206dcf400792f3bd35b542998eb3b
- name: github.com/spf13/cobra
version: f62e98d28ab7ad31d707ba837a966378465c7b57
subpackages:
@ -248,10 +299,6 @@ imports:
version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7
- name: github.com/technosophos/moniker
version: ab470f5e105a44d0c87ea21bacd6a335c4816d83
- name: github.com/ugorji/go
version: ded73eae5db7e7a0ef6f55aace87a2873c5d2b74
subpackages:
- codec
- name: golang.org/x/crypto
version: 81e90905daefcd6fd217b62423c0908922eadb30
subpackages:
@ -343,39 +390,18 @@ imports:
- status
- tap
- transport
- name: gopkg.in/gcfg.v1
version: 27e4946190b4a327b539185f2b5b1f7c84730728
subpackages:
- scanner
- token
- types
- name: gopkg.in/inf.v0
version: 3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4
- name: gopkg.in/warnings.v0
version: 8a331561fe74dadba6edfc59f3be66c22c3b065d
- name: gopkg.in/yaml.v2
version: 53feefa2559fb8dfa8d81baad31be332c97d6c77
- name: k8s.io/api
version: cadaf100c0a3dd6b254f320d6d651df079ec8e0a
subpackages:
- admission/v1alpha1
- admissionregistration/v1alpha1
- apps/v1beta1
- apps/v1beta2
- authentication/v1
- authentication/v1beta1
- authorization/v1
- authorization/v1beta1
- autoscaling/v1
- autoscaling/v2beta1
- batch/v1
- batch/v1beta1
- batch/v2alpha1
- certificates/v1beta1
- core/v1
- extensions/v1beta1
- imagepolicy/v1alpha1
- networking/v1
- policy/v1beta1
- rbac/v1
- rbac/v1alpha1
- rbac/v1beta1
- scheduling/v1alpha1
- settings/v1alpha1
- storage/v1
- storage/v1beta1
- name: k8s.io/apiextensions-apiserver
version: a5bbfd114a9b122acd741c61d88c84812375d9e1
subpackages:
@ -423,6 +449,7 @@ imports:
- pkg/util/mergepatch
- pkg/util/net
- pkg/util/rand
- pkg/util/remotecommand
- pkg/util/runtime
- pkg/util/sets
- pkg/util/strategicpatch
@ -439,10 +466,6 @@ imports:
- name: k8s.io/apiserver
version: c1e53d745d0fe45bf7d5d44697e6eface25fceca
subpackages:
- pkg/admission
- pkg/apis/apiserver
- pkg/apis/apiserver/install
- pkg/apis/apiserver/v1alpha1
- pkg/apis/audit
- pkg/authentication/authenticator
- pkg/authentication/serviceaccount
@ -457,10 +480,41 @@ imports:
- discovery
- discovery/fake
- dynamic
- informers
- informers/admissionregistration
- informers/admissionregistration/v1alpha1
- informers/apps
- informers/apps/v1beta1
- informers/apps/v1beta2
- informers/autoscaling
- informers/autoscaling/v1
- informers/autoscaling/v2beta1
- informers/batch
- informers/batch/v1
- informers/batch/v1beta1
- informers/batch/v2alpha1
- informers/certificates
- informers/certificates/v1beta1
- informers/core
- informers/core/v1
- informers/extensions
- informers/extensions/v1beta1
- informers/internalinterfaces
- informers/networking
- informers/networking/v1
- informers/policy
- informers/policy/v1beta1
- informers/rbac
- informers/rbac/v1
- informers/rbac/v1alpha1
- informers/rbac/v1beta1
- informers/scheduling
- informers/scheduling/v1alpha1
- informers/settings
- informers/settings/v1alpha1
- informers/storage
- informers/storage/v1
- informers/storage/v1beta1
- kubernetes
- kubernetes/fake
- kubernetes/scheme
@ -512,9 +566,26 @@ imports:
- kubernetes/typed/storage/v1/fake
- kubernetes/typed/storage/v1beta1
- kubernetes/typed/storage/v1beta1/fake
- listers/admissionregistration/v1alpha1
- listers/apps/v1beta1
- listers/apps/v1beta2
- listers/autoscaling/v1
- listers/autoscaling/v2beta1
- listers/batch/v1
- listers/batch/v1beta1
- listers/batch/v2alpha1
- listers/certificates/v1beta1
- listers/core/v1
- listers/extensions/v1beta1
- listers/networking/v1
- listers/policy/v1beta1
- listers/rbac/v1
- listers/rbac/v1alpha1
- listers/rbac/v1beta1
- listers/scheduling/v1alpha1
- listers/settings/v1alpha1
- listers/storage/v1
- listers/storage/v1beta1
- pkg/version
- plugin/pkg/client/auth
- plugin/pkg/client/auth/azure
@ -537,9 +608,11 @@ imports:
- tools/portforward
- tools/record
- tools/reference
- tools/remotecommand
- transport
- transport/spdy
- util/cert
- util/exec
- util/flowcontrol
- util/homedir
- util/integer
@ -547,46 +620,33 @@ imports:
- util/retry
- util/workqueue
- name: k8s.io/kube-openapi
version: 868f2f29720b192240e18284659231b440f9cda5
version: 39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1
subpackages:
- pkg/common
- pkg/util/proto
- pkg/util/proto/validation
- name: k8s.io/kubernetes
version: 0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4
subpackages:
- federation/apis/federation
- federation/apis/federation/install
- federation/apis/federation/v1beta1
- federation/client/clientset_generated/federation_clientset
- federation/client/clientset_generated/federation_clientset/scheme
- federation/client/clientset_generated/federation_clientset/typed/autoscaling/v1
- federation/client/clientset_generated/federation_clientset/typed/batch/v1
- federation/client/clientset_generated/federation_clientset/typed/core/v1
- federation/client/clientset_generated/federation_clientset/typed/extensions/v1beta1
- federation/client/clientset_generated/federation_clientset/typed/federation/v1beta1
- pkg/api
version: 3a1c9449a956b6026f075fa3134ff92f7d55f812
subpackages:
- pkg/api/events
- pkg/api/helper
- pkg/api/helper/qos
- pkg/api/install
- pkg/api/legacyscheme
- pkg/api/pod
- pkg/api/ref
- pkg/api/resource
- pkg/api/service
- pkg/api/testapi
- pkg/api/util
- pkg/api/v1
- pkg/api/v1/helper
- pkg/api/v1/helper/qos
- pkg/api/v1/pod
- pkg/api/validation
- pkg/api/v1/service
- pkg/apis/admission
- pkg/apis/admission/install
- pkg/apis/admission/v1alpha1
- pkg/apis/admission/v1beta1
- pkg/apis/admissionregistration
- pkg/apis/admissionregistration/install
- pkg/apis/admissionregistration/v1alpha1
- pkg/apis/admissionregistration/v1beta1
- pkg/apis/apps
- pkg/apis/apps/install
- pkg/apis/apps/v1
- pkg/apis/apps/v1beta1
- pkg/apis/apps/v1beta2
- pkg/apis/authentication
@ -612,6 +672,18 @@ imports:
- pkg/apis/componentconfig
- pkg/apis/componentconfig/install
- pkg/apis/componentconfig/v1alpha1
- pkg/apis/core
- pkg/apis/core/helper
- pkg/apis/core/helper/qos
- pkg/apis/core/install
- pkg/apis/core/pods
- pkg/apis/core/v1
- pkg/apis/core/v1/helper
- pkg/apis/core/v1/helper/qos
- pkg/apis/core/validation
- pkg/apis/events
- pkg/apis/events/install
- pkg/apis/events/v1beta1
- pkg/apis/extensions
- pkg/apis/extensions/install
- pkg/apis/extensions/v1beta1
@ -639,6 +711,7 @@ imports:
- pkg/apis/storage/install
- pkg/apis/storage/util
- pkg/apis/storage/v1
- pkg/apis/storage/v1alpha1
- pkg/apis/storage/v1beta1
- pkg/capabilities
- pkg/client/clientset_generated/internalclientset
@ -660,6 +733,8 @@ imports:
- pkg/client/clientset_generated/internalclientset/typed/certificates/internalversion/fake
- 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
@ -675,28 +750,38 @@ imports:
- pkg/client/clientset_generated/internalclientset/typed/storage/internalversion
- pkg/client/clientset_generated/internalclientset/typed/storage/internalversion/fake
- pkg/client/unversioned
- pkg/cloudprovider
- pkg/cloudprovider/providers/aws
- pkg/controller
- pkg/controller/daemon
- pkg/controller/daemon/util
- pkg/controller/deployment/util
- pkg/controller/history
- pkg/controller/statefulset
- pkg/controller/volume/events
- pkg/controller/volume/persistentvolume
- pkg/credentialprovider
- pkg/credentialprovider/aws
- pkg/features
- pkg/fieldpath
- pkg/kubectl
- pkg/kubectl/apps
- pkg/kubectl/categories
- pkg/kubectl/cmd/templates
- pkg/kubectl/cmd/testing
- pkg/kubectl/cmd/util
- pkg/kubectl/cmd/util/openapi
- pkg/kubectl/cmd/util/openapi/testing
- pkg/kubectl/cmd/util/openapi/validation
- pkg/kubectl/plugins
- pkg/kubectl/resource
- pkg/kubectl/scheme
- pkg/kubectl/util
- pkg/kubectl/util/hash
- pkg/kubectl/util/slice
- pkg/kubectl/util/term
- pkg/kubectl/validation
- pkg/kubelet/apis
- pkg/kubelet/qos
- pkg/kubelet/types
- pkg/master/ports
- pkg/printers
@ -705,18 +790,23 @@ imports:
- pkg/security/apparmor
- pkg/serviceaccount
- pkg/util/file
- pkg/util/goroutinemap
- pkg/util/goroutinemap/exponentialbackoff
- pkg/util/hash
- pkg/util/interrupt
- pkg/util/io
- pkg/util/labels
- pkg/util/metrics
- pkg/util/mount
- pkg/util/net/sets
- pkg/util/node
- pkg/util/nsenter
- pkg/util/parsers
- pkg/util/pointer
- pkg/util/slice
- pkg/util/taints
- pkg/version
- pkg/volume
- pkg/volume/util
- pkg/watch/json
- plugin/pkg/scheduler/algorithm
@ -725,18 +815,11 @@ imports:
- plugin/pkg/scheduler/api
- plugin/pkg/scheduler/schedulercache
- plugin/pkg/scheduler/util
- staging/src/k8s.io/apimachinery/pkg/util/rand
- name: k8s.io/metrics
version: 8efbc8e22d00b9c600afec5f1c14073fd2412fce
subpackages:
- pkg/apis/metrics
- pkg/apis/metrics/v1alpha1
- pkg/client/clientset_generated/clientset
- pkg/client/clientset_generated/clientset/scheme
- pkg/client/clientset_generated/clientset/typed/metrics/v1alpha1
- plugin/pkg/scheduler/volumebinder
- name: k8s.io/utils
version: 9fdc871a36f37980dd85f96d576b20d564cc0784
version: aedf551cdb8b0119df3a19c65fde413a13b34997
subpackages:
- clock
- exec
- exec/testing
- name: vbom.ml/util

@ -27,10 +27,8 @@ import:
- ptypes/timestamp
- package: google.golang.org/grpc
version: 1.7.2
# 1.8.1 libs are hosed and need some manual intervention, so pinning to 1.8.0 for now
# so others aren't getting errors when running `glide up`
- package: k8s.io/kubernetes
version: 1.8.0
version: ~1.9.0
- package: github.com/gosuri/uitable
- package: github.com/asaskevich/govalidator
version: ^4.0.0
@ -57,6 +55,15 @@ import:
repo: https://github.com/fvbommel/util.git
vcs: git
- package: k8s.io/kube-openapi
version: 39a7bf85c140f972372c2a0d1ee40adbf0c8bfe1
- package: cloud.google.com/go/compute
repo: https://github.com/GoogleCloudPlatform/google-cloud-go.git
ignore:
- k8s.io/api
testImports:
- package: github.com/stretchr/testify
version: ^1.1.4

@ -30,7 +30,7 @@ var (
// DefaultKubeVersion is the default kubernetes version
DefaultKubeVersion = &version.Info{
Major: "1",
Minor: "7",
Minor: "9",
GoVersion: runtime.Version(),
Compiler: runtime.Compiler,
Platform: fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH),

@ -40,7 +40,7 @@ func New(namespace string, client kubernetes.Interface, config *rest.Config) (*k
return nil, err
}
const tillerPort = 44134
t := kube.NewTunnel(client.Core().RESTClient(), config, namespace, podName, tillerPort)
t := kube.NewTunnel(client.CoreV1().RESTClient(), config, namespace, podName, tillerPort)
return t, t.ForwardPort()
}

@ -31,6 +31,7 @@ import (
batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -42,9 +43,8 @@ import (
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/helper"
batchinternal "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/apis/core"
conditions "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/kubectl"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
@ -109,7 +109,8 @@ func (c *Client) Create(namespace string, reader io.Reader, timeout int64, shoul
}
func (c *Client) newBuilder(namespace string, reader io.Reader) *resource.Result {
return c.NewBuilder(true).
return c.NewBuilder().
Internal().
ContinueOnError().
Schema(c.validator()).
NamespaceParam(namespace).
@ -120,8 +121,7 @@ func (c *Client) newBuilder(namespace string, reader io.Reader) *resource.Result
}
func (c *Client) validator() validation.Schema {
const openapi = false // only works on v1.8 clusters
schema, err := c.Validator(true, openapi, c.SchemaCacheDir)
schema, err := c.Validator(true)
if err != nil {
c.Log("warning: failed to load schema: %s", err)
}
@ -132,12 +132,9 @@ func (c *Client) validator() validation.Schema {
func (c *Client) BuildUnstructured(namespace string, reader io.Reader) (Result, error) {
var result Result
b, err := c.NewUnstructuredBuilder(true)
if err != nil {
return result, err
}
result, err = b.ContinueOnError().
Schema(c.validator()).
result, err := c.NewBuilder().
Unstructured().
ContinueOnError().
NamespaceParam(namespace).
DefaultNamespace().
Stream(reader, "").
@ -165,7 +162,7 @@ func (c *Client) Get(namespace string, reader io.Reader) (string, error) {
return "", err
}
var objPods = make(map[string][]api.Pod)
var objPods = make(map[string][]core.Pod)
missing := []string{}
err = perform(infos, func(info *resource.Info) error {
@ -400,12 +397,12 @@ func createPatch(mapping *meta.RESTMapping, target, current runtime.Object) ([]b
return nil, types.StrategicMergePatchType, fmt.Errorf("serializing target configuration: %s", err)
}
if helper.Semantic.DeepEqual(oldData, newData) {
if apiequality.Semantic.DeepEqual(oldData, newData) {
return nil, types.StrategicMergePatchType, nil
}
// Get a versioned object
versionedObject, err := api.Scheme.New(mapping.GroupVersionKind)
versionedObject, err := mapping.ConvertToVersion(target, mapping.GroupVersionKind.GroupVersion())
switch {
case runtime.IsNotRegisteredError(err):
// fall back to generic JSON merge patch
@ -590,9 +587,9 @@ func (c *Client) waitForJob(e watch.Event, name string) (bool, error) {
}
for _, c := range o.Status.Conditions {
if c.Type == batchinternal.JobComplete && c.Status == api.ConditionTrue {
if c.Type == batchinternal.JobComplete && c.Status == core.ConditionTrue {
return true, nil
} else if c.Type == batchinternal.JobFailed && c.Status == api.ConditionTrue {
} else if c.Type == batchinternal.JobFailed && c.Status == core.ConditionTrue {
return true, fmt.Errorf("Job failed: %s", c.Reason)
}
}
@ -616,26 +613,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) (api.PodPhase, error) {
func (c *Client) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
infos, err := c.Build(namespace, reader)
if err != nil {
return api.PodUnknown, err
return core.PodUnknown, err
}
info := infos[0]
kind := info.Mapping.GroupVersionKind.Kind
if kind != "Pod" {
return api.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name)
return core.PodUnknown, fmt.Errorf("%s is not a Pod", info.Name)
}
if err := c.watchPodUntilComplete(timeout, info); err != nil {
return api.PodUnknown, err
return core.PodUnknown, err
}
if err := info.Get(); err != nil {
return api.PodUnknown, err
return core.PodUnknown, err
}
status := info.Object.(*api.Pod).Status.Phase
status := info.Object.(*core.Pod).Status.Phase
return status, nil
}
@ -656,7 +653,7 @@ func (c *Client) watchPodUntilComplete(timeout time.Duration, info *resource.Inf
//get an kubernetes resources's relation pods
// kubernetes resource used select labels to relate pods
func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]api.Pod) (map[string][]api.Pod, error) {
func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]core.Pod) (map[string][]core.Pod, error) {
if info == nil {
return objPods, nil
}
@ -709,7 +706,7 @@ func (c *Client) getSelectRelationPod(info *resource.Info, objPods map[string][]
return objPods, nil
}
func isFoundPod(podItem []api.Pod, pod api.Pod) bool {
func isFoundPod(podItem []core.Pod, pod core.Pod) bool {
for _, value := range podItem {
if (value.Namespace == pod.Namespace) && (value.Name == pod.Name) {
return true

@ -30,16 +30,16 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/rest/fake"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl"
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/kubectl/validation"
"k8s.io/kubernetes/pkg/printers"
watchjson "k8s.io/kubernetes/pkg/watch/json"
)
@ -48,34 +48,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) api.Pod {
return newPodWithStatus(name, api.PodStatus{}, "")
func newPod(name string) core.Pod {
return newPodWithStatus(name, core.PodStatus{}, "")
}
func newPodWithStatus(name string, status api.PodStatus, namespace string) api.Pod {
ns := api.NamespaceDefault
func newPodWithStatus(name string, status core.PodStatus, namespace string) core.Pod {
ns := core.NamespaceDefault
if namespace != "" {
ns = namespace
}
return api.Pod{
return core.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: ns,
SelfLink: "/api/v1/namespaces/default/pods/" + name,
},
Spec: api.PodSpec{
Containers: []api.Container{{
Spec: core.PodSpec{
Containers: []core.Container{{
Name: "app:v4",
Image: "abc/app:v4",
Ports: []api.ContainerPort{{Name: "http", ContainerPort: 80}},
Ports: []core.ContainerPort{{Name: "http", ContainerPort: 80}},
}},
},
Status: status,
}
}
func newPodList(names ...string) api.PodList {
var list api.PodList
func newPodList(names ...string) core.PodList {
var list core.PodList
for _, name := range names {
list.Items = append(list.Items, newPod(name))
}
@ -148,14 +148,14 @@ 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 = []api.ContainerPort{{Name: "https", ContainerPort: 443}}
listC.Items[0].Spec.Containers[0].Ports = []api.ContainerPort{{Name: "https", ContainerPort: 443}}
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}}
var actions []string
f, tf, codec, _ := cmdtesting.NewAPIFactory()
tf.UnstructuredClient = &fake.RESTClient{
APIRegistry: api.Registry,
GroupVersion: schema.GroupVersion{Version: "v1"},
NegotiatedSerializer: dynamic.ContentConfig().NegotiatedSerializer,
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
p, m := req.URL.Path, req.Method
@ -193,7 +193,7 @@ func TestUpdate(t *testing.T) {
reaper := &fakeReaper{}
rf := &fakeReaperFactory{Factory: f, reaper: reaper}
c := newTestClient(rf)
if err := c.Update(api.NamespaceDefault, objBody(codec, &listA), objBody(codec, &listB), false, false, 0, false); err != nil {
if err := c.Update(core.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
@ -232,13 +232,11 @@ func TestUpdate(t *testing.T) {
func TestBuild(t *testing.T) {
tests := []struct {
name string
namespace string
reader io.Reader
count int
swaggerFile string
err bool
errMessage string
name string
namespace string
reader io.Reader
count int
err bool
}{
{
name: "Valid input",
@ -246,36 +244,23 @@ func TestBuild(t *testing.T) {
reader: strings.NewReader(guestbookManifest),
count: 6,
}, {
name: "Invalid schema",
namespace: "test",
reader: strings.NewReader(testInvalidServiceManifest),
swaggerFile: "../../vendor/k8s.io/kubernetes/api/swagger-spec/" + testapi.Default.GroupVersion().Version + ".json",
err: true,
errMessage: `error validating "": error validating data: expected type int, for field spec.ports[0].port, got string`,
name: "Invalid schema",
namespace: "test",
reader: strings.NewReader(testInvalidServiceManifest),
err: true,
},
}
for _, tt := range tests {
f, tf, _, _ := cmdtesting.NewAPIFactory()
f, _, _, _ := cmdtesting.NewAPIFactory()
c := newTestClient(f)
if tt.swaggerFile != "" {
data, err := ioutil.ReadFile(tt.swaggerFile)
if err != nil {
t.Fatalf("could not read swagger spec: %s", err)
}
validator, err := validation.NewSwaggerSchemaFromBytes(data, nil)
if err != nil {
t.Fatalf("could not load swagger spec: %s", err)
}
tf.Validator = validator
}
// Test for an invalid manifest
infos, err := c.Build(tt.namespace, tt.reader)
if err != nil && err.Error() != tt.errMessage {
t.Errorf("%q. expected error message: %v, got %v", tt.name, tt.errMessage, err)
} else if err != nil && !tt.err {
t.Errorf("%q. Got error message when no error should have occurred: %v, got %v", tt.name, tt.errMessage, err)
if err != nil && !tt.err {
t.Errorf("%q. Got error message when no error should have occurred: %v", tt.name, err)
} else if err != nil && strings.Contains(err.Error(), "--validate=false") {
t.Errorf("%q. error message was not scrubbed", tt.name)
}
if len(infos) != tt.count {
@ -309,7 +294,7 @@ func TestGet(t *testing.T) {
f, tf, _, _ := cmdtesting.NewAPIFactory()
tf.Printer = &testPrinter{}
tf.UnstructuredClient = &fake.RESTClient{
APIRegistry: api.Registry,
GroupVersion: schema.GroupVersion{Version: "v1"},
NegotiatedSerializer: dynamic.ContentConfig().NegotiatedSerializer,
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
p, m := req.URL.Path, req.Method
@ -351,13 +336,12 @@ func TestGet(t *testing.T) {
func TestPerform(t *testing.T) {
tests := []struct {
name string
namespace string
reader io.Reader
count int
swaggerFile string
err bool
errMessage string
name string
namespace string
reader io.Reader
count int
err bool
errMessage string
}{
{
name: "Valid input",
@ -385,20 +369,8 @@ func TestPerform(t *testing.T) {
return nil
}
f, tf, _, _ := cmdtesting.NewAPIFactory()
f, _, _, _ := cmdtesting.NewAPIFactory()
c := newTestClient(f)
if tt.swaggerFile != "" {
data, err := ioutil.ReadFile(tt.swaggerFile)
if err != nil {
t.Fatalf("could not read swagger spec: %s", err)
}
validator, err := validation.NewSwaggerSchemaFromBytes(data, nil)
if err != nil {
t.Fatalf("could not load swagger spec: %s", err)
}
tf.Validator = validator
}
infos, err := c.Build(tt.namespace, tt.reader)
if err != nil && err.Error() != tt.errMessage {
t.Errorf("%q. Error while building manifests: %v", tt.name, err)
@ -420,27 +392,27 @@ func TestPerform(t *testing.T) {
func TestWaitAndGetCompletedPodPhase(t *testing.T) {
tests := []struct {
podPhase api.PodPhase
expectedPhase api.PodPhase
podPhase core.PodPhase
expectedPhase core.PodPhase
err bool
errMessage string
}{
{
podPhase: api.PodPending,
expectedPhase: api.PodUnknown,
podPhase: core.PodPending,
expectedPhase: core.PodUnknown,
err: true,
errMessage: "watch closed before Until timeout",
}, {
podPhase: api.PodRunning,
expectedPhase: api.PodUnknown,
podPhase: core.PodRunning,
expectedPhase: core.PodUnknown,
err: true,
errMessage: "watch closed before Until timeout",
}, {
podPhase: api.PodSucceeded,
expectedPhase: api.PodSucceeded,
podPhase: core.PodSucceeded,
expectedPhase: core.PodSucceeded,
}, {
podPhase: api.PodFailed,
expectedPhase: api.PodFailed,
podPhase: core.PodFailed,
expectedPhase: core.PodFailed,
},
}
@ -448,11 +420,10 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
f, tf, codec, ns := cmdtesting.NewAPIFactory()
actions := make(map[string]string)
var testPodList api.PodList
testPodList.Items = append(testPodList.Items, newPodWithStatus("bestpod", api.PodStatus{Phase: tt.podPhase}, "test"))
var testPodList core.PodList
testPodList.Items = append(testPodList.Items, newPodWithStatus("bestpod", core.PodStatus{Phase: tt.podPhase}, "test"))
tf.Client = &fake.RESTClient{
APIRegistry: api.Registry,
NegotiatedSerializer: ns,
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
p, m := req.URL.Path, req.Method

@ -19,12 +19,12 @@ package kube // import "k8s.io/helm/pkg/kube"
import (
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
)
func createNamespace(client internalclientset.Interface, namespace string) error {
ns := &api.Namespace{
ns := &core.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: namespace,
},
@ -33,7 +33,7 @@ func createNamespace(client internalclientset.Interface, namespace string) error
return err
}
func getNamespace(client internalclientset.Interface, namespace string) (*api.Namespace, error) {
func getNamespace(client internalclientset.Interface, namespace string) (*core.Namespace, error) {
return client.Core().Namespaces().Get(namespace, metav1.GetOptions{})
}

@ -19,6 +19,7 @@ package kube // import "k8s.io/helm/pkg/kube"
import (
"time"
appsv1 "k8s.io/api/apps/v1"
appsv1beta1 "k8s.io/api/apps/v1beta1"
appsv1beta2 "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
@ -29,8 +30,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/api/v1/helper"
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util"
)
@ -67,13 +68,28 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
}
pods = append(pods, list...)
case *v1.Pod:
pod, err := kcs.Core().Pods(value.Namespace).Get(value.Name, metav1.GetOptions{})
pod, err := kcs.CoreV1().Pods(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
pods = append(pods, *pod)
case *appsv1.Deployment:
currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
// Find RS associated with deployment
newReplicaSet, err := deploymentutil.GetNewReplicaSet(currentDeployment, kcs.ExtensionsV1beta1())
if err != nil || newReplicaSet == nil {
return false, err
}
newDeployment := deployment{
newReplicaSet,
currentDeployment,
}
deployments = append(deployments, newDeployment)
case *extensions.Deployment:
currentDeployment, err := kcs.Extensions().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{})
currentDeployment, err := kcs.ExtensionsV1beta1().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
@ -93,6 +109,12 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
return false, err
}
pods = append(pods, list...)
case *appsv1.StatefulSet:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels)
if err != nil {
return false, err
}
pods = append(pods, list...)
case *appsv1beta1.StatefulSet:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels)
if err != nil {
@ -112,13 +134,13 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
}
pods = append(pods, list...)
case *v1.PersistentVolumeClaim:
claim, err := kcs.Core().PersistentVolumeClaims(value.Namespace).Get(value.Name, metav1.GetOptions{})
claim, err := kcs.CoreV1().PersistentVolumeClaims(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
pvc = append(pvc, *claim)
case *v1.Service:
svc, err := kcs.Core().Services(value.Namespace).Get(value.Name, metav1.GetOptions{})
svc, err := kcs.CoreV1().Services(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil {
return false, err
}
@ -182,7 +204,7 @@ func (c *Client) deploymentsReady(deployments []deployment) bool {
}
func getPods(client kubernetes.Interface, namespace string, selector map[string]string) ([]v1.Pod, error) {
list, err := client.Core().Pods(namespace).List(metav1.ListOptions{
list, err := client.CoreV1().Pods(namespace).List(metav1.ListOptions{
FieldSelector: fields.Everything().String(),
LabelSelector: labels.Set(selector).AsSelector().String(),
})

@ -22,7 +22,7 @@ import (
"log"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"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) (api.PodPhase, error) {
func (env *Environment) getTestPodStatus(test *test) (core.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/api"
"k8s.io/kubernetes/pkg/apis/core"
"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 := api.PodUnknown
status := core.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 api.PodPhase) error {
func (t *test) assignTestResult(podStatus core.PodPhase) error {
switch podStatus {
case api.PodSucceeded:
case core.PodSucceeded:
if t.expectedSuccess {
t.result.Status = release.TestRun_SUCCESS
} else {
t.result.Status = release.TestRun_FAILURE
}
case api.PodFailed:
case core.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/api"
"k8s.io/kubernetes/pkg/apis/core"
"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) (api.PodPhase, error) {
return api.PodSucceeded, nil
func (p *podSucceededKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodSucceeded, nil
}
type podFailedKubeClient struct {
@ -338,6 +338,6 @@ func newPodFailedKubeClient() *podFailedKubeClient {
}
}
func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (api.PodPhase, error) {
return api.PodFailed, nil
func (p *podFailedKubeClient) WaitAndGetCompletedPodPhase(ns string, r io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodFailed, nil
}

@ -26,7 +26,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kblabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
rspb "k8s.io/helm/pkg/proto/hapi/release"
@ -228,7 +228,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) (*api.ConfigMap, error) {
func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*core.ConfigMap, error) {
const owner = "TILLER"
// encode the release
@ -248,7 +248,7 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*api.Config
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
// create and return configmap object
return &api.ConfigMap{
return &core.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Name: key,
Labels: lbs.toMap(),

@ -19,7 +19,7 @@ import (
"testing"
"github.com/gogo/protobuf/proto"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
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]*api.ConfigMap{key: cfgmap}
mock.objects = map[string]*core.ConfigMap{key: cfgmap}
cfgmaps := NewConfigMaps(&mock)
// get release with key

@ -22,7 +22,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
rspb "k8s.io/helm/pkg/proto/hapi/release"
@ -78,12 +78,12 @@ func newTestFixtureCfgMaps(t *testing.T, releases ...*rspb.Release) *ConfigMaps
type MockConfigMapsInterface struct {
internalversion.ConfigMapInterface
objects map[string]*api.ConfigMap
objects map[string]*core.ConfigMap
}
// Init initializes the MockConfigMapsInterface with the set of releases.
func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Release) {
mock.objects = map[string]*api.ConfigMap{}
mock.objects = map[string]*core.ConfigMap{}
for _, rls := range releases {
objkey := testKey(rls.Name, rls.Version)
@ -97,17 +97,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) (*api.ConfigMap, error) {
func (mock *MockConfigMapsInterface) Get(name string, options metav1.GetOptions) (*core.ConfigMap, error) {
object, ok := mock.objects[name]
if !ok {
return nil, apierrors.NewNotFound(api.Resource("tests"), name)
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
}
return object, nil
}
// List returns the a of ConfigMaps.
func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*api.ConfigMapList, error) {
var list api.ConfigMapList
func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*core.ConfigMapList, error) {
var list core.ConfigMapList
for _, cfgmap := range mock.objects {
list.Items = append(list.Items, *cfgmap)
}
@ -115,20 +115,20 @@ func (mock *MockConfigMapsInterface) List(opts metav1.ListOptions) (*api.ConfigM
}
// Create creates a new ConfigMap.
func (mock *MockConfigMapsInterface) Create(cfgmap *api.ConfigMap) (*api.ConfigMap, error) {
func (mock *MockConfigMapsInterface) Create(cfgmap *core.ConfigMap) (*core.ConfigMap, error) {
name := cfgmap.ObjectMeta.Name
if object, ok := mock.objects[name]; ok {
return object, apierrors.NewAlreadyExists(api.Resource("tests"), name)
return object, apierrors.NewAlreadyExists(core.Resource("tests"), name)
}
mock.objects[name] = cfgmap
return cfgmap, nil
}
// Update updates a ConfigMap.
func (mock *MockConfigMapsInterface) Update(cfgmap *api.ConfigMap) (*api.ConfigMap, error) {
func (mock *MockConfigMapsInterface) Update(cfgmap *core.ConfigMap) (*core.ConfigMap, error) {
name := cfgmap.ObjectMeta.Name
if _, ok := mock.objects[name]; !ok {
return nil, apierrors.NewNotFound(api.Resource("tests"), name)
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
}
mock.objects[name] = cfgmap
return cfgmap, nil
@ -137,7 +137,7 @@ func (mock *MockConfigMapsInterface) Update(cfgmap *api.ConfigMap) (*api.ConfigM
// 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(api.Resource("tests"), name)
return apierrors.NewNotFound(core.Resource("tests"), name)
}
delete(mock.objects, name)
return nil
@ -156,12 +156,12 @@ func newTestFixtureSecrets(t *testing.T, releases ...*rspb.Release) *Secrets {
type MockSecretsInterface struct {
internalversion.SecretInterface
objects map[string]*api.Secret
objects map[string]*core.Secret
}
// Init initializes the MockSecretsInterface with the set of releases.
func (mock *MockSecretsInterface) Init(t *testing.T, releases ...*rspb.Release) {
mock.objects = map[string]*api.Secret{}
mock.objects = map[string]*core.Secret{}
for _, rls := range releases {
objkey := testKey(rls.Name, rls.Version)
@ -175,17 +175,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) (*api.Secret, error) {
func (mock *MockSecretsInterface) Get(name string, options metav1.GetOptions) (*core.Secret, error) {
object, ok := mock.objects[name]
if !ok {
return nil, apierrors.NewNotFound(api.Resource("tests"), name)
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
}
return object, nil
}
// List returns the a of Secret.
func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*api.SecretList, error) {
var list api.SecretList
func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*core.SecretList, error) {
var list core.SecretList
for _, secret := range mock.objects {
list.Items = append(list.Items, *secret)
}
@ -193,20 +193,20 @@ func (mock *MockSecretsInterface) List(opts metav1.ListOptions) (*api.SecretList
}
// Create creates a new Secret.
func (mock *MockSecretsInterface) Create(secret *api.Secret) (*api.Secret, error) {
func (mock *MockSecretsInterface) Create(secret *core.Secret) (*core.Secret, error) {
name := secret.ObjectMeta.Name
if object, ok := mock.objects[name]; ok {
return object, apierrors.NewAlreadyExists(api.Resource("tests"), name)
return object, apierrors.NewAlreadyExists(core.Resource("tests"), name)
}
mock.objects[name] = secret
return secret, nil
}
// Update updates a Secret.
func (mock *MockSecretsInterface) Update(secret *api.Secret) (*api.Secret, error) {
func (mock *MockSecretsInterface) Update(secret *core.Secret) (*core.Secret, error) {
name := secret.ObjectMeta.Name
if _, ok := mock.objects[name]; !ok {
return nil, apierrors.NewNotFound(api.Resource("tests"), name)
return nil, apierrors.NewNotFound(core.Resource("tests"), name)
}
mock.objects[name] = secret
return secret, nil
@ -215,7 +215,7 @@ func (mock *MockSecretsInterface) Update(secret *api.Secret) (*api.Secret, error
// 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(api.Resource("tests"), name)
return apierrors.NewNotFound(core.Resource("tests"), name)
}
delete(mock.objects, name)
return nil

@ -26,7 +26,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kblabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/validation"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
rspb "k8s.io/helm/pkg/proto/hapi/release"
@ -228,7 +228,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) (*api.Secret, error) {
func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*core.Secret, error) {
const owner = "TILLER"
// encode the release
@ -248,7 +248,7 @@ func newSecretsObject(key string, rls *rspb.Release, lbs labels) (*api.Secret, e
lbs.set("VERSION", strconv.Itoa(int(rls.Version)))
// create and return secret object
return &api.Secret{
return &core.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: key,
Labels: lbs.toMap(),

@ -19,7 +19,7 @@ import (
"testing"
"github.com/gogo/protobuf/proto"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
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]*api.Secret{key: secret}
mock.objects = map[string]*core.Secret{key: secret}
secrets := NewSecrets(&mock)
// get release with key

@ -26,7 +26,7 @@ import (
"io"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/helm/pkg/chartutil"
@ -142,7 +142,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) (api.PodPhase, error)
WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error)
}
// PrintingKubeClient implements KubeClient, but simply prints the reader to
@ -194,9 +194,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) (api.PodPhase, error) {
func (p *PrintingKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
_, err := io.Copy(p.Out, reader)
return api.PodUnknown, err
return core.PodUnknown, err
}
// Environment provides the context for executing a client request.

@ -22,7 +22,7 @@ import (
"testing"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/helm/pkg/chartutil"
@ -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) (api.PodPhase, error) {
return api.PodUnknown, nil
func (k *mockKubeClient) WaitAndGetCompletedPodPhase(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
return core.PodUnknown, nil
}
func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (api.PodPhase, error) {
func (k *mockKubeClient) WaitAndGetCompletedPodStatus(namespace string, reader io.Reader, timeout time.Duration) (core.PodPhase, error) {
return "", nil
}

@ -220,7 +220,7 @@ func hasAnyAnnotation(entry util.SimpleHead) bool {
}
func calculateHookWeight(entry util.SimpleHead) int32 {
hws, _ := entry.Metadata.Annotations[hooks.HookWeightAnno]
hws := entry.Metadata.Annotations[hooks.HookWeightAnno]
hw, err := strconv.Atoi(hws)
if err != nil {
hw = 0

@ -236,7 +236,7 @@ func GetVersionSet(client discovery.ServerGroupsInterface) (chartutil.VersionSet
// for calls to Discovery().ServerGroups(). So in this case, we return
// the default API list. This is also a safe value to return in any other
// odd-ball case.
if groups == nil {
if groups.Size() == 0 {
return chartutil.DefaultVersionSet, nil
}

@ -25,7 +25,6 @@ import (
"github.com/golang/protobuf/ptypes/timestamp"
"golang.org/x/net/context"
grpc "google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
@ -40,8 +39,7 @@ import (
const notesText = "my notes here"
var manifestWithHook = `apiVersion: v1
kind: ConfigMap
var manifestWithHook = `kind: ConfigMap
metadata:
name: test-cm
annotations:
@ -49,9 +47,7 @@ metadata:
data:
name: value`
var manifestWithTestHook = `
apiVersion: v1
kind: Pod
var manifestWithTestHook = `kind: Pod
metadata:
name: finding-nemo,
annotations:
@ -63,8 +59,7 @@ spec:
cmd: fake-command
`
var manifestWithKeep = `apiVersion: v1
kind: ConfigMap
var manifestWithKeep = `kind: ConfigMap
metadata:
name: test-cm-keep
annotations:
@ -73,8 +68,7 @@ data:
name: value
`
var manifestWithUpgradeHooks = `apiVersion: v1
kind: ConfigMap
var manifestWithUpgradeHooks = `kind: ConfigMap
metadata:
name: test-cm
annotations:
@ -82,8 +76,7 @@ metadata:
data:
name: value`
var manifestWithRollbackHooks = `apiVersion: v1
kind: ConfigMap
var manifestWithRollbackHooks = `kind: ConfigMap
metadata:
name: test-cm
annotations:
@ -340,9 +333,7 @@ func (l *mockListServer) SendHeader(m metadata.MD) error { return nil }
func (l *mockListServer) SetTrailer(m metadata.MD) {}
func (l *mockListServer) SetHeader(m metadata.MD) error { return nil }
type mockRunReleaseTestServer struct {
stream grpc.ServerStream
}
type mockRunReleaseTestServer struct{}
func (rs mockRunReleaseTestServer) Send(m *services.TestReleaseResponse) error {
return nil

@ -19,6 +19,6 @@
# versioned.
set -euo pipefail
rm -rf ./vendor/k8s.io/{kube-aggregator,apiserver,apimachinery,client-go,metrics}
rm -rf ./vendor/k8s.io/{api,kube-aggregator,apiserver,apimachinery,client-go,metrics}
cp -r ./vendor/k8s.io/kubernetes/staging/src/k8s.io/{kube-aggregator,apiserver,apimachinery,client-go,metrics} ./vendor/k8s.io
cp -r ./vendor/k8s.io/kubernetes/staging/src/k8s.io/{api,kube-aggregator,apiserver,apimachinery,client-go,metrics} ./vendor/k8s.io

Loading…
Cancel
Save