未验证 提交 0c919e21 编写于 作者: M Marcin Maciaszczyk 提交者: GitHub

API Version migration (#2575)

* Migrate RBAC from v1beta1 to v1

* Migrate storage from v1beta1 to v1

* Migrate resourcechannels.go

* Migrate replicaset and statefulset packages

* Migrate the rest of extensions/v1beta1 to apps/v1beta2

* Make build pass

* Fix deployment issue

* Fix tests
上级 0921f74b
......@@ -173,9 +173,9 @@ func (self *clientManager) VerberClient(req *restful.Request) (ResourceVerber, e
}
return NewResourceVerber(client.CoreV1().RESTClient(),
client.ExtensionsV1beta1().RESTClient(), client.AppsV1beta1().RESTClient(),
client.ExtensionsV1beta1().RESTClient(), client.AppsV1beta2().RESTClient(),
client.BatchV1().RESTClient(), client.BatchV1beta1().RESTClient(), client.AutoscalingV1().RESTClient(),
client.StorageV1beta1().RESTClient()), nil
client.StorageV1().RESTClient()), nil
}
// SetTokenManager sets the token manager that will be used for token decryption.
......
......@@ -15,15 +15,15 @@
package common
import (
apps "k8s.io/api/apps/v1beta2"
batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// FilterPodsByControllerResource returns a subset of pods controlled by given deployment.
func FilterDeploymentPodsByOwnerReference(deployment extensions.Deployment, allRS []extensions.ReplicaSet,
func FilterDeploymentPodsByOwnerReference(deployment apps.Deployment, allRS []apps.ReplicaSet,
allPods []v1.Pod) []v1.Pod {
var matchingPods []v1.Pod
......@@ -112,7 +112,7 @@ func EqualIgnoreHash(template1, template2 v1.PodTemplateSpec) bool {
}
// We make sure len(labels2) >= len(labels1)
for k, v := range labels2 {
if labels1[k] != v && k != extensions.DefaultDeploymentUniqueLabelKey {
if labels1[k] != v && k != apps.DefaultDeploymentUniqueLabelKey {
return false
}
}
......
......@@ -16,14 +16,14 @@ package common
import (
"github.com/kubernetes/dashboard/src/app/backend/api"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
autoscaling "k8s.io/api/autoscaling/v1"
batch "k8s.io/api/batch/v1"
batch2 "k8s.io/api/batch/v1beta1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
rbac "k8s.io/api/rbac/v1beta1"
storage "k8s.io/api/storage/v1beta1"
rbac "k8s.io/api/rbac/v1"
storage "k8s.io/api/storage/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
client "k8s.io/client-go/kubernetes"
)
......@@ -91,10 +91,6 @@ type ResourceChannels struct {
// List and error channels to Secrets.
SecretList SecretListChannel
// List and error channels to PodMetrics.
// TODO take care of that
//PodMetrics PodMetricsChannel
// List and error channels to PersistentVolumes
PersistentVolumeList PersistentVolumeListChannel
......@@ -107,9 +103,6 @@ type ResourceChannels struct {
// List and error channels to HorizontalPodAutoscalers
HorizontalPodAutoscalerList HorizontalPodAutoscalerListChannel
// List and error channels to ThirdPartyResources
ThirdPartyResourceList ThirdPartyResourceListChannel
// List and error channels to StorageClasses
StorageClassList StorageClassListChannel
......@@ -417,7 +410,7 @@ func GetReplicationControllerListChannel(client client.Interface,
// DeploymentListChannel is a list and error channels to Deployments.
type DeploymentListChannel struct {
List chan *extensions.DeploymentList
List chan *apps.DeploymentList
Error chan error
}
......@@ -427,14 +420,14 @@ func GetDeploymentListChannel(client client.Interface,
nsQuery *NamespaceQuery, numReads int) DeploymentListChannel {
channel := DeploymentListChannel{
List: make(chan *extensions.DeploymentList, numReads),
List: make(chan *apps.DeploymentList, numReads),
Error: make(chan error, numReads),
}
go func() {
list, err := client.ExtensionsV1beta1().Deployments(nsQuery.ToRequestParam()).
list, err := client.AppsV1beta2().Deployments(nsQuery.ToRequestParam()).
List(api.ListEverything)
var filteredItems []extensions.Deployment
var filteredItems []apps.Deployment
for _, item := range list.Items {
if nsQuery.Matches(item.ObjectMeta.Namespace) {
filteredItems = append(filteredItems, item)
......@@ -452,7 +445,7 @@ func GetDeploymentListChannel(client client.Interface,
// ReplicaSetListChannel is a list and error channels to Replica Sets.
type ReplicaSetListChannel struct {
List chan *extensions.ReplicaSetList
List chan *apps.ReplicaSetList
Error chan error
}
......@@ -468,14 +461,14 @@ func GetReplicaSetListChannel(client client.Interface,
func GetReplicaSetListChannelWithOptions(client client.Interface, nsQuery *NamespaceQuery,
options metaV1.ListOptions, numReads int) ReplicaSetListChannel {
channel := ReplicaSetListChannel{
List: make(chan *extensions.ReplicaSetList, numReads),
List: make(chan *apps.ReplicaSetList, numReads),
Error: make(chan error, numReads),
}
go func() {
list, err := client.ExtensionsV1beta1().ReplicaSets(nsQuery.ToRequestParam()).
list, err := client.AppsV1beta2().ReplicaSets(nsQuery.ToRequestParam()).
List(options)
var filteredItems []extensions.ReplicaSet
var filteredItems []apps.ReplicaSet
for _, item := range list.Items {
if nsQuery.Matches(item.ObjectMeta.Namespace) {
filteredItems = append(filteredItems, item)
......@@ -493,7 +486,7 @@ func GetReplicaSetListChannelWithOptions(client client.Interface, nsQuery *Names
// DaemonSetListChannel is a list and error channels to Nodes.
type DaemonSetListChannel struct {
List chan *extensions.DaemonSetList
List chan *apps.DaemonSetList
Error chan error
}
......@@ -501,13 +494,13 @@ type DaemonSetListChannel struct {
// numReads times.
func GetDaemonSetListChannel(client client.Interface, nsQuery *NamespaceQuery, numReads int) DaemonSetListChannel {
channel := DaemonSetListChannel{
List: make(chan *extensions.DaemonSetList, numReads),
List: make(chan *apps.DaemonSetList, numReads),
Error: make(chan error, numReads),
}
go func() {
list, err := client.ExtensionsV1beta1().DaemonSets(nsQuery.ToRequestParam()).List(api.ListEverything)
var filteredItems []extensions.DaemonSet
list, err := client.AppsV1beta2().DaemonSets(nsQuery.ToRequestParam()).List(api.ListEverything)
var filteredItems []apps.DaemonSet
for _, item := range list.Items {
if nsQuery.Matches(item.ObjectMeta.Namespace) {
filteredItems = append(filteredItems, item)
......@@ -602,7 +595,7 @@ func GetStatefulSetListChannel(client client.Interface,
}
go func() {
statefulSets, err := client.AppsV1beta1().StatefulSets(nsQuery.ToRequestParam()).List(api.ListEverything)
statefulSets, err := client.AppsV1beta2().StatefulSets(nsQuery.ToRequestParam()).List(api.ListEverything)
var filteredItems []apps.StatefulSet
for _, item := range statefulSets.Items {
if nsQuery.Matches(item.ObjectMeta.Namespace) {
......@@ -702,7 +695,7 @@ func GetRoleListChannel(client client.Interface, numReads int) RoleListChannel {
}
go func() {
list, err := client.RbacV1beta1().Roles("").List(api.ListEverything)
list, err := client.RbacV1().Roles("").List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
channel.Error <- err
......@@ -727,7 +720,7 @@ func GetClusterRoleListChannel(client client.Interface, numReads int) ClusterRol
}
go func() {
list, err := client.RbacV1beta1().ClusterRoles().List(api.ListEverything)
list, err := client.RbacV1().ClusterRoles().List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
channel.Error <- err
......@@ -752,7 +745,7 @@ func GetRoleBindingListChannel(client client.Interface, numReads int) RoleBindin
}
go func() {
list, err := client.RbacV1beta1().RoleBindings("").List(api.ListEverything)
list, err := client.RbacV1().RoleBindings("").List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
channel.Error <- err
......@@ -778,7 +771,7 @@ func GetClusterRoleBindingListChannel(client client.Interface,
}
go func() {
list, err := client.RbacV1beta1().ClusterRoleBindings().List(api.ListEverything)
list, err := client.RbacV1().ClusterRoleBindings().List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
channel.Error <- err
......@@ -884,7 +877,7 @@ func GetHorizontalPodAutoscalerListChannel(client client.Interface, nsQuery *Nam
}
go func() {
list, err := client.Autoscaling().HorizontalPodAutoscalers(nsQuery.ToRequestParam()).
list, err := client.AutoscalingV1().HorizontalPodAutoscalers(nsQuery.ToRequestParam()).
List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
......@@ -895,32 +888,6 @@ func GetHorizontalPodAutoscalerListChannel(client client.Interface, nsQuery *Nam
return channel
}
// ThirdPartyResourceListChannel is a list and error channels to third party resources.
type ThirdPartyResourceListChannel struct {
List chan *extensions.ThirdPartyResourceList
Error chan error
}
// GetThirdPartyResourceListChannel returns a pair of channels to a third party resource list and
// errors that both must be read numReads times.
func GetThirdPartyResourceListChannel(client client.Interface,
numReads int) ThirdPartyResourceListChannel {
channel := ThirdPartyResourceListChannel{
List: make(chan *extensions.ThirdPartyResourceList, numReads),
Error: make(chan error, numReads),
}
go func() {
list, err := client.ExtensionsV1beta1().ThirdPartyResources().List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
channel.Error <- err
}
}()
return channel
}
// StorageClassListChannel is a list and error channels to storage classes.
type StorageClassListChannel struct {
List chan *storage.StorageClassList
......@@ -936,7 +903,7 @@ func GetStorageClassListChannel(client client.Interface, numReads int) StorageCl
}
go func() {
list, err := client.StorageV1beta1().StorageClasses().List(api.ListEverything)
list, err := client.StorageV1().StorageClasses().List(api.ListEverything)
for i := 0; i < numReads; i++ {
channel.List <- list
channel.Error <- err
......
......@@ -22,10 +22,9 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
batch "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
client "k8s.io/client-go/kubernetes"
......@@ -73,7 +72,7 @@ func NewResourceController(ref meta.OwnerReference, namespace string, client cli
}
return JobController(*job), nil
case api.ResourceKindReplicaSet:
rs, err := client.ExtensionsV1beta1().ReplicaSets(namespace).Get(ref.Name, meta.GetOptions{})
rs, err := client.AppsV1beta2().ReplicaSets(namespace).Get(ref.Name, meta.GetOptions{})
if err != nil {
return nil, err
}
......@@ -85,13 +84,13 @@ func NewResourceController(ref meta.OwnerReference, namespace string, client cli
}
return ReplicationControllerController(*rc), nil
case api.ResourceKindDaemonSet:
ds, err := client.ExtensionsV1beta1().DaemonSets(namespace).Get(ref.Name, meta.GetOptions{})
ds, err := client.AppsV1beta2().DaemonSets(namespace).Get(ref.Name, meta.GetOptions{})
if err != nil {
return nil, err
}
return DaemonSetController(*ds), nil
case api.ResourceKindStatefulSet:
ss, err := client.AppsV1beta1().StatefulSets(namespace).Get(ref.Name, meta.GetOptions{})
ss, err := client.AppsV1beta2().StatefulSets(namespace).Get(ref.Name, meta.GetOptions{})
if err != nil {
return nil, err
}
......@@ -137,7 +136,7 @@ func (self JobController) GetLogSources(allPods []v1.Pod) LogSources {
// ReplicaSetController is an alias-type for Kubernetes API Replica Set type. It allows to provide
// custom set of functions for already existing type.
type ReplicaSetController extensions.ReplicaSet
type ReplicaSetController apps.ReplicaSet
// Get is an implementation of Get method from ResourceController interface.
func (self ReplicaSetController) Get(allPods []v1.Pod, allEvents []v1.Event) ResourceOwner {
......@@ -156,7 +155,7 @@ func (self ReplicaSetController) Get(allPods []v1.Pod, allEvents []v1.Event) Res
// UID is an implementation of UID method from ResourceController interface.
func (self ReplicaSetController) UID() types.UID {
return extensions.ReplicaSet(self).UID
return apps.ReplicaSet(self).UID
}
// GetLogSources is an implementation of the GetLogSources method from ResourceController interface.
......@@ -206,7 +205,7 @@ func (self ReplicationControllerController) GetLogSources(allPods []v1.Pod) LogS
// DaemonSetController is an alias-type for Kubernetes API Daemon Set type. It allows to provide
// custom set of functions for already existing type.
type DaemonSetController extensions.DaemonSet
type DaemonSetController apps.DaemonSet
// Get is an implementation of Get method from ResourceController interface.
func (self DaemonSetController) Get(allPods []v1.Pod, allEvents []v1.Event) ResourceOwner {
......@@ -226,7 +225,7 @@ func (self DaemonSetController) Get(allPods []v1.Pod, allEvents []v1.Event) Reso
// UID is an implementation of UID method from ResourceController interface.
func (self DaemonSetController) UID() types.UID {
return extensions.DaemonSet(self).UID
return apps.DaemonSet(self).UID
}
// GetLogSources is an implementation of the GetLogSources method from ResourceController interface.
......
......@@ -18,8 +18,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
......@@ -32,7 +32,7 @@ import (
func GetServicesForDSDeletion(client client.Interface, labelSelector labels.Selector,
namespace string) ([]v1.Service, error) {
daemonSet, err := client.Extensions().DaemonSets(namespace).List(metaV1.ListOptions{
daemonSet, err := client.AppsV1beta2().DaemonSets(namespace).List(metaV1.ListOptions{
LabelSelector: labelSelector.String(),
FieldSelector: fields.Everything().String(),
})
......@@ -58,9 +58,9 @@ func GetServicesForDSDeletion(client client.Interface, labelSelector labels.Sele
return services.Items, nil
}
// The code below allows to perform complex data section on []extensions.DaemonSet
// The code below allows to perform complex data section on Daemon Set
type DaemonSetCell extensions.DaemonSet
type DaemonSetCell apps.DaemonSet
func (self DaemonSetCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue {
switch name {
......@@ -85,7 +85,7 @@ func (self DaemonSetCell) GetResourceSelector() *metricapi.ResourceSelector {
}
}
func ToCells(std []extensions.DaemonSet) []dataselect.DataCell {
func ToCells(std []apps.DaemonSet) []dataselect.DataCell {
cells := make([]dataselect.DataCell, len(std))
for i := range std {
cells[i] = DaemonSetCell(std[i])
......@@ -93,10 +93,10 @@ func ToCells(std []extensions.DaemonSet) []dataselect.DataCell {
return cells
}
func FromCells(cells []dataselect.DataCell) []extensions.DaemonSet {
std := make([]extensions.DaemonSet, len(cells))
func FromCells(cells []dataselect.DataCell) []apps.DaemonSet {
std := make([]apps.DaemonSet, len(cells))
for i := range std {
std[i] = extensions.DaemonSet(cells[i].(DaemonSetCell))
std[i] = apps.DaemonSet(cells[i].(DaemonSetCell))
}
return std
}
......@@ -17,17 +17,17 @@ package daemonset
import (
"testing"
apps "k8s.io/api/apps/v1beta2"
api "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/kubernetes/fake"
)
func CreateDaemonSet(name, namespace string, labelSelector map[string]string) extensions.DaemonSet {
return extensions.DaemonSet{
func CreateDaemonSet(name, namespace string, labelSelector map[string]string) apps.DaemonSet {
return apps.DaemonSet{
ObjectMeta: metaV1.ObjectMeta{Name: name, Namespace: namespace, Labels: labelSelector},
Spec: extensions.DaemonSetSpec{
Spec: apps.DaemonSetSpec{
Selector: &metaV1.LabelSelector{MatchLabels: labelSelector},
},
}
......@@ -47,14 +47,14 @@ var TestLabel = map[string]string{"app": "test"}
func TestGetServicesForDeletionforDS(t *testing.T) {
cases := []struct {
labelSelector labels.Selector
DaemonSetList *extensions.DaemonSetList
DaemonSetList *apps.DaemonSetList
expected *api.ServiceList
expectedActions []string
}{
{
labels.SelectorFromSet(TestLabel),
&extensions.DaemonSetList{
Items: []extensions.DaemonSet{
&apps.DaemonSetList{
Items: []apps.DaemonSet{
CreateDaemonSet("ds-1", TestNamespace, TestLabel),
},
},
......@@ -67,8 +67,8 @@ func TestGetServicesForDeletionforDS(t *testing.T) {
},
{
labels.SelectorFromSet(TestLabel),
&extensions.DaemonSetList{
Items: []extensions.DaemonSet{
&apps.DaemonSetList{
Items: []apps.DaemonSet{
CreateDaemonSet("ds-1", TestNamespace, TestLabel),
CreateDaemonSet("ds-2", TestNamespace, TestLabel),
},
......@@ -82,7 +82,7 @@ func TestGetServicesForDeletionforDS(t *testing.T) {
},
{
labels.SelectorFromSet(TestLabel),
&extensions.DaemonSetList{},
&apps.DaemonSetList{},
&api.ServiceList{
Items: []api.Service{
CreateService("svc-1", TestNamespace, TestLabel),
......
......@@ -68,7 +68,7 @@ func GetDaemonSetDetail(client k8sClient.Interface, metricClient metricapi.Metri
namespace, name string) (*DaemonSetDetail, error) {
log.Printf("Getting details of %s daemon set in %s namespace", name, namespace)
daemonSet, err := client.ExtensionsV1beta1().DaemonSets(namespace).Get(name, metaV1.GetOptions{})
daemonSet, err := client.AppsV1beta2().DaemonSets(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......
......@@ -21,8 +21,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/client-go/kubernetes"
)
......@@ -94,7 +94,7 @@ func GetDaemonSetListFromChannels(channels *common.ResourceChannels, dsQuery *da
return result, nil
}
func toDaemonSetList(daemonSets []extensions.DaemonSet, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
func toDaemonSetList(daemonSets []apps.DaemonSet, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
dsQuery *dataselect.DataSelectQuery, metricClient metricapi.MetricClient) *DaemonSetList {
daemonSetList := &DaemonSetList{
......
......@@ -22,8 +22,8 @@ import (
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
......@@ -55,7 +55,7 @@ func TestToDaemonSetList(t *testing.T) {
}
cases := []struct {
daemonSets []extensions.DaemonSet
daemonSets []apps.DaemonSet
services []v1.Service
pods []v1.Pod
nodes []v1.Node
......@@ -69,14 +69,14 @@ func TestToDaemonSetList(t *testing.T) {
DaemonSets: []DaemonSet{},
CumulativeMetrics: make([]metricapi.Metric, 0)},
}, {
[]extensions.DaemonSet{
[]apps.DaemonSet{
{
ObjectMeta: metaV1.ObjectMeta{
Name: "my-app-1",
Namespace: "namespace-1",
UID: "uid-1",
},
Spec: extensions.DaemonSetSpec{
Spec: apps.DaemonSetSpec{
Selector: &metaV1.LabelSelector{
MatchLabels: map[string]string{"app": "my-name-1"},
},
......@@ -85,7 +85,7 @@ func TestToDaemonSetList(t *testing.T) {
InitContainers: []v1.Container{{Image: "my-init-container-image-1"}}},
},
},
Status: extensions.DaemonSetStatus{
Status: apps.DaemonSetStatus{
DesiredNumberScheduled: desired,
},
},
......@@ -94,7 +94,7 @@ func TestToDaemonSetList(t *testing.T) {
Name: "my-app-2",
Namespace: "namespace-2",
},
Spec: extensions.DaemonSetSpec{
Spec: apps.DaemonSetSpec{
Selector: &metaV1.LabelSelector{
MatchLabels: map[string]string{"app": "my-name-2", "ver": "2"},
},
......@@ -103,7 +103,7 @@ func TestToDaemonSetList(t *testing.T) {
InitContainers: []v1.Container{{Image: "my-init-container-image-2"}}},
},
},
Status: extensions.DaemonSetStatus{
Status: apps.DaemonSetStatus{
DesiredNumberScheduled: desired,
},
},
......
......@@ -23,8 +23,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
apps "k8s.io/api/apps/v1beta2"
api "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sClient "k8s.io/client-go/kubernetes"
)
......@@ -51,7 +51,7 @@ func GetDaemonSetPods(client k8sClient.Interface, metricClient metricapi.MetricC
// Returns array of api pods targeting daemon set with given name.
func getRawDaemonSetPods(client k8sClient.Interface, daemonSetName, namespace string) ([]api.Pod, error) {
daemonSet, err := client.ExtensionsV1beta1().DaemonSets(namespace).Get(daemonSetName, metaV1.GetOptions{})
daemonSet, err := client.AppsV1beta2().DaemonSets(namespace).Get(daemonSetName, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......@@ -70,7 +70,7 @@ func getRawDaemonSetPods(client k8sClient.Interface, daemonSetName, namespace st
}
// Returns simple info about pods(running, desired, failing, etc.) related to given daemon set.
func getDaemonSetPodInfo(client k8sClient.Interface, daemonSet *extensions.DaemonSet) (
func getDaemonSetPodInfo(client k8sClient.Interface, daemonSet *apps.DaemonSet) (
*common.PodInfo, error) {
pods, err := getRawDaemonSetPods(client, daemonSet.Name, daemonSet.Namespace)
......
......@@ -28,7 +28,7 @@ import (
func GetDaemonSetServices(client client.Interface, dsQuery *dataselect.DataSelectQuery,
namespace, name string) (*service.ServiceList, error) {
daemonSet, err := client.ExtensionsV1beta1().DaemonSets(namespace).Get(name, metaV1.GetOptions{})
daemonSet, err := client.AppsV1beta2().DaemonSets(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......
......@@ -18,12 +18,12 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
)
// The code below allows to perform complex data section on []extensions.Deployment
// The code below allows to perform complex data section on Deployment
type DeploymentCell extensions.Deployment
type DeploymentCell apps.Deployment
func (self DeploymentCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue {
switch name {
......@@ -49,7 +49,7 @@ func (self DeploymentCell) GetResourceSelector() *metricapi.ResourceSelector {
}
}
func toCells(std []extensions.Deployment) []dataselect.DataCell {
func toCells(std []apps.Deployment) []dataselect.DataCell {
cells := make([]dataselect.DataCell, len(std))
for i := range std {
cells[i] = DeploymentCell(std[i])
......@@ -57,10 +57,10 @@ func toCells(std []extensions.Deployment) []dataselect.DataCell {
return cells
}
func fromCells(cells []dataselect.DataCell) []extensions.Deployment {
std := make([]extensions.Deployment, len(cells))
func fromCells(cells []dataselect.DataCell) []apps.Deployment {
std := make([]apps.Deployment, len(cells))
for i := range std {
std[i] = extensions.Deployment(cells[i].(DeploymentCell))
std[i] = apps.Deployment(cells[i].(DeploymentCell))
}
return std
}
......@@ -21,8 +21,8 @@ import (
"strings"
"github.com/kubernetes/dashboard/src/app/backend/errors"
apps "k8s.io/api/apps/v1beta2"
api "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/resource"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
......@@ -208,14 +208,21 @@ func DeployApp(spec *AppDeploymentSpec, client client.Interface) error {
Spec: podSpec,
}
deployment := &extensions.Deployment{
deployment := &apps.Deployment{
ObjectMeta: objectMeta,
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Replicas: &spec.Replicas,
Template: podTemplate,
Selector: &metaV1.LabelSelector{
// Quoting from https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#selector:
// In API version apps/v1beta2, .spec.selector and .metadata.labels no longer default to
// .spec.template.metadata.labels if not set. So they must be set explicitly.
// Also note that .spec.selector is immutable after creation of the Deployment in apps/v1beta2.
MatchLabels: labels,
},
},
}
_, err := client.ExtensionsV1beta1().Deployments(spec.Namespace).Create(deployment)
_, err := client.AppsV1beta2().Deployments(spec.Namespace).Create(deployment)
if err != nil {
// TODO(bryk): Roll back created resources in case of error.
......
......@@ -19,8 +19,8 @@ import (
"regexp"
"testing"
apps "k8s.io/api/apps/v1beta2"
api "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/resource"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
......@@ -36,13 +36,16 @@ func TestDeployApp(t *testing.T) {
RunAsPrivileged: true,
}
expected := &extensions.Deployment{
expected := &apps.Deployment{
ObjectMeta: metaV1.ObjectMeta{
Name: "foo-name",
Labels: map[string]string{},
Annotations: map[string]string{},
},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Selector: &metaV1.LabelSelector{
MatchLabels: map[string]string{},
},
Replicas: &replicas,
Template: api.PodTemplateSpec{
ObjectMeta: metaV1.ObjectMeta{
......@@ -78,7 +81,7 @@ func TestDeployApp(t *testing.T) {
t.Errorf("Expected namespace to be %#v but go %#v", namespace, createAction.GetNamespace())
}
deployment := createAction.GetObject().(*extensions.Deployment)
deployment := createAction.GetObject().(*apps.Deployment)
if !reflect.DeepEqual(deployment, expected) {
t.Errorf("Expected replication controller \n%#v\n to be created but got \n%#v\n",
expected, deployment)
......@@ -99,7 +102,7 @@ func TestDeployAppContainerCommands(t *testing.T) {
DeployApp(spec, testClient)
createAction := testClient.Actions()[0].(core.CreateActionImpl)
rc := createAction.GetObject().(*extensions.Deployment)
rc := createAction.GetObject().(*apps.Deployment)
container := rc.Spec.Template.Spec.Containers[0]
if container.Command[0] != command {
t.Errorf("Expected command to be %#v but got %#v",
......@@ -124,7 +127,7 @@ func TestDeployShouldPopulateEnvVars(t *testing.T) {
createAction := testClient.Actions()[0].(core.CreateActionImpl)
rc := createAction.GetObject().(*extensions.Deployment)
rc := createAction.GetObject().(*apps.Deployment)
container := rc.Spec.Template.Spec.Containers[0]
if !reflect.DeepEqual(container.Env, []api.EnvVar{{Name: "foo", Value: "bar"}}) {
t.Errorf("Expected environment variables to be %#v but got %#v",
......@@ -166,7 +169,7 @@ func TestDeployWithResourceRequirements(t *testing.T) {
createAction := testClient.Actions()[0].(core.CreateActionImpl)
rc := createAction.GetObject().(*extensions.Deployment)
rc := createAction.GetObject().(*apps.Deployment)
container := rc.Spec.Template.Spec.Containers[0]
if !reflect.DeepEqual(container.Resources, expectedResources) {
t.Errorf("Expected resource requirements to be %#v but got %#v",
......
......@@ -26,7 +26,7 @@ import (
hpa "github.com/kubernetes/dashboard/src/app/backend/resource/horizontalpodautoscaler"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
"github.com/kubernetes/dashboard/src/app/backend/resource/replicaset"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
client "k8s.io/client-go/kubernetes"
......@@ -69,7 +69,7 @@ type DeploymentDetail struct {
// The deployment strategy to use to replace existing pods with new ones.
// Valid options: Recreate, RollingUpdate
Strategy extensions.DeploymentStrategyType `json:"strategy"`
Strategy apps.DeploymentStrategyType `json:"strategy"`
// Min ready seconds
MinReadySeconds int32 `json:"minReadySeconds"`
......@@ -102,7 +102,7 @@ func GetDeploymentDetail(client client.Interface, metricClient metricapi.MetricC
log.Printf("Getting details of %s deployment in %s namespace", deploymentName, namespace)
deployment, err := client.ExtensionsV1beta1().Deployments(namespace).Get(deploymentName, metaV1.GetOptions{})
deployment, err := client.AppsV1beta2().Deployments(namespace).Get(deploymentName, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......@@ -158,7 +158,7 @@ func GetDeploymentDetail(client client.Interface, metricClient metricapi.MetricC
return nil, criticalError
}
rawRepSets := make([]*extensions.ReplicaSet, 0)
rawRepSets := make([]*apps.ReplicaSet, 0)
for i := range rawRs.Items {
rawRepSets = append(rawRepSets, &rawRs.Items[i])
}
......@@ -210,7 +210,7 @@ func GetDeploymentDetail(client client.Interface, metricClient metricapi.MetricC
}
func GetStatusInfo(deploymentStatus *extensions.DeploymentStatus) StatusInfo {
func GetStatusInfo(deploymentStatus *apps.DeploymentStatus) StatusInfo {
return StatusInfo{
Replicas: deploymentStatus.Replicas,
Updated: deploymentStatus.UpdatedReplicas,
......
......@@ -25,29 +25,29 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/horizontalpodautoscaler"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
"github.com/kubernetes/dashboard/src/app/backend/resource/replicaset"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes/fake"
)
func createDeployment(name, namespace, podTemplateName string, replicas int32, podLabel,
labelSelector map[string]string) *extensions.Deployment {
labelSelector map[string]string) *apps.Deployment {
maxSurge := intstr.FromInt(1)
maxUnavailable := intstr.FromString("25%")
return &extensions.Deployment{
return &apps.Deployment{
ObjectMeta: metaV1.ObjectMeta{
Name: name, Namespace: namespace, Labels: labelSelector,
},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Selector: &metaV1.LabelSelector{MatchLabels: labelSelector},
Replicas: &replicas,
MinReadySeconds: 5,
Strategy: extensions.DeploymentStrategy{
Type: extensions.RollingUpdateDeploymentStrategyType,
RollingUpdate: &extensions.RollingUpdateDeployment{
Strategy: apps.DeploymentStrategy{
Type: apps.RollingUpdateDeploymentStrategyType,
RollingUpdate: &apps.RollingUpdateDeployment{
MaxSurge: &maxSurge,
MaxUnavailable: &maxUnavailable,
},
......@@ -55,19 +55,19 @@ func createDeployment(name, namespace, podTemplateName string, replicas int32, p
Template: v1.PodTemplateSpec{
ObjectMeta: metaV1.ObjectMeta{Name: podTemplateName, Labels: podLabel}},
},
Status: extensions.DeploymentStatus{
Status: apps.DeploymentStatus{
Replicas: replicas, UpdatedReplicas: 2, AvailableReplicas: 3, UnavailableReplicas: 1,
},
}
}
func createReplicaSet(name, namespace string, replicas int32, labelSelector map[string]string,
podTemplateSpec v1.PodTemplateSpec) extensions.ReplicaSet {
return extensions.ReplicaSet{
podTemplateSpec v1.PodTemplateSpec) apps.ReplicaSet {
return apps.ReplicaSet{
ObjectMeta: metaV1.ObjectMeta{
Name: name, Namespace: namespace, Labels: labelSelector,
},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &replicas,
Template: podTemplateSpec,
},
......@@ -87,8 +87,8 @@ func TestGetDeploymentDetail(t *testing.T) {
newReplicaSet := createReplicaSet("rs-1", "ns-1", replicas, map[string]string{"foo": "bar"},
podTemplateSpec)
replicaSetList := &extensions.ReplicaSetList{
Items: []extensions.ReplicaSet{
replicaSetList := &apps.ReplicaSetList{
Items: []apps.ReplicaSet{
newReplicaSet,
createReplicaSet("rs-2", "ns-1", replicas, map[string]string{"foo": "bar"},
podTemplateSpec),
......@@ -101,7 +101,7 @@ func TestGetDeploymentDetail(t *testing.T) {
cases := []struct {
namespace, name string
expectedActions []string
deployment *extensions.Deployment
deployment *apps.Deployment
expected *DeploymentDetail
}{
{
......
......@@ -23,8 +23,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
client "k8s.io/client-go/kubernetes"
)
......@@ -108,7 +108,7 @@ func GetDeploymentListFromChannels(channels *common.ResourceChannels, dsQuery *d
return toDeploymentList(deployments.Items, pods.Items, events.Items, rs.Items, nonCriticalErrors, dsQuery, metricClient), nil
}
func toDeploymentList(deployments []extensions.Deployment, pods []v1.Pod, events []v1.Event, rs []extensions.ReplicaSet,
func toDeploymentList(deployments []apps.Deployment, pods []v1.Pod, events []v1.Event, rs []apps.ReplicaSet,
nonCriticalErrors []error, dsQuery *dataselect.DataSelectQuery, metricClient metricapi.MetricClient) *DeploymentList {
deploymentList := &DeploymentList{
......
......@@ -23,8 +23,8 @@ import (
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta2"
v1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
......@@ -35,14 +35,14 @@ func getReplicasPointer(replicas int32) *int32 {
func TestGetDeploymentListFromChannels(t *testing.T) {
cases := []struct {
k8sDeployment extensions.DeploymentList
k8sDeployment apps.DeploymentList
k8sDeploymentError error
pods *v1.PodList
expected *DeploymentList
expectedError error
}{
{
extensions.DeploymentList{},
apps.DeploymentList{},
nil,
&v1.PodList{},
&DeploymentList{
......@@ -54,47 +54,47 @@ func TestGetDeploymentListFromChannels(t *testing.T) {
nil,
},
{
extensions.DeploymentList{},
apps.DeploymentList{},
errors.New("MyCustomError"),
&v1.PodList{},
nil,
errors.New("MyCustomError"),
},
{
extensions.DeploymentList{},
apps.DeploymentList{},
&k8serrors.StatusError{},
&v1.PodList{},
nil,
&k8serrors.StatusError{},
},
{
extensions.DeploymentList{},
apps.DeploymentList{},
&k8serrors.StatusError{ErrStatus: metaV1.Status{}},
&v1.PodList{},
nil,
&k8serrors.StatusError{ErrStatus: metaV1.Status{}},
},
{
extensions.DeploymentList{},
apps.DeploymentList{},
&k8serrors.StatusError{ErrStatus: metaV1.Status{Reason: "foo-bar"}},
&v1.PodList{},
nil,
&k8serrors.StatusError{ErrStatus: metaV1.Status{Reason: "foo-bar"}},
},
{
extensions.DeploymentList{
Items: []extensions.Deployment{{
apps.DeploymentList{
Items: []apps.Deployment{{
ObjectMeta: metaV1.ObjectMeta{
Name: "rs-name",
Namespace: "rs-namespace",
Labels: map[string]string{"key": "value"},
CreationTimestamp: metaV1.Unix(111, 222),
},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Selector: &metaV1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
Replicas: getReplicasPointer(21),
},
Status: extensions.DeploymentStatus{
Status: apps.DeploymentStatus{
Replicas: 7,
},
}},
......@@ -128,7 +128,7 @@ func TestGetDeploymentListFromChannels(t *testing.T) {
for _, c := range cases {
channels := &common.ResourceChannels{
DeploymentList: common.DeploymentListChannel{
List: make(chan *extensions.DeploymentList, 1),
List: make(chan *apps.DeploymentList, 1),
Error: make(chan error, 1),
},
NodeList: common.NodeListChannel{
......@@ -148,7 +148,7 @@ func TestGetDeploymentListFromChannels(t *testing.T) {
Error: make(chan error, 1),
},
ReplicaSetList: common.ReplicaSetListChannel{
List: make(chan *extensions.ReplicaSetList, 1),
List: make(chan *apps.ReplicaSetList, 1),
Error: make(chan error, 1),
},
}
......@@ -168,7 +168,7 @@ func TestGetDeploymentListFromChannels(t *testing.T) {
channels.EventList.List <- &v1.EventList{}
channels.EventList.Error <- nil
channels.ReplicaSetList.List <- &extensions.ReplicaSetList{}
channels.ReplicaSetList.List <- &apps.ReplicaSetList{}
channels.ReplicaSetList.Error <- nil
actual, err := GetDeploymentListFromChannels(channels, dataselect.NoDataSelect, nil)
......
......@@ -20,7 +20,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/replicaset"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
client "k8s.io/client-go/kubernetes"
)
......@@ -34,7 +34,7 @@ func GetDeploymentOldReplicaSets(client client.Interface, dsQuery *dataselect.Da
ListMeta: api.ListMeta{TotalItems: 0},
}
deployment, err := client.ExtensionsV1beta1().Deployments(namespace).Get(deploymentName, metaV1.GetOptions{})
deployment, err := client.AppsV1beta2().Deployments(namespace).Get(deploymentName, metaV1.GetOptions{})
if err != nil {
return oldReplicaSetList, err
}
......@@ -71,7 +71,7 @@ func GetDeploymentOldReplicaSets(client client.Interface, dsQuery *dataselect.Da
return oldReplicaSetList, criticalError
}
rawRepSets := make([]*extensions.ReplicaSet, 0)
rawRepSets := make([]*apps.ReplicaSet, 0)
for i := range rawRs.Items {
rawRepSets = append(rawRepSets, &rawRs.Items[i])
}
......@@ -80,7 +80,7 @@ func GetDeploymentOldReplicaSets(client client.Interface, dsQuery *dataselect.Da
return oldReplicaSetList, err
}
oldReplicaSets := make([]extensions.ReplicaSet, len(oldRs))
oldReplicaSets := make([]apps.ReplicaSet, len(oldRs))
for i, replicaSet := range oldRs {
oldReplicaSets[i] = *replicaSet
}
......
......@@ -29,7 +29,7 @@ import (
func GetDeploymentPods(client client.Interface, metricClient metricapi.MetricClient,
dsQuery *dataselect.DataSelectQuery, namespace, deploymentName string) (*pod.PodList, error) {
deployment, err := client.ExtensionsV1beta1().Deployments(namespace).Get(deploymentName, metaV1.GetOptions{})
deployment, err := client.AppsV1beta2().Deployments(namespace).Get(deploymentName, metaV1.GetOptions{})
if err != nil {
return pod.EmptyPodList, err
}
......
......@@ -16,15 +16,15 @@ package deployment
import (
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
)
// Methods below are taken from kubernetes repo:
// https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/deployment/util/deployment_util.go
// FindNewReplicaSet returns the new RS this given deployment targets (the one with the same pod template).
func FindNewReplicaSet(deployment *extensions.Deployment, rsList []*extensions.ReplicaSet) (*extensions.ReplicaSet, error) {
func FindNewReplicaSet(deployment *apps.Deployment, rsList []*apps.ReplicaSet) (*apps.ReplicaSet, error) {
newRSTemplate := GetNewReplicaSetTemplate(deployment)
for i := range rsList {
if common.EqualIgnoreHash(rsList[i].Spec.Template, newRSTemplate) {
......@@ -37,10 +37,12 @@ func FindNewReplicaSet(deployment *extensions.Deployment, rsList []*extensions.R
}
// FindOldReplicaSets returns the old replica sets targeted by the given Deployment, with the given slice of RSes.
// Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica sets include all old replica sets.
func FindOldReplicaSets(deployment *extensions.Deployment, rsList []*extensions.ReplicaSet) ([]*extensions.ReplicaSet, []*extensions.ReplicaSet, error) {
var requiredRSs []*extensions.ReplicaSet
var allRSs []*extensions.ReplicaSet
// Note that the first set of old replica sets doesn't include the ones with no pods, and the second set of old replica
// sets include all old replica sets.
func FindOldReplicaSets(deployment *apps.Deployment, rsList []*apps.ReplicaSet) ([]*apps.ReplicaSet,
[]*apps.ReplicaSet, error) {
var requiredRSs []*apps.ReplicaSet
var allRSs []*apps.ReplicaSet
newRS, err := FindNewReplicaSet(deployment, rsList)
if err != nil {
return nil, nil, err
......@@ -60,7 +62,7 @@ func FindOldReplicaSets(deployment *extensions.Deployment, rsList []*extensions.
// GetNewReplicaSetTemplate returns the desired PodTemplateSpec for the new ReplicaSet corresponding to the given ReplicaSet.
// Callers of this helper need to set the DefaultDeploymentUniqueLabelKey k/v pair.
func GetNewReplicaSetTemplate(deployment *extensions.Deployment) v1.PodTemplateSpec {
func GetNewReplicaSetTemplate(deployment *apps.Deployment) v1.PodTemplateSpec {
// newRS will have the same template as in deployment spec.
return v1.PodTemplateSpec{
ObjectMeta: deployment.Spec.Template.ObjectMeta,
......
......@@ -21,8 +21,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
......@@ -121,7 +121,7 @@ func TestGetResourceEvents(t *testing.T) {
namespace, name string
eventList *v1.EventList
podList *v1.PodList
replicaSet *extensions.ReplicaSet
replicaSet *apps.ReplicaSet
expectedActions []string
expected *common.EventList
}{
......@@ -133,10 +133,10 @@ func TestGetResourceEvents(t *testing.T) {
}},
&v1.PodList{Items: []v1.Pod{{ObjectMeta: metaV1.ObjectMeta{
Name: "pod-1", Namespace: "ns-1"}}}},
&extensions.ReplicaSet{
&apps.ReplicaSet{
ObjectMeta: metaV1.ObjectMeta{
Name: "rs-1", Namespace: "ns-1", Labels: labelSelector},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Selector: &metaV1.LabelSelector{
MatchLabels: labelSelector,
}}},
......
......@@ -30,7 +30,7 @@ import (
func GetStorageClassPersistentVolumes(client client.Interface, storageClassName string,
dsQuery *dataselect.DataSelectQuery) (*PersistentVolumeList, error) {
storageClass, err := client.StorageV1beta1().StorageClasses().Get(storageClassName, metaV1.GetOptions{})
storageClass, err := client.StorageV1().StorageClasses().Get(storageClassName, metaV1.GetOptions{})
if err != nil {
return nil, err
......
......@@ -22,7 +22,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1beta1"
storage "k8s.io/api/storage/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
......
......@@ -20,7 +20,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
rbac "k8s.io/api/rbac/v1beta1"
rbac "k8s.io/api/rbac/v1"
"k8s.io/client-go/kubernetes"
)
......
......@@ -20,7 +20,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
rbac "k8s.io/api/rbac/v1beta1"
rbac "k8s.io/api/rbac/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
......
......@@ -21,7 +21,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/errors"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
rbac "k8s.io/api/rbac/v1beta1"
rbac "k8s.io/api/rbac/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
......
......@@ -20,7 +20,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
rbac "k8s.io/api/rbac/v1beta1"
rbac "k8s.io/api/rbac/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
......
......@@ -19,7 +19,7 @@ import (
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
)
// ReplicaSet is a presentation layer view of Kubernetes Replica Set resource. This means
......@@ -40,7 +40,7 @@ type ReplicaSet struct {
}
// ToReplicaSet converts replica set api object to replica set model object.
func ToReplicaSet(replicaSet *extensions.ReplicaSet, podInfo *common.PodInfo) ReplicaSet {
func ToReplicaSet(replicaSet *apps.ReplicaSet, podInfo *common.PodInfo) ReplicaSet {
return ReplicaSet{
ObjectMeta: api.NewObjectMeta(replicaSet.ObjectMeta),
TypeMeta: api.NewTypeMeta(api.ResourceKindReplicaSet),
......@@ -50,9 +50,9 @@ func ToReplicaSet(replicaSet *extensions.ReplicaSet, podInfo *common.PodInfo) Re
}
}
// The code below allows to perform complex data section on []extensions.ReplicaSet
// The code below allows to perform complex data section on Replica Set
type ReplicaSetCell extensions.ReplicaSet
type ReplicaSetCell apps.ReplicaSet
func (self ReplicaSetCell) GetProperty(name dataselect.PropertyName) dataselect.ComparableValue {
switch name {
......@@ -77,7 +77,7 @@ func (self ReplicaSetCell) GetResourceSelector() *metricapi.ResourceSelector {
}
}
func ToCells(std []extensions.ReplicaSet) []dataselect.DataCell {
func ToCells(std []apps.ReplicaSet) []dataselect.DataCell {
cells := make([]dataselect.DataCell, len(std))
for i := range std {
cells[i] = ReplicaSetCell(std[i])
......@@ -85,10 +85,10 @@ func ToCells(std []extensions.ReplicaSet) []dataselect.DataCell {
return cells
}
func FromCells(cells []dataselect.DataCell) []extensions.ReplicaSet {
std := make([]extensions.ReplicaSet, len(cells))
func FromCells(cells []dataselect.DataCell) []apps.ReplicaSet {
std := make([]apps.ReplicaSet, len(cells))
for i := range std {
std[i] = extensions.ReplicaSet(cells[i].(ReplicaSetCell))
std[i] = apps.ReplicaSet(cells[i].(ReplicaSetCell))
}
return std
}
......@@ -20,18 +20,18 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestToReplicaSet(t *testing.T) {
cases := []struct {
replicaSet *extensions.ReplicaSet
replicaSet *apps.ReplicaSet
podInfo *common.PodInfo
expected ReplicaSet
}{
{
&extensions.ReplicaSet{ObjectMeta: metaV1.ObjectMeta{Name: "replica-set"}},
&apps.ReplicaSet{ObjectMeta: metaV1.ObjectMeta{Name: "replica-set"}},
&common.PodInfo{Running: 1, Warnings: []common.Event{}},
ReplicaSet{
ObjectMeta: api.ObjectMeta{Name: "replica-set"},
......
......@@ -26,7 +26,7 @@ import (
hpa "github.com/kubernetes/dashboard/src/app/backend/resource/horizontalpodautoscaler"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
resourceService "github.com/kubernetes/dashboard/src/app/backend/resource/service"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sClient "k8s.io/client-go/kubernetes"
)
......@@ -71,7 +71,7 @@ func GetReplicaSetDetail(client k8sClient.Interface, metricClient metricapi.Metr
namespace, name string) (*ReplicaSetDetail, error) {
log.Printf("Getting details of %s service in %s namespace", name, namespace)
rs, err := client.ExtensionsV1beta1().ReplicaSets(namespace).Get(name, metaV1.GetOptions{})
rs, err := client.AppsV1beta2().ReplicaSets(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......@@ -110,7 +110,7 @@ func GetReplicaSetDetail(client k8sClient.Interface, metricClient metricapi.Metr
return &rsDetail, nil
}
func toReplicaSetDetail(replicaSet *extensions.ReplicaSet, eventList common.EventList, podList pod.PodList,
func toReplicaSetDetail(replicaSet *apps.ReplicaSet, eventList common.EventList, podList pod.PodList,
podInfo common.PodInfo, serviceList resourceService.ServiceList,
hpas hpa.HorizontalPodAutoscalerList, nonCriticalErrors []error) ReplicaSetDetail {
......
......@@ -25,7 +25,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/horizontalpodautoscaler"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
"github.com/kubernetes/dashboard/src/app/backend/resource/service"
extensions "k8s.io/api/extensions/v1beta1"
apps "k8s.io/api/apps/v1beta2"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
......@@ -35,16 +35,16 @@ func TestGetReplicaSetDetail(t *testing.T) {
cases := []struct {
namespace, name string
expectedActions []string
replicaSet *extensions.ReplicaSet
replicaSet *apps.ReplicaSet
expected *ReplicaSetDetail
}{
{
"ns-1", "rs-1",
[]string{"get", "list", "get", "list", "list", "list", "get", "list", "list"},
&extensions.ReplicaSet{
&apps.ReplicaSet{
ObjectMeta: metaV1.ObjectMeta{Name: "rs-1", Namespace: "ns-1",
Labels: map[string]string{"app": "test"}},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &replicas,
Selector: &metaV1.LabelSelector{
MatchLabels: map[string]string{"app": "test"},
......@@ -110,7 +110,7 @@ func TestGetReplicaSetDetail(t *testing.T) {
func TestToReplicaSetDetail(t *testing.T) {
cases := []struct {
replicaSet *extensions.ReplicaSet
replicaSet *apps.ReplicaSet
eventList common.EventList
podList pod.PodList
podInfo common.PodInfo
......@@ -119,7 +119,7 @@ func TestToReplicaSetDetail(t *testing.T) {
expected ReplicaSetDetail
}{
{
&extensions.ReplicaSet{},
&apps.ReplicaSet{},
common.EventList{},
pod.PodList{},
common.PodInfo{},
......@@ -130,7 +130,7 @@ func TestToReplicaSetDetail(t *testing.T) {
Errors: []error{},
},
}, {
&extensions.ReplicaSet{ObjectMeta: metaV1.ObjectMeta{Name: "replica-set"}},
&apps.ReplicaSet{ObjectMeta: metaV1.ObjectMeta{Name: "replica-set"}},
common.EventList{Events: []common.Event{{Message: "event-msg"}}},
pod.PodList{Pods: []pod.Pod{{ObjectMeta: api.ObjectMeta{Name: "pod-1"}}}},
common.PodInfo{},
......
......@@ -23,8 +23,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
client "k8s.io/client-go/kubernetes"
)
......@@ -85,7 +85,7 @@ func GetReplicaSetListFromChannels(channels *common.ResourceChannels,
// ToReplicaSetList creates paginated list of Replica Set model
// objects based on Kubernetes Replica Set objects array and related resources arrays.
func ToReplicaSetList(replicaSets []extensions.ReplicaSet, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
func ToReplicaSetList(replicaSets []apps.ReplicaSet, pods []v1.Pod, events []v1.Event, nonCriticalErrors []error,
dsQuery *dataselect.DataSelectQuery, metricClient metricapi.MetricClient) *ReplicaSetList {
replicaSetList := &ReplicaSetList{
......
......@@ -23,8 +23,8 @@ import (
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
......@@ -34,14 +34,14 @@ func TestGetReplicaSetListFromChannels(t *testing.T) {
replicas := int32(21)
controller := true
cases := []struct {
k8sRs extensions.ReplicaSetList
k8sRs apps.ReplicaSetList
k8sRsError error
pods *v1.PodList
expected *ReplicaSetList
expectedError error
}{
{
extensions.ReplicaSetList{},
apps.ReplicaSetList{},
nil,
&v1.PodList{},
&ReplicaSetList{
......@@ -53,36 +53,36 @@ func TestGetReplicaSetListFromChannels(t *testing.T) {
nil,
},
{
extensions.ReplicaSetList{},
apps.ReplicaSetList{},
errors.New("MyCustomError"),
&v1.PodList{},
nil,
errors.New("MyCustomError"),
},
{
extensions.ReplicaSetList{},
apps.ReplicaSetList{},
&k8serrors.StatusError{},
&v1.PodList{},
nil,
&k8serrors.StatusError{},
},
{
extensions.ReplicaSetList{},
apps.ReplicaSetList{},
&k8serrors.StatusError{ErrStatus: metaV1.Status{}},
&v1.PodList{},
nil,
&k8serrors.StatusError{ErrStatus: metaV1.Status{}},
},
{
extensions.ReplicaSetList{},
apps.ReplicaSetList{},
&k8serrors.StatusError{ErrStatus: metaV1.Status{Reason: "foo-bar"}},
&v1.PodList{},
nil,
&k8serrors.StatusError{ErrStatus: metaV1.Status{Reason: "foo-bar"}},
},
{
extensions.ReplicaSetList{
Items: []extensions.ReplicaSet{{
apps.ReplicaSetList{
Items: []apps.ReplicaSet{{
ObjectMeta: metaV1.ObjectMeta{
Name: "rs-name",
Namespace: "rs-namespace",
......@@ -90,11 +90,11 @@ func TestGetReplicaSetListFromChannels(t *testing.T) {
UID: "uid",
CreationTimestamp: metaV1.Unix(111, 222),
},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Selector: &metaV1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
Replicas: &replicas,
},
Status: extensions.ReplicaSetStatus{
Status: apps.ReplicaSetStatus{
Replicas: 7,
},
}},
......@@ -157,7 +157,7 @@ func TestGetReplicaSetListFromChannels(t *testing.T) {
for _, c := range cases {
channels := &common.ResourceChannels{
ReplicaSetList: common.ReplicaSetListChannel{
List: make(chan *extensions.ReplicaSetList, 1),
List: make(chan *apps.ReplicaSetList, 1),
Error: make(chan error, 1),
},
NodeList: common.NodeListChannel{
......@@ -206,16 +206,16 @@ func TestGetReplicaSetListFromChannels(t *testing.T) {
func TestCreateReplicaSetList(t *testing.T) {
replicas := int32(0)
cases := []struct {
replicaSets []extensions.ReplicaSet
replicaSets []apps.ReplicaSet
pods []v1.Pod
events []v1.Event
expected *ReplicaSetList
}{
{
[]extensions.ReplicaSet{
[]apps.ReplicaSet{
{
ObjectMeta: metaV1.ObjectMeta{Name: "replica-set", Namespace: "ns-1"},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &replicas,
Selector: &metaV1.LabelSelector{
MatchLabels: map[string]string{"key": "value"},
......@@ -254,19 +254,19 @@ func TestCreateReplicaSetList(t *testing.T) {
func TestGetReplicaSetList(t *testing.T) {
replicas := int32(21)
cases := []struct {
rsList *extensions.ReplicaSetList
rsList *apps.ReplicaSetList
expectedActions []string
expected *ReplicaSetList
}{
{
rsList: &extensions.ReplicaSetList{
Items: []extensions.ReplicaSet{
rsList: &apps.ReplicaSetList{
Items: []apps.ReplicaSet{
{
ObjectMeta: metaV1.ObjectMeta{
Name: "rs-1",
Labels: map[string]string{},
},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &replicas,
},
},
......
......@@ -23,8 +23,8 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
......@@ -52,7 +52,7 @@ func GetReplicaSetPods(client k8sClient.Interface, metricClient metricapi.Metric
}
func getRawReplicaSetPods(client k8sClient.Interface, petSetName, namespace string) ([]v1.Pod, error) {
rs, err := client.ExtensionsV1beta1().ReplicaSets(namespace).Get(petSetName, metaV1.GetOptions{})
rs, err := client.AppsV1beta2().ReplicaSets(namespace).Get(petSetName, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......@@ -69,7 +69,7 @@ func getRawReplicaSetPods(client k8sClient.Interface, petSetName, namespace stri
return common.FilterPodsByControllerRef(rs, podList.Items), nil
}
func getReplicaSetPodInfo(client k8sClient.Interface, replicaSet *extensions.ReplicaSet) (*common.PodInfo, error) {
func getReplicaSetPodInfo(client k8sClient.Interface, replicaSet *apps.ReplicaSet) (*common.PodInfo, error) {
labelSelector := labels.SelectorFromSet(replicaSet.Spec.Selector.MatchLabels)
channels := &common.ResourceChannels{
PodList: common.GetPodListChannelWithOptions(client, common.NewSameNamespaceQuery(replicaSet.Namespace),
......
......@@ -27,7 +27,7 @@ import (
func GetReplicaSetServices(client client.Interface, dsQuery *dataselect.DataSelectQuery,
namespace, name string) (*service.ServiceList, error) {
replicaSet, err := client.ExtensionsV1beta1().ReplicaSets(namespace).Get(name, metaV1.GetOptions{})
replicaSet, err := client.AppsV1beta2().ReplicaSets(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......
......@@ -18,7 +18,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
)
// The code below allows to perform complex data section on []apps.StatefulSet
......
......@@ -24,7 +24,7 @@ import (
ds "github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
)
......@@ -49,7 +49,7 @@ func GetStatefulSetDetail(client kubernetes.Interface, metricClient metricapi.Me
name string) (*StatefulSetDetail, error) {
log.Printf("Getting details of %s statefulset in %s namespace", name, namespace)
ss, err := client.AppsV1beta1().StatefulSets(namespace).Get(name, metaV1.GetOptions{})
ss, err := client.AppsV1beta2().StatefulSets(namespace).Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......
......@@ -23,7 +23,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
"k8s.io/client-go/kubernetes"
)
......
......@@ -23,7 +23,7 @@ import (
metricapi "github.com/kubernetes/dashboard/src/app/backend/integration/metric/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
......
......@@ -23,7 +23,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/event"
"github.com/kubernetes/dashboard/src/app/backend/resource/pod"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
"k8s.io/api/core/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
......
......@@ -18,7 +18,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
"github.com/kubernetes/dashboard/src/app/backend/resource/persistentvolume"
storage "k8s.io/api/storage/v1beta1"
storage "k8s.io/api/storage/v1"
)
func toStorageClass(storageClass *storage.StorageClass) StorageClass {
......
......@@ -20,7 +20,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/persistentvolume"
storage "k8s.io/api/storage/v1beta1"
storage "k8s.io/api/storage/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
......
......@@ -58,7 +58,7 @@ type StorageClassDetail struct {
func GetStorageClass(client kubernetes.Interface, name string) (*StorageClassDetail, error) {
log.Printf("Getting details of %s storage class", name)
storage, err := client.StorageV1beta1().StorageClasses().Get(name, metaV1.GetOptions{})
storage, err := client.StorageV1().StorageClasses().Get(name, metaV1.GetOptions{})
if err != nil {
return nil, err
}
......
......@@ -21,7 +21,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/errors"
"github.com/kubernetes/dashboard/src/app/backend/resource/common"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
storage "k8s.io/api/storage/v1beta1"
storage "k8s.io/api/storage/v1"
"k8s.io/client-go/kubernetes"
)
......
......@@ -20,7 +20,7 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/api"
"github.com/kubernetes/dashboard/src/app/backend/resource/dataselect"
storage "k8s.io/api/storage/v1beta1"
storage "k8s.io/api/storage/v1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes/fake"
)
......
......@@ -30,22 +30,21 @@ import (
"github.com/kubernetes/dashboard/src/app/backend/resource/replicaset"
"github.com/kubernetes/dashboard/src/app/backend/resource/replicationcontroller"
"github.com/kubernetes/dashboard/src/app/backend/resource/statefulset"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1beta2"
batch "k8s.io/api/batch/v1"
batch2 "k8s.io/api/batch/v1beta1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metaV1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func TestGetWorkloadsFromChannels(t *testing.T) {
replicas := int32(0)
cases := []struct {
k8sRs extensions.ReplicaSetList
k8sRs apps.ReplicaSetList
k8sJobs batch.JobList
k8sCronJobs batch2.CronJobList
k8sDaemonSet extensions.DaemonSetList
k8sDeployment extensions.DeploymentList
k8sDaemonSet apps.DaemonSetList
k8sDeployment apps.DeploymentList
k8sRc v1.ReplicationControllerList
k8sPod v1.PodList
k8sStatefulSet apps.StatefulSetList
......@@ -59,11 +58,11 @@ func TestGetWorkloadsFromChannels(t *testing.T) {
statefulSet []statefulset.StatefulSet
}{
{
extensions.ReplicaSetList{},
apps.ReplicaSetList{},
batch.JobList{},
batch2.CronJobList{},
extensions.DaemonSetList{},
extensions.DeploymentList{},
apps.DaemonSetList{},
apps.DeploymentList{},
v1.ReplicationControllerList{},
v1.PodList{},
apps.StatefulSetList{},
......@@ -77,11 +76,11 @@ func TestGetWorkloadsFromChannels(t *testing.T) {
[]statefulset.StatefulSet{},
},
{
extensions.ReplicaSetList{
Items: []extensions.ReplicaSet{
apps.ReplicaSetList{
Items: []apps.ReplicaSet{
{
ObjectMeta: metaV1.ObjectMeta{Name: "rs-name"},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &replicas,
Selector: &metaV1.LabelSelector{},
},
......@@ -103,18 +102,18 @@ func TestGetWorkloadsFromChannels(t *testing.T) {
ObjectMeta: metaV1.ObjectMeta{Name: "cj-name"},
}},
},
extensions.DaemonSetList{
Items: []extensions.DaemonSet{
apps.DaemonSetList{
Items: []apps.DaemonSet{
{
ObjectMeta: metaV1.ObjectMeta{Name: "ds-name"},
Spec: extensions.DaemonSetSpec{Selector: &metaV1.LabelSelector{}},
Spec: apps.DaemonSetSpec{Selector: &metaV1.LabelSelector{}},
}},
},
extensions.DeploymentList{
Items: []extensions.Deployment{
apps.DeploymentList{
Items: []apps.Deployment{
{
ObjectMeta: metaV1.ObjectMeta{Name: "deployment-name"},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Selector: &metaV1.LabelSelector{},
Replicas: &replicas,
},
......@@ -247,7 +246,7 @@ func TestGetWorkloadsFromChannels(t *testing.T) {
channels := &common.ResourceChannels{
ReplicaSetList: common.ReplicaSetListChannel{
List: make(chan *extensions.ReplicaSetList, 2),
List: make(chan *apps.ReplicaSetList, 2),
Error: make(chan error, 2),
},
JobList: common.JobListChannel{
......@@ -263,11 +262,11 @@ func TestGetWorkloadsFromChannels(t *testing.T) {
Error: make(chan error, 1),
},
DaemonSetList: common.DaemonSetListChannel{
List: make(chan *extensions.DaemonSetList, 1),
List: make(chan *apps.DaemonSetList, 1),
Error: make(chan error, 1),
},
DeploymentList: common.DeploymentListChannel{
List: make(chan *extensions.DeploymentList, 1),
List: make(chan *apps.DeploymentList, 1),
Error: make(chan error, 1),
},
StatefulSetList: common.StatefulSetListChannel{
......
// Copyright 2017 The Kubernetes Authors.
//
// 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.
describe('Deploy view', () => {
beforeEach(() => {
browser.get('#!/deploy');
});
it('should do something',
() => {
// TODO(bryk): Write the test.
});
});
......@@ -20,9 +20,6 @@ export default class DeployFromFilePageObject {
this.deployButtonQuery = by.css('.kd-deploy-submit-button');
this.deployButton = element(this.deployButtonQuery);
this.cancelButtonQuery = by.css('.kd-deploy-cancel-button');
this.cancelButton = element(this.cancelButtonQuery);
this.inputContainerQuery = by.css('.kd-upload-file-container');
this.inputContainer = element(this.inputContainerQuery);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册