Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
85c41ef1
Commit
85c41ef1
authored
Apr 11, 2017
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ref(*): kubernetes v1.6
Rebase on kubernetes v1.6
parent
e89e6af0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
402 additions
and
323 deletions
+402
-323
Makefile
Makefile
+1
-0
helm.go
cmd/helm/helm.go
+2
-8
init.go
cmd/helm/init.go
+2
-2
init_test.go
cmd/helm/init_test.go
+6
-5
install.go
cmd/helm/installer/install.go
+13
-16
install_test.go
cmd/helm/installer/install_test.go
+4
-4
uninstall.go
cmd/helm/installer/uninstall.go
+22
-44
uninstall_test.go
cmd/helm/installer/uninstall_test.go
+16
-111
reset.go
cmd/helm/reset.go
+1
-6
reset_test.go
cmd/helm/reset_test.go
+0
-18
glide.lock
glide.lock
+0
-0
glide.yaml
glide.yaml
+10
-33
capabilities.go
pkg/chartutil/capabilities.go
+1
-1
load.go
pkg/chartutil/load.go
+1
-1
values_test.go
pkg/chartutil/values_test.go
+1
-1
portforwarder.go
pkg/helm/portforwarder/portforwarder.go
+5
-4
portforwarder_test.go
pkg/helm/portforwarder/portforwarder_test.go
+2
-1
client.go
pkg/kube/client.go
+0
-0
client_test.go
pkg/kube/client_test.go
+51
-30
config.go
pkg/kube/config.go
+1
-1
namespace.go
pkg/kube/namespace.go
+4
-3
namespace_test.go
pkg/kube/namespace_test.go
+2
-1
result_test.go
pkg/kube/result_test.go
+2
-2
tunnel.go
pkg/kube/tunnel.go
+5
-5
wait.go
pkg/kube/wait.go
+195
-0
filter_test.go
pkg/releaseutil/filter_test.go
+2
-1
sorter_test.go
pkg/releaseutil/sorter_test.go
+3
-2
cfgmaps.go
pkg/storage/driver/cfgmaps.go
+13
-12
mock_test.go
pkg/storage/driver/mock_test.go
+9
-8
release_server.go
pkg/tiller/release_server.go
+3
-3
setup-apimachinery.sh
scripts/setup-apimachinery.sh
+25
-0
No files found.
Makefile
View file @
85c41ef1
...
@@ -119,5 +119,6 @@ ifndef HAS_GIT
...
@@ -119,5 +119,6 @@ ifndef HAS_GIT
endif
endif
glide
install
--strip-vendor
glide
install
--strip-vendor
go
build
-o
bin/protoc-gen-go
./vendor/github.com/golang/protobuf/protoc-gen-go
go
build
-o
bin/protoc-gen-go
./vendor/github.com/golang/protobuf/protoc-gen-go
scripts/setup-apimachinery.sh
include
versioning.mk
include
versioning.mk
cmd/helm/helm.go
View file @
85c41ef1
...
@@ -29,8 +29,8 @@ import (
...
@@ -29,8 +29,8 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/grpclog"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/helm/helmpath"
...
@@ -258,7 +258,7 @@ func defaultTillerNamespace() string {
...
@@ -258,7 +258,7 @@ func defaultTillerNamespace() string {
// getKubeClient is a convenience method for creating kubernetes config and client
// getKubeClient is a convenience method for creating kubernetes config and client
// for a given kubeconfig context
// for a given kubeconfig context
func
getKubeClient
(
context
string
)
(
*
rest
client
.
Config
,
*
internalclientset
.
Clientset
,
error
)
{
func
getKubeClient
(
context
string
)
(
*
rest
.
Config
,
*
internalclientset
.
Clientset
,
error
)
{
config
,
err
:=
kube
.
GetConfig
(
context
)
.
ClientConfig
()
config
,
err
:=
kube
.
GetConfig
(
context
)
.
ClientConfig
()
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
fmt
.
Errorf
(
"could not get kubernetes config for context '%s': %s"
,
context
,
err
)
return
nil
,
nil
,
fmt
.
Errorf
(
"could not get kubernetes config for context '%s': %s"
,
context
,
err
)
...
@@ -270,12 +270,6 @@ func getKubeClient(context string) (*restclient.Config, *internalclientset.Clien
...
@@ -270,12 +270,6 @@ func getKubeClient(context string) (*restclient.Config, *internalclientset.Clien
return
config
,
client
,
nil
return
config
,
client
,
nil
}
}
// getKubeCmd is a convenience method for creating kubernetes cmd client
// for a given kubeconfig context
func
getKubeCmd
(
context
string
)
*
kube
.
Client
{
return
kube
.
New
(
kube
.
GetConfig
(
context
))
}
// ensureHelmClient returns a new helm client impl. if h is not nil.
// ensureHelmClient returns a new helm client impl. if h is not nil.
func
ensureHelmClient
(
h
helm
.
Interface
)
helm
.
Interface
{
func
ensureHelmClient
(
h
helm
.
Interface
)
helm
.
Interface
{
if
h
!=
nil
{
if
h
!=
nil
{
...
...
cmd/helm/init.go
View file @
85c41ef1
...
@@ -23,7 +23,7 @@ import (
...
@@ -23,7 +23,7 @@ import (
"os"
"os"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
kerrors
"k8s.io/kubernetes
/pkg/api/errors"
apierrors
"k8s.io/apimachinery
/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/helm/cmd/helm/installer"
"k8s.io/helm/cmd/helm/installer"
...
@@ -226,7 +226,7 @@ func (i *initCmd) run() error {
...
@@ -226,7 +226,7 @@ func (i *initCmd) run() error {
i
.
kubeClient
=
c
i
.
kubeClient
=
c
}
}
if
err
:=
installer
.
Install
(
i
.
kubeClient
,
&
i
.
opts
);
err
!=
nil
{
if
err
:=
installer
.
Install
(
i
.
kubeClient
,
&
i
.
opts
);
err
!=
nil
{
if
!
k
errors
.
IsAlreadyExists
(
err
)
{
if
!
api
errors
.
IsAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"error installing: %s"
,
err
)
return
fmt
.
Errorf
(
"error installing: %s"
,
err
)
}
}
if
i
.
upgrade
{
if
i
.
upgrade
{
...
...
cmd/helm/init_test.go
View file @
85c41ef1
...
@@ -25,12 +25,13 @@ import (
...
@@ -25,12 +25,13 @@ import (
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
testcore
"k8s.io/client-go/testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
testcore
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/helm/helmpath"
)
)
...
@@ -78,13 +79,13 @@ func TestInitCmd_exists(t *testing.T) {
...
@@ -78,13 +79,13 @@ func TestInitCmd_exists(t *testing.T) {
var
buf
bytes
.
Buffer
var
buf
bytes
.
Buffer
fc
:=
fake
.
NewSimpleClientset
(
&
extensions
.
Deployment
{
fc
:=
fake
.
NewSimpleClientset
(
&
extensions
.
Deployment
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
api
.
NamespaceDefault
,
Name
:
"tiller-deploy"
,
Name
:
"tiller-deploy"
,
},
},
})
})
fc
.
PrependReactor
(
"*"
,
"*"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
PrependReactor
(
"*"
,
"*"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
errors
.
NewAlreadyExists
(
api
.
Resource
(
"deployments"
),
"1"
)
return
true
,
nil
,
api
errors
.
NewAlreadyExists
(
api
.
Resource
(
"deployments"
),
"1"
)
})
})
cmd
:=
&
initCmd
{
cmd
:=
&
initCmd
{
out
:
&
buf
,
out
:
&
buf
,
...
...
cmd/helm/installer/install.go
View file @
85c41ef1
...
@@ -20,13 +20,14 @@ import (
...
@@ -20,13 +20,14 @@ import (
"io/ioutil"
"io/ioutil"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
kerrors
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
extensionsclient
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion"
extensionsclient
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion"
"k8s.io/kubernetes/pkg/util/intstr"
)
)
// Install uses kubernetes client to install tiller.
// Install uses kubernetes client to install tiller.
...
@@ -51,7 +52,7 @@ func Install(client internalclientset.Interface, opts *Options) error {
...
@@ -51,7 +52,7 @@ func Install(client internalclientset.Interface, opts *Options) error {
//
//
// Returns an error if the command failed.
// Returns an error if the command failed.
func
Upgrade
(
client
internalclientset
.
Interface
,
opts
*
Options
)
error
{
func
Upgrade
(
client
internalclientset
.
Interface
,
opts
*
Options
)
error
{
obj
,
err
:=
client
.
Extensions
()
.
Deployments
(
opts
.
Namespace
)
.
Get
(
"tiller-deploy"
)
obj
,
err
:=
client
.
Extensions
()
.
Deployments
(
opts
.
Namespace
)
.
Get
(
deploymentName
,
metav1
.
GetOptions
{}
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -62,15 +63,11 @@ func Upgrade(client internalclientset.Interface, opts *Options) error {
...
@@ -62,15 +63,11 @@ func Upgrade(client internalclientset.Interface, opts *Options) error {
}
}
// If the service does not exists that would mean we are upgrading from a tiller version
// 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.
// that didn't deploy the service, so install it.
if
_
,
err
:=
client
.
Core
()
.
Services
(
opts
.
Namespace
)
.
Get
(
"tiller-deploy"
);
err
!=
nil
{
_
,
err
=
client
.
Core
()
.
Services
(
opts
.
Namespace
)
.
Get
(
serviceName
,
metav1
.
GetOptions
{})
if
!
k
errors
.
IsNotFound
(
err
)
{
if
api
errors
.
IsNotFound
(
err
)
{
return
err
return
createService
(
client
.
Core
(),
opts
.
Namespace
)
}
}
if
err
:=
createService
(
client
.
Core
(),
opts
.
Namespace
);
err
!=
nil
{
return
err
return
err
}
}
return
nil
}
}
// createDeployment creates the Tiller deployment reource
// createDeployment creates the Tiller deployment reource
...
@@ -122,15 +119,15 @@ func generateLabels(labels map[string]string) map[string]string {
...
@@ -122,15 +119,15 @@ func generateLabels(labels map[string]string) map[string]string {
func
generateDeployment
(
opts
*
Options
)
*
extensions
.
Deployment
{
func
generateDeployment
(
opts
*
Options
)
*
extensions
.
Deployment
{
labels
:=
generateLabels
(
map
[
string
]
string
{
"name"
:
"tiller"
})
labels
:=
generateLabels
(
map
[
string
]
string
{
"name"
:
"tiller"
})
d
:=
&
extensions
.
Deployment
{
d
:=
&
extensions
.
Deployment
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
opts
.
Namespace
,
Namespace
:
opts
.
Namespace
,
Name
:
"tiller-deploy"
,
Name
:
deploymentName
,
Labels
:
labels
,
Labels
:
labels
,
},
},
Spec
:
extensions
.
DeploymentSpec
{
Spec
:
extensions
.
DeploymentSpec
{
Replicas
:
1
,
Replicas
:
1
,
Template
:
api
.
PodTemplateSpec
{
Template
:
api
.
PodTemplateSpec
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Labels
:
labels
,
Labels
:
labels
,
},
},
Spec
:
api
.
PodSpec
{
Spec
:
api
.
PodSpec
{
...
@@ -208,9 +205,9 @@ func generateDeployment(opts *Options) *extensions.Deployment {
...
@@ -208,9 +205,9 @@ func generateDeployment(opts *Options) *extensions.Deployment {
func
generateService
(
namespace
string
)
*
api
.
Service
{
func
generateService
(
namespace
string
)
*
api
.
Service
{
labels
:=
generateLabels
(
map
[
string
]
string
{
"name"
:
"tiller"
})
labels
:=
generateLabels
(
map
[
string
]
string
{
"name"
:
"tiller"
})
s
:=
&
api
.
Service
{
s
:=
&
api
.
Service
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Namespace
:
namespace
,
Namespace
:
namespace
,
Name
:
"tiller-deploy"
,
Name
:
serviceName
,
Labels
:
labels
,
Labels
:
labels
,
},
},
Spec
:
api
.
ServiceSpec
{
Spec
:
api
.
ServiceSpec
{
...
@@ -256,7 +253,7 @@ func generateSecret(opts *Options) (*api.Secret, error) {
...
@@ -256,7 +253,7 @@ func generateSecret(opts *Options) (*api.Secret, error) {
secret
:=
&
api
.
Secret
{
secret
:=
&
api
.
Secret
{
Type
:
api
.
SecretTypeOpaque
,
Type
:
api
.
SecretTypeOpaque
,
Data
:
make
(
map
[
string
][]
byte
),
Data
:
make
(
map
[
string
][]
byte
),
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
secretName
,
Name
:
secretName
,
Labels
:
labels
,
Labels
:
labels
,
Namespace
:
opts
.
Namespace
,
Namespace
:
opts
.
Namespace
,
...
...
cmd/helm/installer/install_test.go
View file @
85c41ef1
...
@@ -21,12 +21,12 @@ import (
...
@@ -21,12 +21,12 @@ import (
"testing"
"testing"
"github.com/ghodss/yaml"
"github.com/ghodss/yaml"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/runtime"
testcore
"k8s.io/client-go/testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
testcore
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/helm/pkg/version"
"k8s.io/helm/pkg/version"
)
)
...
@@ -206,7 +206,7 @@ func TestUpgrade_serviceNotFound(t *testing.T) {
...
@@ -206,7 +206,7 @@ func TestUpgrade_serviceNotFound(t *testing.T) {
return
true
,
obj
,
nil
return
true
,
obj
,
nil
})
})
fc
.
AddReactor
(
"get"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
AddReactor
(
"get"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
errors
.
NewNotFound
(
api
.
Resource
(
"services"
),
"1"
)
return
true
,
nil
,
api
errors
.
NewNotFound
(
api
.
Resource
(
"services"
),
"1"
)
})
})
fc
.
AddReactor
(
"create"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
AddReactor
(
"create"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
obj
:=
action
.
(
testcore
.
CreateAction
)
.
GetObject
()
.
(
*
api
.
Service
)
obj
:=
action
.
(
testcore
.
CreateAction
)
.
GetObject
()
.
(
*
api
.
Service
)
...
...
cmd/helm/installer/uninstall.go
View file @
85c41ef1
...
@@ -17,67 +17,45 @@ limitations under the License.
...
@@ -17,67 +17,45 @@ limitations under the License.
package
installer
// import "k8s.io/helm/cmd/helm/installer"
package
installer
// import "k8s.io/helm/cmd/helm/installer"
import
(
import
(
"strings"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/ghodss/yaml"
"k8s.io/kubernetes/pkg/api"
kerrors
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/apis/extensions"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/kubectl"
)
"k8s.io/helm/pkg/kube"
const
(
deploymentName
=
"tiller-deploy"
serviceName
=
"tiller-deploy"
)
)
// Uninstall uses kubernetes client to uninstall tiller
// Uninstall uses kubernetes client to uninstall tiller
func
Uninstall
(
kubeClient
internalclientset
.
Interface
,
kubeCmd
*
kube
.
Client
,
opts
*
Options
)
error
{
func
Uninstall
(
client
internalclientset
.
Interface
,
opts
*
Options
)
error
{
if
_
,
err
:=
kubeClient
.
Core
()
.
Services
(
opts
.
Namespace
)
.
Get
(
"tiller-deploy"
);
err
!=
nil
{
if
err
:=
deleteService
(
client
.
Core
(),
opts
.
Namespace
);
err
!=
nil
{
if
!
kerrors
.
IsNotFound
(
err
)
{
return
err
return
err
}
}
}
else
if
err
:=
deleteService
(
kubeClient
.
Core
(),
opts
.
Namespace
);
err
!=
nil
{
return
deleteDeployment
(
client
,
opts
.
Namespace
)
return
err
}
if
obj
,
err
:=
kubeClient
.
Extensions
()
.
Deployments
(
opts
.
Namespace
)
.
Get
(
"tiller-deploy"
);
err
!=
nil
{
if
!
kerrors
.
IsNotFound
(
err
)
{
return
err
}
}
else
if
err
:=
deleteDeployment
(
kubeCmd
,
opts
.
Namespace
,
obj
);
err
!=
nil
{
return
err
}
return
nil
}
}
// deleteService deletes the Tiller Service resource
// deleteService deletes the Tiller Service resource
func
deleteService
(
client
internalversion
.
ServicesGetter
,
namespace
string
)
error
{
func
deleteService
(
client
internalversion
.
ServicesGetter
,
namespace
string
)
error
{
return
client
.
Services
(
namespace
)
.
Delete
(
"tiller-deploy"
,
&
api
.
DeleteOptions
{})
err
:=
client
.
Services
(
namespace
)
.
Delete
(
serviceName
,
&
metav1
.
DeleteOptions
{})
return
ingoreNotFound
(
err
)
}
}
// deleteDeployment deletes the Tiller Deployment resource
// deleteDeployment deletes the Tiller Deployment resource
// We need to use the
kubeCmd
reaper instead of the kube API because GC for deployment dependents
// 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)
// is not yet supported at the k8s server level (<= 1.5)
func
deleteDeployment
(
kubeCmd
*
kube
.
Client
,
namespace
string
,
obj
*
extensions
.
Deployment
)
error
{
func
deleteDeployment
(
client
internalclientset
.
Interface
,
namespace
string
)
error
{
obj
.
Kind
=
"Deployment"
reaper
,
_
:=
kubectl
.
ReaperFor
(
extensions
.
Kind
(
"Deployment"
),
client
)
obj
.
APIVersion
=
"extensions/v1beta1"
err
:=
reaper
.
Stop
(
namespace
,
deploymentName
,
0
,
nil
)
buf
,
err
:=
yaml
.
Marshal
(
obj
)
return
ingoreNotFound
(
err
)
if
err
!=
nil
{
}
return
err
}
func
ingoreNotFound
(
err
error
)
error
{
reader
:=
strings
.
NewReader
(
string
(
buf
))
if
apierrors
.
IsNotFound
(
err
)
{
infos
,
err
:=
kubeCmd
.
Build
(
namespace
,
reader
)
return
nil
if
err
!=
nil
{
return
err
}
for
_
,
info
:=
range
infos
{
reaper
,
err
:=
kubeCmd
.
Reaper
(
info
.
Mapping
)
if
err
!=
nil
{
return
err
}
}
err
=
reaper
.
Stop
(
info
.
Namespace
,
info
.
Name
,
0
,
nil
)
if
err
!=
nil
{
return
err
return
err
}
}
return
nil
}
}
cmd/helm/installer/uninstall_test.go
View file @
85c41ef1
...
@@ -18,150 +18,55 @@ package installer // import "k8s.io/helm/cmd/helm/installer"
...
@@ -18,150 +18,55 @@ package installer // import "k8s.io/helm/cmd/helm/installer"
import
(
import
(
"testing"
"testing"
"time"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
"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/api"
apierrors
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
testcore
"k8s.io/kubernetes/pkg/client/testing/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/runtime"
"k8s.io/helm/pkg/kube"
)
)
type
fakeReaper
struct
{
namespace
string
name
string
}
func
(
r
*
fakeReaper
)
Stop
(
namespace
,
name
string
,
timeout
time
.
Duration
,
gracePeriod
*
api
.
DeleteOptions
)
error
{
r
.
namespace
=
namespace
r
.
name
=
name
return
nil
}
type
fakeReaperFactory
struct
{
cmdutil
.
Factory
reaper
kubectl
.
Reaper
}
func
(
f
*
fakeReaperFactory
)
Reaper
(
mapping
*
meta
.
RESTMapping
)
(
kubectl
.
Reaper
,
error
)
{
return
f
.
reaper
,
nil
}
func
TestUninstall
(
t
*
testing
.
T
)
{
func
TestUninstall
(
t
*
testing
.
T
)
{
existingService
:=
service
(
api
.
NamespaceDefault
)
existingDeployment
:=
deployment
(
&
Options
{
Namespace
:
api
.
NamespaceDefault
,
ImageSpec
:
"image"
,
UseCanary
:
false
,
})
fc
:=
&
fake
.
Clientset
{}
fc
:=
&
fake
.
Clientset
{}
fc
.
AddReactor
(
"get"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
existingService
,
nil
})
fc
.
AddReactor
(
"delete"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
nil
})
fc
.
AddReactor
(
"get"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
existingDeployment
,
nil
})
f
,
_
,
_
,
_
:=
cmdtesting
.
NewAPIFactory
()
r
:=
&
fakeReaper
{}
rf
:=
&
fakeReaperFactory
{
Factory
:
f
,
reaper
:
r
}
kc
:=
&
kube
.
Client
{
Factory
:
rf
}
opts
:=
&
Options
{
Namespace
:
api
.
NamespaceDefault
}
opts
:=
&
Options
{
Namespace
:
api
.
NamespaceDefault
}
if
err
:=
Uninstall
(
fc
,
kc
,
opts
);
err
!=
nil
{
if
err
:=
Uninstall
(
fc
,
opts
);
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
3
{
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
6
{
t
.
Errorf
(
"unexpected actions: %v, expected 3 actions got %d"
,
actions
,
len
(
actions
))
t
.
Errorf
(
"unexpected actions: %v, expected 6 actions got %d"
,
actions
,
len
(
actions
))
}
if
r
.
namespace
!=
api
.
NamespaceDefault
{
t
.
Errorf
(
"unexpected reaper namespace: %s"
,
r
.
name
)
}
if
r
.
name
!=
"tiller-deploy"
{
t
.
Errorf
(
"unexpected reaper name: %s"
,
r
.
name
)
}
}
}
}
func
TestUninstall_serviceNotFound
(
t
*
testing
.
T
)
{
func
TestUninstall_serviceNotFound
(
t
*
testing
.
T
)
{
existingDeployment
:=
deployment
(
&
Options
{
Namespace
:
api
.
NamespaceDefault
,
ImageSpec
:
"imageToReplace"
,
UseCanary
:
false
})
fc
:=
&
fake
.
Clientset
{}
fc
:=
&
fake
.
Clientset
{}
fc
.
AddReactor
(
"get"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
AddReactor
(
"delete"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
apierrors
.
NewNotFound
(
api
.
Resource
(
"services"
),
"1"
)
return
true
,
nil
,
apierrors
.
NewNotFound
(
schema
.
GroupResource
{
Resource
:
"services"
},
"1"
)
})
fc
.
AddReactor
(
"get"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
existingDeployment
,
nil
})
})
f
,
_
,
_
,
_
:=
cmdtesting
.
NewAPIFactory
()
r
:=
&
fakeReaper
{}
rf
:=
&
fakeReaperFactory
{
Factory
:
f
,
reaper
:
r
}
kc
:=
&
kube
.
Client
{
Factory
:
rf
}
opts
:=
&
Options
{
Namespace
:
api
.
NamespaceDefault
}
opts
:=
&
Options
{
Namespace
:
api
.
NamespaceDefault
}
if
err
:=
Uninstall
(
fc
,
kc
,
opts
);
err
!=
nil
{
if
err
:=
Uninstall
(
fc
,
opts
);
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
2
{
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
6
{
t
.
Errorf
(
"unexpected actions: %v, expected 2 actions got %d"
,
actions
,
len
(
actions
))
t
.
Errorf
(
"unexpected actions: %v, expected 6 actions got %d"
,
actions
,
len
(
actions
))
}
if
r
.
namespace
!=
api
.
NamespaceDefault
{
t
.
Errorf
(
"unexpected reaper namespace: %s"
,
r
.
name
)
}
if
r
.
name
!=
"tiller-deploy"
{
t
.
Errorf
(
"unexpected reaper name: %s"
,
r
.
name
)
}
}
}
}
func
TestUninstall_deploymentNotFound
(
t
*
testing
.
T
)
{
func
TestUninstall_deploymentNotFound
(
t
*
testing
.
T
)
{
existingService
:=
service
(
api
.
NamespaceDefault
)
fc
:=
&
fake
.
Clientset
{}
fc
:=
&
fake
.
Clientset
{}
fc
.
AddReactor
(
"get"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
fc
.
AddReactor
(
"delete"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
existingService
,
nil
})
fc
.
AddReactor
(
"delete"
,
"services"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
nil
})
fc
.
AddReactor
(
"get"
,
"deployments"
,
func
(
action
testcore
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
return
true
,
nil
,
apierrors
.
NewNotFound
(
api
.
Resource
(
"deployments"
),
"1"
)
return
true
,
nil
,
apierrors
.
NewNotFound
(
api
.
Resource
(
"deployments"
),
"1"
)
})
})
f
,
_
,
_
,
_
:=
cmdtesting
.
NewAPIFactory
()
r
:=
&
fakeReaper
{}
rf
:=
&
fakeReaperFactory
{
Factory
:
f
,
reaper
:
r
}
kc
:=
&
kube
.
Client
{
Factory
:
rf
}
opts
:=
&
Options
{
Namespace
:
api
.
NamespaceDefault
}
opts
:=
&
Options
{
Namespace
:
api
.
NamespaceDefault
}
if
err
:=
Uninstall
(
fc
,
kc
,
opts
);
err
!=
nil
{
if
err
:=
Uninstall
(
fc
,
opts
);
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
3
{
if
actions
:=
fc
.
Actions
();
len
(
actions
)
!=
6
{
t
.
Errorf
(
"unexpected actions: %v, expected 3 actions got %d"
,
actions
,
len
(
actions
))
t
.
Errorf
(
"unexpected actions: %v, expected 6 actions got %d"
,
actions
,
len
(
actions
))
}
if
r
.
namespace
!=
""
{
t
.
Errorf
(
"unexpected reaper namespace: %s"
,
r
.
name
)
}
if
r
.
name
!=
""
{
t
.
Errorf
(
"unexpected reaper name: %s"
,
r
.
name
)
}
}
}
}
cmd/helm/reset.go
View file @
85c41ef1
...
@@ -28,7 +28,6 @@ import (
...
@@ -28,7 +28,6 @@ import (
"k8s.io/helm/cmd/helm/installer"
"k8s.io/helm/cmd/helm/installer"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm"
"k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/helm/helmpath"
"k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/proto/hapi/release"
)
)
...
@@ -46,7 +45,6 @@ type resetCmd struct {
...
@@ -46,7 +45,6 @@ type resetCmd struct {
home
helmpath
.
Home
home
helmpath
.
Home
client
helm
.
Interface
client
helm
.
Interface
kubeClient
internalclientset
.
Interface
kubeClient
internalclientset
.
Interface
kubeCmd
*
kube
.
Client
}
}
func
newResetCmd
(
client
helm
.
Interface
,
out
io
.
Writer
)
*
cobra
.
Command
{
func
newResetCmd
(
client
helm
.
Interface
,
out
io
.
Writer
)
*
cobra
.
Command
{
...
@@ -89,9 +87,6 @@ func (d *resetCmd) run() error {
...
@@ -89,9 +87,6 @@ func (d *resetCmd) run() error {
}
}
d
.
kubeClient
=
c
d
.
kubeClient
=
c
}
}
if
d
.
kubeCmd
==
nil
{
d
.
kubeCmd
=
getKubeCmd
(
kubeContext
)
}
res
,
err
:=
d
.
client
.
ListReleases
(
res
,
err
:=
d
.
client
.
ListReleases
(
helm
.
ReleaseListStatuses
([]
release
.
Status_Code
{
release
.
Status_DEPLOYED
}),
helm
.
ReleaseListStatuses
([]
release
.
Status_Code
{
release
.
Status_DEPLOYED
}),
...
@@ -104,7 +99,7 @@ func (d *resetCmd) run() error {
...
@@ -104,7 +99,7 @@ func (d *resetCmd) run() error {
return
fmt
.
Errorf
(
"There are still %d deployed releases (Tip: use --force)."
,
len
(
res
.
Releases
))
return
fmt
.
Errorf
(
"There are still %d deployed releases (Tip: use --force)."
,
len
(
res
.
Releases
))
}
}
if
err
:=
installer
.
Uninstall
(
d
.
kubeClient
,
d
.
kubeCmd
,
&
installer
.
Options
{
Namespace
:
d
.
namespace
});
err
!=
nil
{
if
err
:=
installer
.
Uninstall
(
d
.
kubeClient
,
&
installer
.
Options
{
Namespace
:
d
.
namespace
});
err
!=
nil
{
return
fmt
.
Errorf
(
"error unstalling Tiller: %s"
,
err
)
return
fmt
.
Errorf
(
"error unstalling Tiller: %s"
,
err
)
}
}
...
...
cmd/helm/reset_test.go
View file @
85c41ef1
...
@@ -54,12 +54,6 @@ func TestResetCmd(t *testing.T) {
...
@@ -54,12 +54,6 @@ func TestResetCmd(t *testing.T) {
if
len
(
actions
)
!=
2
{
if
len
(
actions
)
!=
2
{
t
.
Errorf
(
"Expected 2 actions, got %d"
,
len
(
actions
))
t
.
Errorf
(
"Expected 2 actions, got %d"
,
len
(
actions
))
}
}
if
!
actions
[
0
]
.
Matches
(
"get"
,
"services"
)
{
t
.
Errorf
(
"unexpected action: %v, expected get service"
,
actions
[
1
])
}
if
!
actions
[
1
]
.
Matches
(
"get"
,
"deployments"
)
{
t
.
Errorf
(
"unexpected action: %v, expected get deployment"
,
actions
[
0
])
}
expected
:=
"Tiller (the helm server side component) has been uninstalled from your Kubernetes Cluster."
expected
:=
"Tiller (the helm server side component) has been uninstalled from your Kubernetes Cluster."
if
!
strings
.
Contains
(
buf
.
String
(),
expected
)
{
if
!
strings
.
Contains
(
buf
.
String
(),
expected
)
{
t
.
Errorf
(
"expected %q, got %q"
,
expected
,
buf
.
String
())
t
.
Errorf
(
"expected %q, got %q"
,
expected
,
buf
.
String
())
...
@@ -94,12 +88,6 @@ func TestResetCmd_removeHelmHome(t *testing.T) {
...
@@ -94,12 +88,6 @@ func TestResetCmd_removeHelmHome(t *testing.T) {
if
len
(
actions
)
!=
2
{
if
len
(
actions
)
!=
2
{
t
.
Errorf
(
"Expected 2 actions, got %d"
,
len
(
actions
))
t
.
Errorf
(
"Expected 2 actions, got %d"
,
len
(
actions
))
}
}
if
!
actions
[
0
]
.
Matches
(
"get"
,
"services"
)
{
t
.
Errorf
(
"unexpected action: %v, expected get service"
,
actions
[
1
])
}
if
!
actions
[
1
]
.
Matches
(
"get"
,
"deployments"
)
{
t
.
Errorf
(
"unexpected action: %v, expected get deployment"
,
actions
[
0
])
}
expected
:=
"Tiller (the helm server side component) has been uninstalled from your Kubernetes Cluster."
expected
:=
"Tiller (the helm server side component) has been uninstalled from your Kubernetes Cluster."
if
!
strings
.
Contains
(
buf
.
String
(),
expected
)
{
if
!
strings
.
Contains
(
buf
.
String
(),
expected
)
{
t
.
Errorf
(
"expected %q, got %q"
,
expected
,
buf
.
String
())
t
.
Errorf
(
"expected %q, got %q"
,
expected
,
buf
.
String
())
...
@@ -171,12 +159,6 @@ func TestReset_forceFlag(t *testing.T) {
...
@@ -171,12 +159,6 @@ func TestReset_forceFlag(t *testing.T) {
if
len
(
actions
)
!=
2
{
if
len
(
actions
)
!=
2
{
t
.
Errorf
(
"Expected 2 actions, got %d"
,
len
(
actions
))
t
.
Errorf
(
"Expected 2 actions, got %d"
,
len
(
actions
))
}
}
if
!
actions
[
0
]
.
Matches
(
"get"
,
"services"
)
{
t
.
Errorf
(
"unexpected action: %v, expected get service"
,
actions
[
1
])
}
if
!
actions
[
1
]
.
Matches
(
"get"
,
"deployments"
)
{
t
.
Errorf
(
"unexpected action: %v, expected get deployment"
,
actions
[
0
])
}
expected
:=
"Tiller (the helm server side component) has been uninstalled from your Kubernetes Cluster."
expected
:=
"Tiller (the helm server side component) has been uninstalled from your Kubernetes Cluster."
if
!
strings
.
Contains
(
buf
.
String
(),
expected
)
{
if
!
strings
.
Contains
(
buf
.
String
(),
expected
)
{
t
.
Errorf
(
"expected %q, got %q"
,
expected
,
buf
.
String
())
t
.
Errorf
(
"expected %q, got %q"
,
expected
,
buf
.
String
())
...
...
glide.lock
View file @
85c41ef1
This diff is collapsed.
Click to expand it.
glide.yaml
View file @
85c41ef1
...
@@ -7,7 +7,7 @@ import:
...
@@ -7,7 +7,7 @@ import:
-
package
:
github.com/spf13/cobra
-
package
:
github.com/spf13/cobra
version
:
f62e98d28ab7ad31d707ba837a966378465c7b57
version
:
f62e98d28ab7ad31d707ba837a966378465c7b57
-
package
:
github.com/spf13/pflag
-
package
:
github.com/spf13/pflag
version
:
5ccb023bc27df288a957c5e994cd44fd19619465
version
:
9ff6c6923cfffbcd502984b8e0c80539a94968b7
-
package
:
github.com/Masterminds/vcs
-
package
:
github.com/Masterminds/vcs
version
:
~1.11.0
version
:
~1.11.0
-
package
:
github.com/Masterminds/sprig
-
package
:
github.com/Masterminds/sprig
...
@@ -24,39 +24,10 @@ import:
...
@@ -24,39 +24,10 @@ import:
-
ptypes/timestamp
-
ptypes/timestamp
-
package
:
google.golang.org/grpc
-
package
:
google.golang.org/grpc
version
:
1.0.3
version
:
1.0.3
-
package
:
k8s.io/apimachinery
-
package
:
k8s.io/client-go
-
package
:
k8s.io/kubernetes
-
package
:
k8s.io/kubernetes
version
:
~1.5.0
version
:
~1.6.0
subpackages
:
-
pkg/api
-
pkg/api/errors
-
pkg/api/meta
-
pkg/api/unversioned
-
pkg/api/v1
-
pkg/apis/apps/v1beta1
-
pkg/apis/batch
-
pkg/apis/batch/v1
-
pkg/apis/extensions
-
pkg/apis/extensions/v1beta1
-
pkg/client/clientset_generated/internalclientset
-
pkg/client/clientset_generated/internalclientset/typed/core/internalversion
-
pkg/client/clientset_generated/internalclientset/typed/extensions/internalversion
-
pkg/client/restclient
-
pkg/client/typed/discovery
-
pkg/client/unversioned
-
pkg/client/unversioned/clientcmd
-
pkg/client/unversioned/portforward
-
pkg/client/unversioned/remotecommand
-
pkg/fields
-
pkg/kubectl
-
pkg/kubectl/cmd/util
-
pkg/kubectl/resource
-
pkg/labels
-
pkg/runtime
-
pkg/util/intstr
-
pkg/util/strategicpatch
-
pkg/util/wait
-
pkg/version
-
pkg/watch
-
package
:
github.com/gosuri/uitable
-
package
:
github.com/gosuri/uitable
-
package
:
github.com/asaskevich/govalidator
-
package
:
github.com/asaskevich/govalidator
version
:
^4.0.0
version
:
^4.0.0
...
@@ -71,3 +42,9 @@ import:
...
@@ -71,3 +42,9 @@ import:
version
:
~0.1.0
version
:
~0.1.0
-
package
:
github.com/naoina/go-stringutil
-
package
:
github.com/naoina/go-stringutil
version
:
~0.1.0
version
:
~0.1.0
-
package
:
github.com/chai2010/gettext-go
testImports
:
-
package
:
github.com/stretchr/testify
version
:
^1.1.4
subpackages
:
-
assert
pkg/chartutil/capabilities.go
View file @
85c41ef1
...
@@ -16,8 +16,8 @@ limitations under the License.
...
@@ -16,8 +16,8 @@ limitations under the License.
package
chartutil
package
chartutil
import
(
import
(
"k8s.io/apimachinery/pkg/version"
tversion
"k8s.io/helm/pkg/proto/hapi/version"
tversion
"k8s.io/helm/pkg/proto/hapi/version"
"k8s.io/kubernetes/pkg/version"
)
)
// DefaultVersionSet is the default version set, which includes only Core V1 ("v1").
// DefaultVersionSet is the default version set, which includes only Core V1 ("v1").
...
...
pkg/chartutil/load.go
View file @
85c41ef1
...
@@ -22,13 +22,13 @@ import (
...
@@ -22,13 +22,13 @@ import (
"compress/gzip"
"compress/gzip"
"errors"
"errors"
"fmt"
"fmt"
"github.com/facebookgo/symwalk"
"io"
"io"
"io/ioutil"
"io/ioutil"
"os"
"os"
"path/filepath"
"path/filepath"
"strings"
"strings"
"github.com/facebookgo/symwalk"
"github.com/golang/protobuf/ptypes/any"
"github.com/golang/protobuf/ptypes/any"
"k8s.io/helm/pkg/ignore"
"k8s.io/helm/pkg/ignore"
...
...
pkg/chartutil/values_test.go
View file @
85c41ef1
...
@@ -25,10 +25,10 @@ import (
...
@@ -25,10 +25,10 @@ import (
"github.com/golang/protobuf/ptypes/any"
"github.com/golang/protobuf/ptypes/any"
kversion
"k8s.io/apimachinery/pkg/version"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/proto/hapi/chart"
"k8s.io/helm/pkg/timeconv"
"k8s.io/helm/pkg/timeconv"
"k8s.io/helm/pkg/version"
"k8s.io/helm/pkg/version"
kversion
"k8s.io/kubernetes/pkg/version"
)
)
func
TestReadValues
(
t
*
testing
.
T
)
{
func
TestReadValues
(
t
*
testing
.
T
)
{
...
...
pkg/helm/portforwarder/portforwarder.go
View file @
85c41ef1
...
@@ -19,17 +19,18 @@ package portforwarder
...
@@ -19,17 +19,18 @@ package portforwarder
import
(
import
(
"fmt"
"fmt"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/helm/pkg/kube"
"k8s.io/helm/pkg/kube"
)
)
// New creates a new and initialized tunnel.
// New creates a new and initialized tunnel.
func
New
(
namespace
string
,
client
*
internalclientset
.
Clientset
,
config
*
rest
client
.
Config
)
(
*
kube
.
Tunnel
,
error
)
{
func
New
(
namespace
string
,
client
*
internalclientset
.
Clientset
,
config
*
rest
.
Config
)
(
*
kube
.
Tunnel
,
error
)
{
podName
,
err
:=
getTillerPodName
(
client
.
Core
(),
namespace
)
podName
,
err
:=
getTillerPodName
(
client
.
Core
(),
namespace
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -50,7 +51,7 @@ func getTillerPodName(client internalversion.PodsGetter, namespace string) (stri
...
@@ -50,7 +51,7 @@ func getTillerPodName(client internalversion.PodsGetter, namespace string) (stri
}
}
func
getFirstRunningPod
(
client
internalversion
.
PodsGetter
,
namespace
string
,
selector
labels
.
Selector
)
(
*
api
.
Pod
,
error
)
{
func
getFirstRunningPod
(
client
internalversion
.
PodsGetter
,
namespace
string
,
selector
labels
.
Selector
)
(
*
api
.
Pod
,
error
)
{
options
:=
api
.
ListOptions
{
LabelSelector
:
selector
}
options
:=
metav1
.
ListOptions
{
LabelSelector
:
selector
.
String
()
}
pods
,
err
:=
client
.
Pods
(
namespace
)
.
List
(
options
)
pods
,
err
:=
client
.
Pods
(
namespace
)
.
List
(
options
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/helm/portforwarder/portforwarder_test.go
View file @
85c41ef1
...
@@ -19,13 +19,14 @@ package portforwarder
...
@@ -19,13 +19,14 @@ package portforwarder
import
(
import
(
"testing"
"testing"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
)
)
func
mockTillerPod
()
api
.
Pod
{
func
mockTillerPod
()
api
.
Pod
{
return
api
.
Pod
{
return
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"orca"
,
Name
:
"orca"
,
Namespace
:
api
.
NamespaceDefault
,
Namespace
:
api
.
NamespaceDefault
,
Labels
:
map
[
string
]
string
{
"app"
:
"helm"
,
"name"
:
"tiller"
},
Labels
:
map
[
string
]
string
{
"app"
:
"helm"
,
"name"
:
"tiller"
},
...
...
pkg/kube/client.go
View file @
85c41ef1
This diff is collapsed.
Click to expand it.
pkg/kube/client_test.go
View file @
85c41ef1
...
@@ -19,6 +19,7 @@ package kube
...
@@ -19,6 +19,7 @@ package kube
import
(
import
(
"bytes"
"bytes"
"encoding/json"
"encoding/json"
"fmt"
"io"
"io"
"io/ioutil"
"io/ioutil"
"net/http"
"net/http"
...
@@ -26,19 +27,20 @@ import (
...
@@ -26,19 +27,20 @@ import (
"testing"
"testing"
"time"
"time"
"k8s.io/apimachinery/pkg/api/meta"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"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"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/client/restclient/fake"
"k8s.io/kubernetes/pkg/kubectl"
"k8s.io/kubernetes/pkg/kubectl"
cmdtesting
"k8s.io/kubernetes/pkg/kubectl/cmd/testing"
cmdtesting
"k8s.io/kubernetes/pkg/kubectl/cmd/testing"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/printers"
"k8s.io/kubernetes/pkg/watch"
watchjson
"k8s.io/kubernetes/pkg/watch/json"
watchjson
"k8s.io/kubernetes/pkg/watch/json"
)
)
...
@@ -56,7 +58,7 @@ func newPodWithStatus(name string, status api.PodStatus, namespace string) api.P
...
@@ -56,7 +58,7 @@ func newPodWithStatus(name string, status api.PodStatus, namespace string) api.P
ns
=
namespace
ns
=
namespace
}
}
return
api
.
Pod
{
return
api
.
Pod
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
name
,
Name
:
name
,
Namespace
:
ns
,
Namespace
:
ns
,
SelfLink
:
"/api/v1/namespaces/default/pods/"
+
name
,
SelfLink
:
"/api/v1/namespaces/default/pods/"
+
name
,
...
@@ -80,13 +82,13 @@ func newPodList(names ...string) api.PodList {
...
@@ -80,13 +82,13 @@ func newPodList(names ...string) api.PodList {
return
list
return
list
}
}
func
notFoundBody
()
*
unversioned
.
Status
{
func
notFoundBody
()
*
metav1
.
Status
{
return
&
unversioned
.
Status
{
return
&
metav1
.
Status
{
Code
:
http
.
StatusNotFound
,
Code
:
http
.
StatusNotFound
,
Status
:
unversioned
.
StatusFailure
,
Status
:
metav1
.
StatusFailure
,
Reason
:
unversioned
.
StatusReasonNotFound
,
Reason
:
metav1
.
StatusReasonNotFound
,
Message
:
"
\"\"
not found"
,
Message
:
"
\"\"
not found"
,
Details
:
&
unversioned
.
StatusDetails
{},
Details
:
&
metav1
.
StatusDetails
{},
}
}
}
}
...
@@ -101,7 +103,7 @@ type fakeReaper struct {
...
@@ -101,7 +103,7 @@ type fakeReaper struct {
name
string
name
string
}
}
func
(
r
*
fakeReaper
)
Stop
(
namespace
,
name
string
,
timeout
time
.
Duration
,
gracePeriod
*
api
.
DeleteOptions
)
error
{
func
(
r
*
fakeReaper
)
Stop
(
namespace
,
name
string
,
timeout
time
.
Duration
,
gracePeriod
*
metav1
.
DeleteOptions
)
error
{
r
.
name
=
name
r
.
name
=
name
return
nil
return
nil
}
}
...
@@ -124,7 +126,7 @@ func newEventResponse(code int, e *watch.Event) (*http.Response, error) {
...
@@ -124,7 +126,7 @@ func newEventResponse(code int, e *watch.Event) (*http.Response, error) {
header
:=
http
.
Header
{}
header
:=
http
.
Header
{}
header
.
Set
(
"Content-Type"
,
runtime
.
ContentTypeJSON
)
header
.
Set
(
"Content-Type"
,
runtime
.
ContentTypeJSON
)
body
:=
ioutil
.
NopCloser
(
bytes
.
NewReader
(
dispatchedEvent
))
body
:=
ioutil
.
NopCloser
(
bytes
.
NewReader
(
dispatchedEvent
))
return
&
http
.
Response
{
StatusCode
:
200
,
Header
:
header
,
Body
:
body
},
nil
return
&
http
.
Response
{
StatusCode
:
code
,
Header
:
header
,
Body
:
body
},
nil
}
}
func
encodeAndMarshalEvent
(
e
*
watch
.
Event
)
([]
byte
,
error
)
{
func
encodeAndMarshalEvent
(
e
*
watch
.
Event
)
([]
byte
,
error
)
{
...
@@ -133,12 +135,7 @@ func encodeAndMarshalEvent(e *watch.Event) ([]byte, error) {
...
@@ -133,12 +135,7 @@ func encodeAndMarshalEvent(e *watch.Event) ([]byte, error) {
return
nil
,
err
return
nil
,
err
}
}
marshaledEvent
,
err
:=
json
.
Marshal
(
encodedEvent
)
return
json
.
Marshal
(
encodedEvent
)
if
err
!=
nil
{
return
nil
,
err
}
return
marshaledEvent
,
nil
}
}
func
TestUpdate
(
t
*
testing
.
T
)
{
func
TestUpdate
(
t
*
testing
.
T
)
{
...
@@ -150,9 +147,10 @@ func TestUpdate(t *testing.T) {
...
@@ -150,9 +147,10 @@ func TestUpdate(t *testing.T) {
var
actions
[]
string
var
actions
[]
string
f
,
tf
,
codec
,
ns
:=
cmdtesting
.
NewAPIFactory
()
f
,
tf
,
codec
,
_
:=
cmdtesting
.
NewAPIFactory
()
tf
.
Client
=
&
fake
.
RESTClient
{
tf
.
UnstructuredClient
=
&
fake
.
RESTClient
{
NegotiatedSerializer
:
ns
,
APIRegistry
:
api
.
Registry
,
NegotiatedSerializer
:
dynamic
.
ContentConfig
()
.
NegotiatedSerializer
,
Client
:
fake
.
CreateHTTPClient
(
func
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
Client
:
fake
.
CreateHTTPClient
(
func
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
p
,
m
:=
req
.
URL
.
Path
,
req
.
Method
p
,
m
:=
req
.
URL
.
Path
,
req
.
Method
actions
=
append
(
actions
,
p
+
":"
+
m
)
actions
=
append
(
actions
,
p
+
":"
+
m
)
...
@@ -280,11 +278,33 @@ func TestBuild(t *testing.T) {
...
@@ -280,11 +278,33 @@ func TestBuild(t *testing.T) {
}
}
}
}
type
testPrinter
struct
{
Objects
[]
runtime
.
Object
Err
error
printers
.
ResourcePrinter
}
func
(
t
*
testPrinter
)
PrintObj
(
obj
runtime
.
Object
,
out
io
.
Writer
)
error
{
t
.
Objects
=
append
(
t
.
Objects
,
obj
)
fmt
.
Fprintf
(
out
,
"%#v"
,
obj
)
return
t
.
Err
}
func
(
t
*
testPrinter
)
HandledResources
()
[]
string
{
return
[]
string
{}
}
func
(
t
*
testPrinter
)
AfterPrint
(
io
.
Writer
,
string
)
error
{
return
t
.
Err
}
func
TestGet
(
t
*
testing
.
T
)
{
func
TestGet
(
t
*
testing
.
T
)
{
list
:=
newPodList
(
"starfish"
,
"otter"
)
list
:=
newPodList
(
"starfish"
,
"otter"
)
f
,
tf
,
_
,
ns
:=
cmdtesting
.
NewAPIFactory
()
f
,
tf
,
_
,
_
:=
cmdtesting
.
NewAPIFactory
()
tf
.
Client
=
&
fake
.
RESTClient
{
tf
.
Printer
=
&
testPrinter
{}
NegotiatedSerializer
:
ns
,
tf
.
UnstructuredClient
=
&
fake
.
RESTClient
{
APIRegistry
:
api
.
Registry
,
NegotiatedSerializer
:
dynamic
.
ContentConfig
()
.
NegotiatedSerializer
,
Client
:
fake
.
CreateHTTPClient
(
func
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
Client
:
fake
.
CreateHTTPClient
(
func
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
p
,
m
:=
req
.
URL
.
Path
,
req
.
Method
p
,
m
:=
req
.
URL
.
Path
,
req
.
Method
//actions = append(actions, p+":"+m)
//actions = append(actions, p+":"+m)
...
@@ -378,7 +398,7 @@ func TestPerform(t *testing.T) {
...
@@ -378,7 +398,7 @@ func TestPerform(t *testing.T) {
t
.
Errorf
(
"%q. Error while building manifests: %v"
,
tt
.
name
,
err
)
t
.
Errorf
(
"%q. Error while building manifests: %v"
,
tt
.
name
,
err
)
}
}
err
=
perform
(
c
,
tt
.
namespace
,
infos
,
fn
)
err
=
perform
(
infos
,
fn
)
if
(
err
!=
nil
)
!=
tt
.
err
{
if
(
err
!=
nil
)
!=
tt
.
err
{
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
t
.
Errorf
(
"%q. expected error: %v, got %v"
,
tt
.
name
,
tt
.
err
,
err
)
}
}
...
@@ -403,12 +423,12 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
...
@@ -403,12 +423,12 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
podPhase
:
api
.
PodPending
,
podPhase
:
api
.
PodPending
,
expectedPhase
:
api
.
PodUnknown
,
expectedPhase
:
api
.
PodUnknown
,
err
:
true
,
err
:
true
,
errMessage
:
"
timed out waiting for the condition
"
,
errMessage
:
"
watch closed before Until timeout
"
,
},
{
},
{
podPhase
:
api
.
PodRunning
,
podPhase
:
api
.
PodRunning
,
expectedPhase
:
api
.
PodUnknown
,
expectedPhase
:
api
.
PodUnknown
,
err
:
true
,
err
:
true
,
errMessage
:
"
timed out waiting for the condition
"
,
errMessage
:
"
watch closed before Until timeout
"
,
},
{
},
{
podPhase
:
api
.
PodSucceeded
,
podPhase
:
api
.
PodSucceeded
,
expectedPhase
:
api
.
PodSucceeded
,
expectedPhase
:
api
.
PodSucceeded
,
...
@@ -426,6 +446,7 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
...
@@ -426,6 +446,7 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
testPodList
.
Items
=
append
(
testPodList
.
Items
,
newPodWithStatus
(
"bestpod"
,
api
.
PodStatus
{
Phase
:
tt
.
podPhase
},
"test"
))
testPodList
.
Items
=
append
(
testPodList
.
Items
,
newPodWithStatus
(
"bestpod"
,
api
.
PodStatus
{
Phase
:
tt
.
podPhase
},
"test"
))
tf
.
Client
=
&
fake
.
RESTClient
{
tf
.
Client
=
&
fake
.
RESTClient
{
APIRegistry
:
api
.
Registry
,
NegotiatedSerializer
:
ns
,
NegotiatedSerializer
:
ns
,
Client
:
fake
.
CreateHTTPClient
(
func
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
Client
:
fake
.
CreateHTTPClient
(
func
(
req
*
http
.
Request
)
(
*
http
.
Response
,
error
)
{
p
,
m
:=
req
.
URL
.
Path
,
req
.
Method
p
,
m
:=
req
.
URL
.
Path
,
req
.
Method
...
@@ -433,7 +454,7 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
...
@@ -433,7 +454,7 @@ func TestWaitAndGetCompletedPodPhase(t *testing.T) {
switch
{
switch
{
case
p
==
"/namespaces/test/pods/bestpod"
&&
m
==
"GET"
:
case
p
==
"/namespaces/test/pods/bestpod"
&&
m
==
"GET"
:
return
newResponse
(
200
,
&
testPodList
.
Items
[
0
])
return
newResponse
(
200
,
&
testPodList
.
Items
[
0
])
case
p
==
"/
watch/namespaces/test/pods/bestpod
"
&&
m
==
"GET"
:
case
p
==
"/
namespaces/test/pods
"
&&
m
==
"GET"
:
event
:=
watch
.
Event
{
Type
:
watch
.
Added
,
Object
:
&
testPodList
.
Items
[
0
]}
event
:=
watch
.
Event
{
Type
:
watch
.
Added
,
Object
:
&
testPodList
.
Items
[
0
]}
return
newEventResponse
(
200
,
&
event
)
return
newEventResponse
(
200
,
&
event
)
default
:
default
:
...
...
pkg/kube/config.go
View file @
85c41ef1
...
@@ -16,7 +16,7 @@ limitations under the License.
...
@@ -16,7 +16,7 @@ limitations under the License.
package
kube
// import "k8s.io/helm/pkg/kube"
package
kube
// import "k8s.io/helm/pkg/kube"
import
"k8s.io/
kubernetes/pkg/client/unversioned
/clientcmd"
import
"k8s.io/
client-go/tools
/clientcmd"
// GetConfig returns a kubernetes client config for a given context.
// GetConfig returns a kubernetes client config for a given context.
func
GetConfig
(
context
string
)
clientcmd
.
ClientConfig
{
func
GetConfig
(
context
string
)
clientcmd
.
ClientConfig
{
...
...
pkg/kube/namespace.go
View file @
85c41ef1
...
@@ -17,14 +17,15 @@ limitations under the License.
...
@@ -17,14 +17,15 @@ limitations under the License.
package
kube
// import "k8s.io/helm/pkg/kube"
package
kube
// import "k8s.io/helm/pkg/kube"
import
(
import
(
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
)
)
func
createNamespace
(
client
internalclientset
.
Interface
,
namespace
string
)
error
{
func
createNamespace
(
client
internalclientset
.
Interface
,
namespace
string
)
error
{
ns
:=
&
api
.
Namespace
{
ns
:=
&
api
.
Namespace
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
namespace
,
Name
:
namespace
,
},
},
}
}
...
@@ -33,7 +34,7 @@ func createNamespace(client internalclientset.Interface, namespace string) error
...
@@ -33,7 +34,7 @@ func createNamespace(client internalclientset.Interface, namespace string) error
}
}
func
getNamespace
(
client
internalclientset
.
Interface
,
namespace
string
)
(
*
api
.
Namespace
,
error
)
{
func
getNamespace
(
client
internalclientset
.
Interface
,
namespace
string
)
(
*
api
.
Namespace
,
error
)
{
return
client
.
Core
()
.
Namespaces
()
.
Get
(
namespace
)
return
client
.
Core
()
.
Namespaces
()
.
Get
(
namespace
,
metav1
.
GetOptions
{}
)
}
}
func
ensureNamespace
(
client
internalclientset
.
Interface
,
namespace
string
)
error
{
func
ensureNamespace
(
client
internalclientset
.
Interface
,
namespace
string
)
error
{
...
...
pkg/kube/namespace_test.go
View file @
85c41ef1
...
@@ -19,6 +19,7 @@ package kube // import "k8s.io/helm/pkg/kube"
...
@@ -19,6 +19,7 @@ package kube // import "k8s.io/helm/pkg/kube"
import
(
import
(
"testing"
"testing"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/fake"
)
)
...
@@ -30,7 +31,7 @@ func TestEnsureNamespace(t *testing.T) {
...
@@ -30,7 +31,7 @@ func TestEnsureNamespace(t *testing.T) {
if
err
:=
ensureNamespace
(
client
,
"foo"
);
err
!=
nil
{
if
err
:=
ensureNamespace
(
client
,
"foo"
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
}
}
if
_
,
err
:=
client
.
Core
()
.
Namespaces
()
.
Get
(
"foo"
);
err
!=
nil
{
if
_
,
err
:=
client
.
Core
()
.
Namespaces
()
.
Get
(
"foo"
,
metav1
.
GetOptions
{}
);
err
!=
nil
{
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
t
.
Fatalf
(
"unexpected error: %s"
,
err
)
}
}
}
}
pkg/kube/result_test.go
View file @
85c41ef1
...
@@ -19,13 +19,13 @@ package kube // import "k8s.io/helm/pkg/kube"
...
@@ -19,13 +19,13 @@ package kube // import "k8s.io/helm/pkg/kube"
import
(
import
(
"testing"
"testing"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/kubectl/resource"
)
)
func
TestResult
(
t
*
testing
.
T
)
{
func
TestResult
(
t
*
testing
.
T
)
{
mapping
,
err
:=
testapi
.
Default
.
RESTMapper
()
.
RESTMapping
(
unversioned
.
GroupKind
{
Kind
:
"Pod"
})
mapping
,
err
:=
testapi
.
Default
.
RESTMapper
()
.
RESTMapping
(
schema
.
GroupKind
{
Kind
:
"Pod"
})
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatal
(
err
)
t
.
Fatal
(
err
)
}
}
...
...
pkg/kube/tunnel.go
View file @
85c41ef1
...
@@ -23,8 +23,8 @@ import (
...
@@ -23,8 +23,8 @@ import (
"net"
"net"
"strconv"
"strconv"
"k8s.io/
kubernetes/pkg/client/restclien
t"
"k8s.io/
client-go/res
t"
"k8s.io/
kubernetes/pkg/client/unversioned
/portforward"
"k8s.io/
client-go/tools
/portforward"
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
"k8s.io/kubernetes/pkg/client/unversioned/remotecommand"
)
)
...
@@ -37,12 +37,12 @@ type Tunnel struct {
...
@@ -37,12 +37,12 @@ type Tunnel struct {
Out
io
.
Writer
Out
io
.
Writer
stopChan
chan
struct
{}
stopChan
chan
struct
{}
readyChan
chan
struct
{}
readyChan
chan
struct
{}
config
*
rest
client
.
Config
config
*
rest
.
Config
client
rest
client
.
Interface
client
rest
.
Interface
}
}
// NewTunnel creates a new tunnel
// NewTunnel creates a new tunnel
func
NewTunnel
(
client
rest
client
.
Interface
,
config
*
restclien
t
.
Config
,
namespace
,
podName
string
,
remote
int
)
*
Tunnel
{
func
NewTunnel
(
client
rest
.
Interface
,
config
*
res
t
.
Config
,
namespace
,
podName
string
,
remote
int
)
*
Tunnel
{
return
&
Tunnel
{
return
&
Tunnel
{
config
:
config
,
config
:
config
,
client
:
client
,
client
:
client
,
...
...
pkg/kube/wait.go
0 → 100644
View file @
85c41ef1
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
kube
// import "k8s.io/helm/pkg/kube"
import
(
"log"
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/pkg/apis/apps"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset"
core
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/core/v1"
extensions
"k8s.io/kubernetes/pkg/client/clientset_generated/clientset/typed/extensions/v1beta1"
internalclientset
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
deploymentutil
"k8s.io/kubernetes/pkg/controller/deployment/util"
)
// deployment holds associated replicaSets for a deployment
type
deployment
struct
{
replicaSets
*
v1beta1
.
ReplicaSet
deployment
*
v1beta1
.
Deployment
}
// waitForResources polls to get the current status of all pods, PVCs, and Services
// until all are ready or a timeout is reached
func
(
c
*
Client
)
waitForResources
(
timeout
time
.
Duration
,
created
Result
)
error
{
log
.
Printf
(
"beginning wait for resources with timeout of %v"
,
timeout
)
cs
,
_
:=
c
.
ClientSet
()
client
:=
versionedClientsetForDeployment
(
cs
)
return
wait
.
Poll
(
2
*
time
.
Second
,
timeout
,
func
()
(
bool
,
error
)
{
pods
:=
[]
v1
.
Pod
{}
services
:=
[]
v1
.
Service
{}
pvc
:=
[]
v1
.
PersistentVolumeClaim
{}
replicaSets
:=
[]
*
v1beta1
.
ReplicaSet
{}
deployments
:=
[]
deployment
{}
for
_
,
v
:=
range
created
{
obj
,
err
:=
c
.
AsVersionedObject
(
v
.
Object
)
if
err
!=
nil
&&
!
runtime
.
IsNotRegisteredError
(
err
)
{
return
false
,
err
}
switch
value
:=
obj
.
(
type
)
{
case
(
*
v1
.
ReplicationController
)
:
list
,
err
:=
getPods
(
client
,
value
.
Namespace
,
value
.
Spec
.
Selector
)
if
err
!=
nil
{
return
false
,
err
}
pods
=
append
(
pods
,
list
...
)
case
(
*
v1
.
Pod
)
:
pod
,
err
:=
client
.
Core
()
.
Pods
(
value
.
Namespace
)
.
Get
(
value
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
pods
=
append
(
pods
,
*
pod
)
case
(
*
v1beta1
.
Deployment
)
:
// Get the RS children first
rs
,
err
:=
client
.
Extensions
()
.
ReplicaSets
(
value
.
Namespace
)
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Everything
()
.
String
(),
LabelSelector
:
labels
.
Set
(
value
.
Spec
.
Selector
.
MatchLabels
)
.
AsSelector
()
.
String
(),
})
if
err
!=
nil
{
return
false
,
err
}
for
_
,
i
:=
range
rs
.
Items
{
replicaSets
=
append
(
replicaSets
,
&
i
)
}
currentDeployment
,
err
:=
client
.
Extensions
()
.
Deployments
(
value
.
Namespace
)
.
Get
(
value
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
// Find RS associated with deployment
newReplicaSet
,
err
:=
deploymentutil
.
FindNewReplicaSet
(
currentDeployment
,
replicaSets
)
if
err
!=
nil
{
return
false
,
err
}
newDeployment
:=
deployment
{
newReplicaSet
,
currentDeployment
,
}
deployments
=
append
(
deployments
,
newDeployment
)
case
(
*
v1beta1
.
DaemonSet
)
:
list
,
err
:=
getPods
(
client
,
value
.
Namespace
,
value
.
Spec
.
Selector
.
MatchLabels
)
if
err
!=
nil
{
return
false
,
err
}
pods
=
append
(
pods
,
list
...
)
case
(
*
apps
.
StatefulSet
)
:
list
,
err
:=
getPods
(
client
,
value
.
Namespace
,
value
.
Spec
.
Selector
.
MatchLabels
)
if
err
!=
nil
{
return
false
,
err
}
pods
=
append
(
pods
,
list
...
)
case
(
*
v1beta1
.
ReplicaSet
)
:
list
,
err
:=
getPods
(
client
,
value
.
Namespace
,
value
.
Spec
.
Selector
.
MatchLabels
)
if
err
!=
nil
{
return
false
,
err
}
pods
=
append
(
pods
,
list
...
)
case
(
*
v1
.
PersistentVolumeClaim
)
:
claim
,
err
:=
client
.
Core
()
.
PersistentVolumeClaims
(
value
.
Namespace
)
.
Get
(
value
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
pvc
=
append
(
pvc
,
*
claim
)
case
(
*
v1
.
Service
)
:
svc
,
err
:=
client
.
Core
()
.
Services
(
value
.
Namespace
)
.
Get
(
value
.
Name
,
metav1
.
GetOptions
{})
if
err
!=
nil
{
return
false
,
err
}
services
=
append
(
services
,
*
svc
)
}
}
return
podsReady
(
pods
)
&&
servicesReady
(
services
)
&&
volumesReady
(
pvc
)
&&
deploymentsReady
(
deployments
),
nil
})
}
func
podsReady
(
pods
[]
v1
.
Pod
)
bool
{
for
_
,
pod
:=
range
pods
{
if
!
v1
.
IsPodReady
(
&
pod
)
{
return
false
}
}
return
true
}
func
servicesReady
(
svc
[]
v1
.
Service
)
bool
{
for
_
,
s
:=
range
svc
{
// Make sure the service is not explicitly set to "None" before checking the IP
if
s
.
Spec
.
ClusterIP
!=
v1
.
ClusterIPNone
&&
!
v1
.
IsServiceIPSet
(
&
s
)
{
return
false
}
// This checks if the service has a LoadBalancer and that balancer has an Ingress defined
if
s
.
Spec
.
Type
==
v1
.
ServiceTypeLoadBalancer
&&
s
.
Status
.
LoadBalancer
.
Ingress
==
nil
{
return
false
}
}
return
true
}
func
volumesReady
(
vols
[]
v1
.
PersistentVolumeClaim
)
bool
{
for
_
,
v
:=
range
vols
{
if
v
.
Status
.
Phase
!=
v1
.
ClaimBound
{
return
false
}
}
return
true
}
func
deploymentsReady
(
deployments
[]
deployment
)
bool
{
for
_
,
v
:=
range
deployments
{
if
!
(
v
.
replicaSets
.
Status
.
ReadyReplicas
>=
*
v
.
deployment
.
Spec
.
Replicas
-
deploymentutil
.
MaxUnavailable
(
*
v
.
deployment
))
{
return
false
}
}
return
true
}
func
getPods
(
client
clientset
.
Interface
,
namespace
string
,
selector
map
[
string
]
string
)
([]
v1
.
Pod
,
error
)
{
list
,
err
:=
client
.
Core
()
.
Pods
(
namespace
)
.
List
(
metav1
.
ListOptions
{
FieldSelector
:
fields
.
Everything
()
.
String
(),
LabelSelector
:
labels
.
Set
(
selector
)
.
AsSelector
()
.
String
(),
})
return
list
.
Items
,
err
}
func
versionedClientsetForDeployment
(
internalClient
internalclientset
.
Interface
)
clientset
.
Interface
{
if
internalClient
==
nil
{
return
&
clientset
.
Clientset
{}
}
return
&
clientset
.
Clientset
{
CoreV1Client
:
core
.
New
(
internalClient
.
Core
()
.
RESTClient
()),
ExtensionsV1beta1Client
:
extensions
.
New
(
internalClient
.
Extensions
()
.
RESTClient
()),
}
}
pkg/releaseutil/filter_test.go
View file @
85c41ef1
...
@@ -17,8 +17,9 @@ limitations under the License.
...
@@ -17,8 +17,9 @@ limitations under the License.
package
releaseutil
// import "k8s.io/helm/pkg/releaseutil"
package
releaseutil
// import "k8s.io/helm/pkg/releaseutil"
import
(
import
(
rspb
"k8s.io/helm/pkg/proto/hapi/release"
"testing"
"testing"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
)
)
func
TestFilterAny
(
t
*
testing
.
T
)
{
func
TestFilterAny
(
t
*
testing
.
T
)
{
...
...
pkg/releaseutil/sorter_test.go
View file @
85c41ef1
...
@@ -17,10 +17,11 @@ limitations under the License.
...
@@ -17,10 +17,11 @@ limitations under the License.
package
releaseutil
// import "k8s.io/helm/pkg/releaseutil"
package
releaseutil
// import "k8s.io/helm/pkg/releaseutil"
import
(
import
(
rspb
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/timeconv"
"testing"
"testing"
"time"
"time"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
"k8s.io/helm/pkg/timeconv"
)
)
// note: this test data is shared with filter_test.go.
// note: this test data is shared with filter_test.go.
...
...
pkg/storage/driver/cfgmaps.go
View file @
85c41ef1
...
@@ -28,11 +28,12 @@ import (
...
@@ -28,11 +28,12 @@ import (
"time"
"time"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/proto"
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/api"
"k8s.io/kubernetes/pkg/api"
kberrs
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
kblabels
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util/validation"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
)
)
...
@@ -67,9 +68,9 @@ func (cfgmaps *ConfigMaps) Name() string {
...
@@ -67,9 +68,9 @@ func (cfgmaps *ConfigMaps) Name() string {
// or error if not found.
// or error if not found.
func
(
cfgmaps
*
ConfigMaps
)
Get
(
key
string
)
(
*
rspb
.
Release
,
error
)
{
func
(
cfgmaps
*
ConfigMaps
)
Get
(
key
string
)
(
*
rspb
.
Release
,
error
)
{
// fetch the configmap holding the release named by key
// fetch the configmap holding the release named by key
obj
,
err
:=
cfgmaps
.
impl
.
Get
(
key
)
obj
,
err
:=
cfgmaps
.
impl
.
Get
(
key
,
metav1
.
GetOptions
{}
)
if
err
!=
nil
{
if
err
!=
nil
{
if
kber
rs
.
IsNotFound
(
err
)
{
if
apierro
rs
.
IsNotFound
(
err
)
{
return
nil
,
ErrReleaseNotFound
(
key
)
return
nil
,
ErrReleaseNotFound
(
key
)
}
}
...
@@ -91,7 +92,7 @@ func (cfgmaps *ConfigMaps) Get(key string) (*rspb.Release, error) {
...
@@ -91,7 +92,7 @@ func (cfgmaps *ConfigMaps) Get(key string) (*rspb.Release, error) {
// configmap fails to retrieve the releases.
// configmap fails to retrieve the releases.
func
(
cfgmaps
*
ConfigMaps
)
List
(
filter
func
(
*
rspb
.
Release
)
bool
)
([]
*
rspb
.
Release
,
error
)
{
func
(
cfgmaps
*
ConfigMaps
)
List
(
filter
func
(
*
rspb
.
Release
)
bool
)
([]
*
rspb
.
Release
,
error
)
{
lsel
:=
kblabels
.
Set
{
"OWNER"
:
"TILLER"
}
.
AsSelector
()
lsel
:=
kblabels
.
Set
{
"OWNER"
:
"TILLER"
}
.
AsSelector
()
opts
:=
api
.
ListOptions
{
LabelSelector
:
lsel
}
opts
:=
metav1
.
ListOptions
{
LabelSelector
:
lsel
.
String
()
}
list
,
err
:=
cfgmaps
.
impl
.
List
(
opts
)
list
,
err
:=
cfgmaps
.
impl
.
List
(
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -127,7 +128,7 @@ func (cfgmaps *ConfigMaps) Query(labels map[string]string) ([]*rspb.Release, err
...
@@ -127,7 +128,7 @@ func (cfgmaps *ConfigMaps) Query(labels map[string]string) ([]*rspb.Release, err
ls
[
k
]
=
v
ls
[
k
]
=
v
}
}
opts
:=
api
.
ListOptions
{
LabelSelector
:
ls
.
AsSelector
()}
opts
:=
metav1
.
ListOptions
{
LabelSelector
:
ls
.
AsSelector
()
.
String
()}
list
,
err
:=
cfgmaps
.
impl
.
List
(
opts
)
list
,
err
:=
cfgmaps
.
impl
.
List
(
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -168,7 +169,7 @@ func (cfgmaps *ConfigMaps) Create(key string, rls *rspb.Release) error {
...
@@ -168,7 +169,7 @@ func (cfgmaps *ConfigMaps) Create(key string, rls *rspb.Release) error {
}
}
// push the configmap object out into the kubiverse
// push the configmap object out into the kubiverse
if
_
,
err
:=
cfgmaps
.
impl
.
Create
(
obj
);
err
!=
nil
{
if
_
,
err
:=
cfgmaps
.
impl
.
Create
(
obj
);
err
!=
nil
{
if
kber
rs
.
IsAlreadyExists
(
err
)
{
if
apierro
rs
.
IsAlreadyExists
(
err
)
{
return
ErrReleaseExists
(
rls
.
Name
)
return
ErrReleaseExists
(
rls
.
Name
)
}
}
...
@@ -206,15 +207,15 @@ func (cfgmaps *ConfigMaps) Update(key string, rls *rspb.Release) error {
...
@@ -206,15 +207,15 @@ func (cfgmaps *ConfigMaps) Update(key string, rls *rspb.Release) error {
func
(
cfgmaps
*
ConfigMaps
)
Delete
(
key
string
)
(
rls
*
rspb
.
Release
,
err
error
)
{
func
(
cfgmaps
*
ConfigMaps
)
Delete
(
key
string
)
(
rls
*
rspb
.
Release
,
err
error
)
{
// fetch the release to check existence
// fetch the release to check existence
if
rls
,
err
=
cfgmaps
.
Get
(
key
);
err
!=
nil
{
if
rls
,
err
=
cfgmaps
.
Get
(
key
);
err
!=
nil
{
if
kber
rs
.
IsNotFound
(
err
)
{
if
apierro
rs
.
IsNotFound
(
err
)
{
return
nil
,
ErrRelease
NotFound
(
key
)
return
nil
,
ErrRelease
Exists
(
rls
.
Name
)
}
}
logerrf
(
err
,
"delete: failed to get release %q"
,
key
)
logerrf
(
err
,
"delete: failed to get release %q"
,
key
)
return
nil
,
err
return
nil
,
err
}
}
// delete the release
// delete the release
if
err
=
cfgmaps
.
impl
.
Delete
(
key
,
&
api
.
DeleteOptions
{});
err
!=
nil
{
if
err
=
cfgmaps
.
impl
.
Delete
(
key
,
&
metav1
.
DeleteOptions
{});
err
!=
nil
{
return
rls
,
err
return
rls
,
err
}
}
return
rls
,
nil
return
rls
,
nil
...
@@ -254,7 +255,7 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*api.Config
...
@@ -254,7 +255,7 @@ func newConfigMapsObject(key string, rls *rspb.Release, lbs labels) (*api.Config
// create and return configmap object
// create and return configmap object
return
&
api
.
ConfigMap
{
return
&
api
.
ConfigMap
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
key
,
Name
:
key
,
Labels
:
lbs
.
toMap
(),
Labels
:
lbs
.
toMap
(),
},
},
...
...
pkg/storage/driver/mock_test.go
View file @
85c41ef1
...
@@ -20,8 +20,9 @@ import (
...
@@ -20,8 +20,9 @@ import (
"fmt"
"fmt"
"testing"
"testing"
apierrors
"k8s.io/apimachinery/pkg/api/errors"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api"
kberrs
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/core/internalversion"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
rspb
"k8s.io/helm/pkg/proto/hapi/release"
...
@@ -96,16 +97,16 @@ func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Releas
...
@@ -96,16 +97,16 @@ func (mock *MockConfigMapsInterface) Init(t *testing.T, releases ...*rspb.Releas
}
}
// Get returns the ConfigMap by name.
// Get returns the ConfigMap by name.
func
(
mock
*
MockConfigMapsInterface
)
Get
(
name
string
)
(
*
api
.
ConfigMap
,
error
)
{
func
(
mock
*
MockConfigMapsInterface
)
Get
(
name
string
,
options
metav1
.
GetOptions
)
(
*
api
.
ConfigMap
,
error
)
{
object
,
ok
:=
mock
.
objects
[
name
]
object
,
ok
:=
mock
.
objects
[
name
]
if
!
ok
{
if
!
ok
{
return
nil
,
kber
rs
.
NewNotFound
(
api
.
Resource
(
"tests"
),
name
)
return
nil
,
apierro
rs
.
NewNotFound
(
api
.
Resource
(
"tests"
),
name
)
}
}
return
object
,
nil
return
object
,
nil
}
}
// List returns the a of ConfigMaps.
// List returns the a of ConfigMaps.
func
(
mock
*
MockConfigMapsInterface
)
List
(
opts
api
.
ListOptions
)
(
*
api
.
ConfigMapList
,
error
)
{
func
(
mock
*
MockConfigMapsInterface
)
List
(
opts
metav1
.
ListOptions
)
(
*
api
.
ConfigMapList
,
error
)
{
var
list
api
.
ConfigMapList
var
list
api
.
ConfigMapList
for
_
,
cfgmap
:=
range
mock
.
objects
{
for
_
,
cfgmap
:=
range
mock
.
objects
{
list
.
Items
=
append
(
list
.
Items
,
*
cfgmap
)
list
.
Items
=
append
(
list
.
Items
,
*
cfgmap
)
...
@@ -117,7 +118,7 @@ func (mock *MockConfigMapsInterface) List(opts api.ListOptions) (*api.ConfigMapL
...
@@ -117,7 +118,7 @@ func (mock *MockConfigMapsInterface) List(opts api.ListOptions) (*api.ConfigMapL
func
(
mock
*
MockConfigMapsInterface
)
Create
(
cfgmap
*
api
.
ConfigMap
)
(
*
api
.
ConfigMap
,
error
)
{
func
(
mock
*
MockConfigMapsInterface
)
Create
(
cfgmap
*
api
.
ConfigMap
)
(
*
api
.
ConfigMap
,
error
)
{
name
:=
cfgmap
.
ObjectMeta
.
Name
name
:=
cfgmap
.
ObjectMeta
.
Name
if
object
,
ok
:=
mock
.
objects
[
name
];
ok
{
if
object
,
ok
:=
mock
.
objects
[
name
];
ok
{
return
object
,
kber
rs
.
NewAlreadyExists
(
api
.
Resource
(
"tests"
),
name
)
return
object
,
apierro
rs
.
NewAlreadyExists
(
api
.
Resource
(
"tests"
),
name
)
}
}
mock
.
objects
[
name
]
=
cfgmap
mock
.
objects
[
name
]
=
cfgmap
return
cfgmap
,
nil
return
cfgmap
,
nil
...
@@ -127,16 +128,16 @@ func (mock *MockConfigMapsInterface) Create(cfgmap *api.ConfigMap) (*api.ConfigM
...
@@ -127,16 +128,16 @@ func (mock *MockConfigMapsInterface) Create(cfgmap *api.ConfigMap) (*api.ConfigM
func
(
mock
*
MockConfigMapsInterface
)
Update
(
cfgmap
*
api
.
ConfigMap
)
(
*
api
.
ConfigMap
,
error
)
{
func
(
mock
*
MockConfigMapsInterface
)
Update
(
cfgmap
*
api
.
ConfigMap
)
(
*
api
.
ConfigMap
,
error
)
{
name
:=
cfgmap
.
ObjectMeta
.
Name
name
:=
cfgmap
.
ObjectMeta
.
Name
if
_
,
ok
:=
mock
.
objects
[
name
];
!
ok
{
if
_
,
ok
:=
mock
.
objects
[
name
];
!
ok
{
return
nil
,
kber
rs
.
NewNotFound
(
api
.
Resource
(
"tests"
),
name
)
return
nil
,
apierro
rs
.
NewNotFound
(
api
.
Resource
(
"tests"
),
name
)
}
}
mock
.
objects
[
name
]
=
cfgmap
mock
.
objects
[
name
]
=
cfgmap
return
cfgmap
,
nil
return
cfgmap
,
nil
}
}
// Delete deletes a ConfigMap by name.
// Delete deletes a ConfigMap by name.
func
(
mock
*
MockConfigMapsInterface
)
Delete
(
name
string
,
opts
*
api
.
DeleteOptions
)
error
{
func
(
mock
*
MockConfigMapsInterface
)
Delete
(
name
string
,
opts
*
metav1
.
DeleteOptions
)
error
{
if
_
,
ok
:=
mock
.
objects
[
name
];
!
ok
{
if
_
,
ok
:=
mock
.
objects
[
name
];
!
ok
{
return
kber
rs
.
NewNotFound
(
api
.
Resource
(
"tests"
),
name
)
return
apierro
rs
.
NewNotFound
(
api
.
Resource
(
"tests"
),
name
)
}
}
delete
(
mock
.
objects
,
name
)
delete
(
mock
.
objects
,
name
)
return
nil
return
nil
...
...
pkg/tiller/release_server.go
View file @
85c41ef1
...
@@ -27,9 +27,9 @@ import (
...
@@ -27,9 +27,9 @@ import (
"github.com/technosophos/moniker"
"github.com/technosophos/moniker"
ctx
"golang.org/x/net/context"
ctx
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/api/unversioned"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/discovery"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/typed/discovery"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/chartutil"
"k8s.io/helm/pkg/hooks"
"k8s.io/helm/pkg/hooks"
...
@@ -771,7 +771,7 @@ func getVersionSet(client discovery.ServerGroupsInterface) (chartutil.VersionSet
...
@@ -771,7 +771,7 @@ func getVersionSet(client discovery.ServerGroupsInterface) (chartutil.VersionSet
return
chartutil
.
DefaultVersionSet
,
nil
return
chartutil
.
DefaultVersionSet
,
nil
}
}
versions
:=
unversioned
.
ExtractGroupVersions
(
groups
)
versions
:=
metav1
.
ExtractGroupVersions
(
groups
)
return
chartutil
.
NewVersionSet
(
versions
...
),
nil
return
chartutil
.
NewVersionSet
(
versions
...
),
nil
}
}
...
...
scripts/setup-apimachinery.sh
0 → 100755
View file @
85c41ef1
#!/usr/bin/env bash
# Copyright 2016 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Copies the current versions of apimachinery and client-go out of the
# main kubernetes repo. These repos are currently out of sync and not
# versioned.
set
-euo
pipefail
rm
-rf
./vendor/k8s.io/
{
kube-aggregator,apiserver,apimachinery,client-go
}
cp
-r
./vendor/k8s.io/kubernetes/staging/src/k8s.io/
{
kube-aggregator,apiserver,apimachinery,client-go
}
./vendor/k8s.io
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment