Merge pull request #70370 from liggitt/to_apps_v1

Switch client and test usage to apps/v1
pull/564/head
Kubernetes Prow Robot 2018-12-19 14:13:28 -08:00 committed by GitHub
commit 1bd7c7126c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
126 changed files with 909 additions and 616 deletions

View File

@ -125,7 +125,7 @@ func startNodeLifecycleController(ctx ControllerContext) (http.Handler, bool, er
ctx.InformerFactory.Coordination().V1beta1().Leases(),
ctx.InformerFactory.Core().V1().Pods(),
ctx.InformerFactory.Core().V1().Nodes(),
ctx.InformerFactory.Extensions().V1beta1().DaemonSets(),
ctx.InformerFactory.Apps().V1().DaemonSets(),
ctx.ClientBuilder.ClientOrDie("node-controller"),
ctx.ComponentConfig.KubeCloudShared.NodeMonitorPeriod.Duration,
ctx.ComponentConfig.NodeLifecycleController.NodeStartupGracePeriod.Duration,

View File

@ -44,9 +44,9 @@ func startDisruptionController(ctx ControllerContext) (http.Handler, bool, error
ctx.InformerFactory.Core().V1().Pods(),
ctx.InformerFactory.Policy().V1beta1().PodDisruptionBudgets(),
ctx.InformerFactory.Core().V1().ReplicationControllers(),
ctx.InformerFactory.Extensions().V1beta1().ReplicaSets(),
ctx.InformerFactory.Extensions().V1beta1().Deployments(),
ctx.InformerFactory.Apps().V1beta1().StatefulSets(),
ctx.InformerFactory.Apps().V1().ReplicaSets(),
ctx.InformerFactory.Apps().V1().Deployments(),
ctx.InformerFactory.Apps().V1().StatefulSets(),
ctx.ClientBuilder.ClientOrDie("disruption-controller"),
).Run(ctx.Stop)
return nil, true, nil

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment-resources

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx

View File

@ -1,9 +1,14 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: deployment-with-unixuserid
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:

View File

@ -1,22 +1,18 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: frontend
# these labels can be applied automatically
# from the labels in the pod template if not set
# labels:
# app: guestbook
# tier: frontend
labels:
app: guestbook
tier: frontend
spec:
# this replicas value is default
# modify it according to your case
replicas: 3
# selector can be applied automatically
# from the labels in the pod template if not set
# selector:
# matchLabels:
# app: guestbook
# tier: frontend
selector:
matchLabels:
app: guestbook
tier: frontend
template:
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: web

View File

@ -11,7 +11,7 @@ items:
port: 80
selector:
app: list-deployment-test
- apiVersion: extensions/v1beta1
- apiVersion: apps/v1
kind: Deployment
metadata:
name: list-deployment-test
@ -19,6 +19,9 @@ items:
app: list-deployment-test
spec:
replicas: 1
selector:
matchLabels:
app: list-deployment-test
template:
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
ind: Deployment
metadata:
name: nginx2-deployment
@ -6,6 +6,9 @@ metadata:
app: nginx2-deployment
spec:
replicas: 2
selector:
matchLabels:
app: nginx2
template:
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx1-deployment
@ -6,6 +6,9 @@ metadata:
app: nginx1-deployment
spec:
replicas: 2
selector:
matchLabels:
app: nginx1
template:
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx0-deployment
@ -6,6 +6,9 @@ metadata:
app: nginx0-deployment
spec:
replicas: 2
selector:
matchLabels:
app: nginx0
template:
metadata:
labels:

View File

@ -1,23 +1,20 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: redis-slave
# these labels can be applied automatically
# from the labels in the pod template if not set
# labels:
# app: redis
# role: slave
# tier: backend
labels:
app: redis
role: slave
tier: backend
spec:
# this replicas value is default
# modify it according to your case
replicas: 2
# selector can be applied automatically
# from the labels in the pod template if not set
# selector:
# app: guestbook
# role: slave
# tier: backend
selector:
matchLabels:
app: redis
role: slave
tier: backend
template:
metadata:
labels:

View File

@ -1,11 +1,16 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-deployment-retainkeys
labels:
app: nginx
spec:
strategy:
type: Recreate
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:

View File

@ -1,9 +1,14 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-deployment-retainkeys
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:

View File

@ -1,8 +1,13 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: bind
labels:
service: bind
spec:
selector:
matchLabels:
service: bind
updateStrategy:
type: RollingUpdate
rollingUpdate:

View File

@ -1,8 +1,13 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: bind
labels:
service: bind
spec:
selector:
matchLabels:
service: bind
updateStrategy:
type: RollingUpdate
rollingUpdate:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:

View File

@ -84,7 +84,7 @@ func TestValidateEvent(t *testing.T) {
Namespace: metav1.NamespaceDefault,
},
InvolvedObject: core.ObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "NoKind",
Namespace: metav1.NamespaceDefault,
},
@ -97,7 +97,7 @@ func TestValidateEvent(t *testing.T) {
Namespace: metav1.NamespaceDefault,
},
InvolvedObject: core.ObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "batch/v1",
Kind: "Job",
Namespace: "foo",
},
@ -110,7 +110,7 @@ func TestValidateEvent(t *testing.T) {
Namespace: metav1.NamespaceDefault,
},
InvolvedObject: core.ObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "batch/v1",
Kind: "Job",
Namespace: metav1.NamespaceDefault,
},
@ -149,7 +149,7 @@ func TestValidateEvent(t *testing.T) {
Namespace: metav1.NamespaceDefault,
},
InvolvedObject: core.ObjectReference{
APIVersion: "extensions",
APIVersion: "batch",
Kind: "Job",
Namespace: "foo",
},
@ -162,8 +162,7 @@ func TestValidateEvent(t *testing.T) {
Namespace: "foo",
},
InvolvedObject: core.ObjectReference{
// must register in v1beta1 to be true
APIVersion: "extensions/v1beta1",
APIVersion: "batch/v1",
Kind: "Job",
Namespace: "foo",
},

View File

@ -412,7 +412,7 @@ type RealRSControl struct {
var _ RSControlInterface = &RealRSControl{}
func (r RealRSControl) PatchReplicaSet(namespace, name string, data []byte) error {
_, err := r.KubeClient.ExtensionsV1beta1().ReplicaSets(namespace).Patch(name, types.StrategicMergePatchType, data)
_, err := r.KubeClient.AppsV1().ReplicaSets(namespace).Patch(name, types.StrategicMergePatchType, data)
return err
}

View File

@ -261,7 +261,7 @@ func (dsc *DaemonSetsController) controlledHistories(ds *apps.DaemonSet) ([]*app
// If any adoptions are attempted, we should first recheck for deletion with
// an uncached quorum read sometime after listing Pods (see #42639).
canAdoptFunc := controller.RecheckDeletionTimestamp(func() (metav1.Object, error) {
fresh, err := dsc.kubeClient.ExtensionsV1beta1().DaemonSets(ds.Namespace).Get(ds.Name, metav1.GetOptions{})
fresh, err := dsc.kubeClient.AppsV1().DaemonSets(ds.Namespace).Get(ds.Name, metav1.GetOptions{})
if err != nil {
return nil, err
}
@ -348,7 +348,7 @@ func (dsc *DaemonSetsController) snapshot(ds *apps.DaemonSet, revision int64) (*
// Handle name collisions between different history
// Get the latest DaemonSet from the API server to make sure collision count is only increased when necessary
currDS, getErr := dsc.kubeClient.ExtensionsV1beta1().DaemonSets(ds.Namespace).Get(ds.Name, metav1.GetOptions{})
currDS, getErr := dsc.kubeClient.AppsV1().DaemonSets(ds.Namespace).Get(ds.Name, metav1.GetOptions{})
if getErr != nil {
return nil, getErr
}
@ -360,7 +360,7 @@ func (dsc *DaemonSetsController) snapshot(ds *apps.DaemonSet, revision int64) (*
currDS.Status.CollisionCount = new(int32)
}
*currDS.Status.CollisionCount++
_, updateErr := dsc.kubeClient.ExtensionsV1beta1().DaemonSets(ds.Namespace).UpdateStatus(currDS)
_, updateErr := dsc.kubeClient.AppsV1().DaemonSets(ds.Namespace).UpdateStatus(currDS)
if updateErr != nil {
return nil, updateErr
}

View File

@ -23,17 +23,15 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/client-go/informers/apps/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/informers/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/informers/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/listers/apps/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/listers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/listers/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
@ -49,9 +47,8 @@ go_test(
deps = [
"//pkg/apis/core/install:go_default_library",
"//pkg/controller:go_default_library",
"//staging/src/k8s.io/api/apps/v1beta1:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/intstr:go_default_library",

View File

@ -31,17 +31,15 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
appsinformers "k8s.io/client-go/informers/apps/v1beta1"
appsv1informers "k8s.io/client-go/informers/apps/v1"
coreinformers "k8s.io/client-go/informers/core/v1"
extensionsinformers "k8s.io/client-go/informers/extensions/v1beta1"
policyinformers "k8s.io/client-go/informers/policy/v1beta1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
policyclientset "k8s.io/client-go/kubernetes/typed/policy/v1beta1"
appslisters "k8s.io/client-go/listers/apps/v1beta1"
appsv1listers "k8s.io/client-go/listers/apps/v1"
corelisters "k8s.io/client-go/listers/core/v1"
extensionslisters "k8s.io/client-go/listers/extensions/v1beta1"
policylisters "k8s.io/client-go/listers/policy/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
@ -79,13 +77,13 @@ type DisruptionController struct {
rcLister corelisters.ReplicationControllerLister
rcListerSynced cache.InformerSynced
rsLister extensionslisters.ReplicaSetLister
rsLister appsv1listers.ReplicaSetLister
rsListerSynced cache.InformerSynced
dLister extensionslisters.DeploymentLister
dLister appsv1listers.DeploymentLister
dListerSynced cache.InformerSynced
ssLister appslisters.StatefulSetLister
ssLister appsv1listers.StatefulSetLister
ssListerSynced cache.InformerSynced
// PodDisruptionBudget keys that need to be synced.
@ -113,9 +111,9 @@ func NewDisruptionController(
podInformer coreinformers.PodInformer,
pdbInformer policyinformers.PodDisruptionBudgetInformer,
rcInformer coreinformers.ReplicationControllerInformer,
rsInformer extensionsinformers.ReplicaSetInformer,
dInformer extensionsinformers.DeploymentInformer,
ssInformer appsinformers.StatefulSetInformer,
rsInformer appsv1informers.ReplicaSetInformer,
dInformer appsv1informers.DeploymentInformer,
ssInformer appsv1informers.StatefulSetInformer,
kubeClient clientset.Interface,
) *DisruptionController {
dc := &DisruptionController{

View File

@ -23,9 +23,8 @@ import (
"testing"
"time"
apps "k8s.io/api/apps/v1beta1"
apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
policy "k8s.io/api/policy/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
@ -102,9 +101,9 @@ func newFakeDisruptionController() (*disruptionController, *pdbStates) {
informerFactory.Core().V1().Pods(),
informerFactory.Policy().V1beta1().PodDisruptionBudgets(),
informerFactory.Core().V1().ReplicationControllers(),
informerFactory.Extensions().V1beta1().ReplicaSets(),
informerFactory.Extensions().V1beta1().Deployments(),
informerFactory.Apps().V1beta1().StatefulSets(),
informerFactory.Apps().V1().ReplicaSets(),
informerFactory.Apps().V1().Deployments(),
informerFactory.Apps().V1().StatefulSets(),
nil,
)
dc.getUpdater = func() updater { return ps.Set }
@ -120,9 +119,9 @@ func newFakeDisruptionController() (*disruptionController, *pdbStates) {
informerFactory.Core().V1().Pods().Informer().GetStore(),
informerFactory.Policy().V1beta1().PodDisruptionBudgets().Informer().GetStore(),
informerFactory.Core().V1().ReplicationControllers().Informer().GetStore(),
informerFactory.Extensions().V1beta1().ReplicaSets().Informer().GetStore(),
informerFactory.Extensions().V1beta1().Deployments().Informer().GetStore(),
informerFactory.Apps().V1beta1().StatefulSets().Informer().GetStore(),
informerFactory.Apps().V1().ReplicaSets().Informer().GetStore(),
informerFactory.Apps().V1().Deployments().Informer().GetStore(),
informerFactory.Apps().V1().StatefulSets().Informer().GetStore(),
}, ps
}
@ -192,7 +191,7 @@ func updatePodOwnerToRc(t *testing.T, pod *v1.Pod, rc *v1.ReplicationController)
pod.OwnerReferences = append(pod.OwnerReferences, controllerReference)
}
func updatePodOwnerToRs(t *testing.T, pod *v1.Pod, rs *extensions.ReplicaSet) {
func updatePodOwnerToRs(t *testing.T, pod *v1.Pod, rs *apps.ReplicaSet) {
var controllerReference metav1.OwnerReference
var trueVar = true
controllerReference = metav1.OwnerReference{UID: rs.UID, APIVersion: controllerKindRS.GroupVersion().String(), Kind: controllerKindRS.Kind, Name: rs.Name, Controller: &trueVar}
@ -258,8 +257,8 @@ func newReplicationController(t *testing.T, size int32) (*v1.ReplicationControll
return rc, rcName
}
func newDeployment(t *testing.T, size int32) (*extensions.Deployment, string) {
d := &extensions.Deployment{
func newDeployment(t *testing.T, size int32) (*apps.Deployment, string) {
d := &apps.Deployment{
TypeMeta: metav1.TypeMeta{APIVersion: "v1"},
ObjectMeta: metav1.ObjectMeta{
UID: uuid.NewUUID(),
@ -268,7 +267,7 @@ func newDeployment(t *testing.T, size int32) (*extensions.Deployment, string) {
ResourceVersion: "18",
Labels: fooBar(),
},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Replicas: &size,
Selector: newSelFooBar(),
},
@ -282,8 +281,8 @@ func newDeployment(t *testing.T, size int32) (*extensions.Deployment, string) {
return d, dName
}
func newReplicaSet(t *testing.T, size int32) (*extensions.ReplicaSet, string) {
rs := &extensions.ReplicaSet{
func newReplicaSet(t *testing.T, size int32) (*apps.ReplicaSet, string) {
rs := &apps.ReplicaSet{
TypeMeta: metav1.TypeMeta{APIVersion: "v1"},
ObjectMeta: metav1.ObjectMeta{
UID: uuid.NewUUID(),
@ -292,7 +291,7 @@ func newReplicaSet(t *testing.T, size int32) (*extensions.ReplicaSet, string) {
ResourceVersion: "18",
Labels: fooBar(),
},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &size,
Selector: newSelFooBar(),
},

View File

@ -234,8 +234,8 @@ func TestSyncNamespaceThatIsTerminatingNonExperimental(t *testing.T) {
testSyncNamespaceThatIsTerminating(t, &metav1.APIVersions{})
}
func TestSyncNamespaceThatIsTerminatingV1Beta1(t *testing.T) {
testSyncNamespaceThatIsTerminating(t, &metav1.APIVersions{Versions: []string{"extensions/v1beta1"}})
func TestSyncNamespaceThatIsTerminatingV1(t *testing.T) {
testSyncNamespaceThatIsTerminating(t, &metav1.APIVersions{Versions: []string{"apps/v1"}})
}
func TestSyncNamespaceThatIsActive(t *testing.T) {
@ -331,7 +331,7 @@ func testResources() []*metav1.APIResourceList {
},
},
{
GroupVersion: "extensions/v1beta1",
GroupVersion: "apps/v1",
APIResources: []metav1.APIResource{
{
Name: "deployments",

View File

@ -28,15 +28,15 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/informers/coordination/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/informers/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/coordination/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/listers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/listers/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//staging/src/k8s.io/client-go/util/flowcontrol:go_default_library",
@ -77,9 +77,9 @@ go_test(
"//pkg/scheduler/api:go_default_library",
"//pkg/util/node:go_default_library",
"//pkg/util/taints:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/coordination/v1beta1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
@ -87,9 +87,9 @@ go_test(
"//staging/src/k8s.io/apiserver/pkg/util/feature:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/feature/testing:go_default_library",
"//staging/src/k8s.io/client-go/informers:go_default_library",
"//staging/src/k8s.io/client-go/informers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/informers/coordination/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/informers/core/v1:go_default_library",
"//staging/src/k8s.io/client-go/informers/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
"//staging/src/k8s.io/client-go/testing:go_default_library",

View File

@ -39,15 +39,15 @@ import (
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
utilfeature "k8s.io/apiserver/pkg/util/feature"
appsv1informers "k8s.io/client-go/informers/apps/v1"
coordinformers "k8s.io/client-go/informers/coordination/v1beta1"
coreinformers "k8s.io/client-go/informers/core/v1"
extensionsinformers "k8s.io/client-go/informers/extensions/v1beta1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/scheme"
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
appsv1listers "k8s.io/client-go/listers/apps/v1"
coordlisters "k8s.io/client-go/listers/coordination/v1beta1"
corelisters "k8s.io/client-go/listers/core/v1"
extensionslisters "k8s.io/client-go/listers/extensions/v1beta1"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/flowcontrol"
@ -172,7 +172,7 @@ type Controller struct {
zoneStates map[string]ZoneState
daemonSetStore extensionslisters.DaemonSetLister
daemonSetStore appsv1listers.DaemonSetLister
daemonSetInformerSynced cache.InformerSynced
leaseLister coordlisters.LeaseLister
@ -240,7 +240,7 @@ func NewNodeLifecycleController(
leaseInformer coordinformers.LeaseInformer,
podInformer coreinformers.PodInformer,
nodeInformer coreinformers.NodeInformer,
daemonSetInformer extensionsinformers.DaemonSetInformer,
daemonSetInformer appsv1informers.DaemonSetInformer,
kubeClient clientset.Interface,
nodeMonitorPeriod time.Duration,
nodeStartupGracePeriod time.Duration,

View File

@ -21,9 +21,9 @@ import (
"testing"
"time"
apps "k8s.io/api/apps/v1"
coordv1beta1 "k8s.io/api/coordination/v1beta1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -31,9 +31,9 @@ import (
utilfeature "k8s.io/apiserver/pkg/util/feature"
utilfeaturetesting "k8s.io/apiserver/pkg/util/feature/testing"
"k8s.io/client-go/informers"
appsinformers "k8s.io/client-go/informers/apps/v1"
coordinformers "k8s.io/client-go/informers/coordination/v1beta1"
coreinformers "k8s.io/client-go/informers/core/v1"
extensionsinformers "k8s.io/client-go/informers/extensions/v1beta1"
clientset "k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes/fake"
testcore "k8s.io/client-go/testing"
@ -64,7 +64,7 @@ type nodeLifecycleController struct {
*Controller
leaseInformer coordinformers.LeaseInformer
nodeInformer coreinformers.NodeInformer
daemonSetInformer extensionsinformers.DaemonSetInformer
daemonSetInformer appsinformers.DaemonSetInformer
}
// doEviction does the fake eviction and returns the status of eviction operation.
@ -139,7 +139,7 @@ func newNodeLifecycleControllerFromClient(
leaseInformer := factory.Coordination().V1beta1().Leases()
nodeInformer := factory.Core().V1().Nodes()
daemonSetInformer := factory.Extensions().V1beta1().DaemonSets()
daemonSetInformer := factory.Apps().V1().DaemonSets()
nc, err := NewNodeLifecycleController(
leaseInformer,
@ -196,7 +196,7 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
table := []struct {
fakeNodeHandler *testutil.FakeNodeHandler
daemonSets []extensions.DaemonSet
daemonSets []apps.DaemonSet
timeToPass time.Duration
newNodeStatus v1.NodeStatus
secondNodeNewStatus v1.NodeStatus
@ -409,13 +409,13 @@ func TestMonitorNodeHealthEvictPods(t *testing.T) {
},
),
},
daemonSets: []extensions.DaemonSet{
daemonSets: []apps.DaemonSet{
{
ObjectMeta: metav1.ObjectMeta{
Name: "ds0",
Namespace: "default",
},
Spec: extensions.DaemonSetSpec{
Spec: apps.DaemonSetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"daemon": "yes"},
},

View File

@ -55,10 +55,10 @@ go_test(
embed = [":go_default_library"],
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/apps/install:go_default_library",
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/autoscaling/install:go_default_library",
"//pkg/apis/core/install:go_default_library",
"//pkg/apis/extensions/install:go_default_library",
"//pkg/controller:go_default_library",
"//pkg/controller/podautoscaler/metrics:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v1:go_default_library",

View File

@ -51,8 +51,8 @@ import (
"github.com/stretchr/testify/assert"
_ "k8s.io/kubernetes/pkg/apis/apps/install"
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
)
var statusOk = []autoscalingv2.HorizontalPodAutoscalerCondition{
@ -862,7 +862,7 @@ func TestScaleUpDeployment(t *testing.T) {
useMetricsAPI: true,
resource: &fakeResource{
name: "test-dep",
apiVersion: "extensions/v1beta1",
apiVersion: "apps/v1",
kind: "Deployment",
},
}
@ -882,7 +882,7 @@ func TestScaleUpReplicaSet(t *testing.T) {
useMetricsAPI: true,
resource: &fakeResource{
name: "test-replicaset",
apiVersion: "extensions/v1beta1",
apiVersion: "apps/v1",
kind: "ReplicaSet",
},
}
@ -1033,7 +1033,7 @@ func TestScaleUpCMObject(t *testing.T) {
Type: autoscalingv2.ObjectMetricSourceType,
Object: &autoscalingv2.ObjectMetricSource{
DescribedObject: autoscalingv2.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "some-deployment",
},
@ -1183,7 +1183,7 @@ func TestScaleDownCMObject(t *testing.T) {
Type: autoscalingv2.ObjectMetricSourceType,
Object: &autoscalingv2.ObjectMetricSource{
DescribedObject: autoscalingv2.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "some-deployment",
},
@ -1392,7 +1392,7 @@ func TestToleranceCMObject(t *testing.T) {
Type: autoscalingv2.ObjectMetricSourceType,
Object: &autoscalingv2.ObjectMetricSource{
DescribedObject: autoscalingv2.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "some-deployment",
},
@ -1860,7 +1860,7 @@ func TestConditionFailedGetMetrics(t *testing.T) {
Type: autoscalingv2.ObjectMetricSourceType,
Object: &autoscalingv2.ObjectMetricSource{
DescribedObject: autoscalingv2.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "some-deployment",
},

View File

@ -50,9 +50,9 @@ import (
"github.com/stretchr/testify/assert"
_ "k8s.io/kubernetes/pkg/apis/apps/install"
_ "k8s.io/kubernetes/pkg/apis/autoscaling/install"
_ "k8s.io/kubernetes/pkg/apis/core/install"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
)
func (w fakeResponseWrapper) DoRaw() ([]byte, error) {
@ -588,7 +588,7 @@ func TestLegacyScaleUpDeployment(t *testing.T) {
useMetricsAPI: true,
resource: &fakeResource{
name: "test-dep",
apiVersion: "extensions/v1beta1",
apiVersion: "apps/v1",
kind: "Deployment",
},
}
@ -608,7 +608,7 @@ func TestLegacyScaleUpReplicaSet(t *testing.T) {
useMetricsAPI: true,
resource: &fakeResource{
name: "test-replicaset",
apiVersion: "extensions/v1beta1",
apiVersion: "apps/v1",
kind: "ReplicaSet",
},
}

View File

@ -38,7 +38,7 @@ go_test(
embed = [":go_default_library"],
deps = [
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/extensions/install:go_default_library",
"//pkg/apis/apps/install:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v2beta2:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/meta/testrestmapper:go_default_library",

View File

@ -31,7 +31,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
core "k8s.io/client-go/testing"
"k8s.io/kubernetes/pkg/api/legacyscheme"
_ "k8s.io/kubernetes/pkg/apis/extensions/install"
_ "k8s.io/kubernetes/pkg/apis/apps/install"
cmapi "k8s.io/metrics/pkg/apis/custom_metrics/v1beta2"
emapi "k8s.io/metrics/pkg/apis/external_metrics/v1beta1"
metricsapi "k8s.io/metrics/pkg/apis/metrics/v1beta1"
@ -305,7 +305,7 @@ func TestRESTClientSingleObject(t *testing.T) {
targetTimestamp: 1,
reportedMetricPoints: []metricPoint{{10, 1}},
singleObject: &autoscalingapi.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: "some-dep",
},

View File

@ -623,7 +623,7 @@ func TestReplicaCalcScaleUpCMObject(t *testing.T) {
expectedUtilization: 20000,
singleObject: &autoscalingv2.CrossVersionObjectReference{
Kind: "Deployment",
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Name: "some-deployment",
},
},
@ -643,7 +643,7 @@ func TestReplicaCalcScaleUpCMObjectIgnoresUnreadyPods(t *testing.T) {
expectedUtilization: 50000,
singleObject: &autoscalingv2.CrossVersionObjectReference{
Kind: "Deployment",
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Name: "some-deployment",
},
},
@ -758,7 +758,7 @@ func TestReplicaCalcScaleDownCMObject(t *testing.T) {
expectedUtilization: 12000,
singleObject: &autoscalingv2.CrossVersionObjectReference{
Kind: "Deployment",
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Name: "some-deployment",
},
},
@ -916,7 +916,7 @@ func TestReplicaCalcToleranceCMObject(t *testing.T) {
expectedUtilization: 20666,
singleObject: &autoscalingv2.CrossVersionObjectReference{
Kind: "Deployment",
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Name: "some-deployment",
},
},

View File

@ -22,6 +22,7 @@ go_library(
"//pkg/controller:go_default_library",
"//pkg/controller/replicaset:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",

View File

@ -27,6 +27,7 @@ import (
"time"
apps "k8s.io/api/apps/v1"
autoscalingv1 "k8s.io/api/autoscaling/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
@ -239,6 +240,16 @@ func (c conversionClient) Patch(name string, pt types.PatchType, data []byte, su
return nil, errors.New("Patch() is not implemented for conversionClient")
}
func (c conversionClient) GetScale(name string, options metav1.GetOptions) (result *autoscalingv1.Scale, err error) {
// This is not used by RSC.
return nil, errors.New("GetScale() is not implemented for conversionClient")
}
func (c conversionClient) UpdateScale(name string, scale *autoscalingv1.Scale) (result *autoscalingv1.Scale, err error) {
// This is not used by RSC.
return nil, errors.New("UpdateScale() is not implemented for conversionClient")
}
func convertSlice(rcList []*v1.ReplicationController) ([]*apps.ReplicaSet, error) {
rsList := make([]*apps.ReplicaSet, 0, len(rcList))
for _, rc := range rcList {

View File

@ -18,7 +18,7 @@ go_library(
"//staging/src/k8s.io/apimachinery/pkg/util/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/listers/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/listers/apps/v1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/tools/record:go_default_library",
"//vendor/k8s.io/klog:go_default_library",

View File

@ -31,7 +31,7 @@ import (
"k8s.io/api/core/v1"
clientset "k8s.io/client-go/kubernetes"
extensionslisters "k8s.io/client-go/listers/extensions/v1beta1"
appsv1listers "k8s.io/client-go/listers/apps/v1"
api "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/controller"
"k8s.io/kubernetes/pkg/kubelet/util/format"
@ -43,7 +43,7 @@ import (
// DeletePods will delete all pods from master running on given node,
// and return true if any pods were deleted, or were found pending
// deletion.
func DeletePods(kubeClient clientset.Interface, recorder record.EventRecorder, nodeName, nodeUID string, daemonStore extensionslisters.DaemonSetLister) (bool, error) {
func DeletePods(kubeClient clientset.Interface, recorder record.EventRecorder, nodeName, nodeUID string, daemonStore appsv1listers.DaemonSetLister) (bool, error) {
remaining := false
selector := fields.OneTermEqualSelector(api.PodHostField, nodeName).String()
options := metav1.ListOptions{FieldSelector: selector}

View File

@ -26,19 +26,19 @@ var _ = Describe("Comparing fields of remote and recorded ", func() {
Context("Test conflict in map fields of remote and recorded", func() {
It("If conflicts found, expected return error", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1: "key1"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo2: "baz2-1"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1: "baz1-0"
@ -53,7 +53,7 @@ spec:
Context("Test conflict in list fields of remote and recorded ", func() {
It("If conflicts found, expected return false", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -62,7 +62,7 @@ metadata:
- "d"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -70,7 +70,7 @@ metadata:
- "b"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -87,7 +87,7 @@ metadata:
Context("Test conflict in Map-List fields of remote and recorded ", func() {
It("should leave the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -97,7 +97,7 @@ spec:
image: image1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -107,7 +107,7 @@ spec:
image: image2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -125,21 +125,21 @@ spec:
Context("Test conflicts in nested map field", func() {
It("If conflicts found, expected return error", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1:
name: "key1"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1:
name: "baz1-0"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1:
@ -154,7 +154,7 @@ spec:
Context("Test conflicts in complicated map, list", func() {
It("Should catch conflict in key-value in map element", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -170,7 +170,7 @@ spec:
hostPort: 2022
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -183,7 +183,7 @@ spec:
hostPort: 2020
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:

View File

@ -28,7 +28,7 @@ var _ = Describe("Merging fields of type list-of-map with openapi", func() {
Context("where one of the items has been deleted resulting in the containers being empty", func() {
It("should set the containers field to null", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -38,7 +38,7 @@ spec:
image: image
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -46,7 +46,7 @@ spec:
containers:
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -58,7 +58,7 @@ spec:
image: image2
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -71,7 +71,7 @@ spec:
Context("where one of the items has been deleted", func() {
It("should be deleted from the result", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -83,7 +83,7 @@ spec:
image: image-delete
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -93,7 +93,7 @@ spec:
image: image-keep
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -105,7 +105,7 @@ spec:
image: image-delete
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -121,7 +121,7 @@ spec:
Context("where one of the items is only in the remote", func() {
It("should leave the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -131,7 +131,7 @@ spec:
image: image2
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -141,7 +141,7 @@ spec:
image: image2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -151,7 +151,7 @@ spec:
image: image
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -169,7 +169,7 @@ spec:
Context("where one of the items differs from the remote value and is missing from the recorded", func() {
It("should update the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -177,7 +177,7 @@ spec:
containers:
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -187,7 +187,7 @@ spec:
image: image:2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -197,7 +197,7 @@ spec:
image: image:1
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -213,7 +213,7 @@ spec:
Context("where one of the items differs from the remote value but matches the recorded", func() {
It("should update the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -223,7 +223,7 @@ spec:
image: image:2
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -233,7 +233,7 @@ spec:
image: image:2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -243,7 +243,7 @@ spec:
image: image:1
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -259,7 +259,7 @@ spec:
Context("where one of the items is missing from the remote but matches the recorded", func() {
It("should add the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -269,7 +269,7 @@ spec:
image: image:2
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -279,7 +279,7 @@ spec:
image: image:2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -287,7 +287,7 @@ spec:
containers:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -303,7 +303,7 @@ spec:
Context("where one of the items is missing from the remote and missing from the recorded ", func() {
It("should add the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -312,7 +312,7 @@ spec:
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -322,7 +322,7 @@ spec:
image: image:2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -330,7 +330,7 @@ spec:
containers:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -346,7 +346,7 @@ spec:
Context("where the order of the resolved, local and remote lists differs", func() {
It("should keep the order specified in local and append items appears only in remote", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -363,7 +363,7 @@ spec:
timeoutSeconds: 4
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -383,7 +383,7 @@ spec:
initialDelaySeconds: 18
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -403,7 +403,7 @@ spec:
imagePullPolicy: Always
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -441,7 +441,7 @@ var _ = Describe("Merging fields of type list-of-map with openapi containing a m
Context("where one of the items has been deleted", func() {
It("should delete the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -457,7 +457,7 @@ spec:
hostPort: 2022
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -470,7 +470,7 @@ spec:
hostPort: 2020
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -487,7 +487,7 @@ spec:
hostIP: "127.0.0.1"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -506,7 +506,7 @@ spec:
Context("where one of the items has been updated", func() {
It("should merge updates to the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -522,7 +522,7 @@ spec:
hostPort: 2021
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -538,7 +538,7 @@ spec:
hostPort: 2022
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -555,7 +555,7 @@ spec:
hostIP: "127.0.0.1"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -578,7 +578,7 @@ spec:
Context("where one of the items has been added", func() {
It("should add the item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -591,7 +591,7 @@ spec:
hostPort: 2020
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -607,7 +607,7 @@ spec:
hostPort: 2022
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -621,7 +621,7 @@ spec:
hostIP: "127.0.0.1"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:

View File

@ -26,7 +26,7 @@ var _ = Describe("Merging fields of type map with openapi for some fields", func
Context("where a field has been deleted", func() {
It("should delete the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -35,14 +35,14 @@ spec:
image: "1"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
foo2: null
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -57,7 +57,7 @@ spec:
image: "3"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -72,7 +72,7 @@ spec:
Context("where a field is has been added", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1:
@ -80,7 +80,7 @@ spec:
image: "1"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -92,12 +92,12 @@ spec:
image: "2"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -115,7 +115,7 @@ spec:
Context("where a field is has been updated", func() {
It("should update the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo1:
@ -123,7 +123,7 @@ spec:
image: "1-1"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -135,7 +135,7 @@ spec:
image: "2-1"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 2
@ -147,7 +147,7 @@ spec:
image: "2-0"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3

View File

@ -26,7 +26,7 @@ var _ = Describe("Merging fields of type list-of-primitive with openapi", func()
Context("where one of the items has been deleted", func() {
It("should delete the deleted item", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -35,7 +35,7 @@ metadata:
- "c"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -43,7 +43,7 @@ metadata:
- "c"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -52,7 +52,7 @@ metadata:
- "c"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -66,7 +66,7 @@ metadata:
Context("where one of the items is only on the remote", func() {
It("should move the remote-only item to the end but keep it", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -74,7 +74,7 @@ metadata:
- "b"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -82,7 +82,7 @@ metadata:
- "b"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -91,7 +91,7 @@ metadata:
- "a"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -106,7 +106,7 @@ metadata:
Context("where one of the items is repeated", func() {
It("should de-duplicate the repeated items", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -114,7 +114,7 @@ metadata:
- "b"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -123,7 +123,7 @@ metadata:
- "a"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -131,7 +131,7 @@ metadata:
- "b"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -145,7 +145,7 @@ metadata:
Context("where some items are deleted and others are on remote only", func() {
It("should retain the correct items in the correct order", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -154,7 +154,7 @@ metadata:
- "c"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -163,7 +163,7 @@ metadata:
- "a"
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:
@ -174,7 +174,7 @@ metadata:
- "e"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
finalizers:

View File

@ -26,7 +26,7 @@ var _ = Describe("Merging fields of type map with openapi", func() {
Context("where a field has been deleted", func() {
It("should delete the field when it is the only field in the map", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - recorded/remote match
@ -35,14 +35,14 @@ spec:
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - not present in recorded
replicas: null
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -51,7 +51,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
@ -60,7 +60,7 @@ spec:
It("should delete the field when there are other fields in the map", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - recorded/remote match
@ -69,7 +69,7 @@ spec:
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - not present in recorded
@ -78,7 +78,7 @@ spec:
revisionHistoryLimit: 1
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -88,7 +88,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
revisionHistoryLimit: 1
@ -100,14 +100,14 @@ spec:
Context("where a field is has been added", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
paused: true
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# Add this - it is missing from recorded and remote
@ -118,12 +118,12 @@ spec:
progressDeadlineSeconds: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -137,14 +137,14 @@ spec:
Context("where a field is has been updated", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
paused: true
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# Missing from recorded
@ -155,7 +155,7 @@ spec:
progressDeadlineSeconds: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 2
@ -163,7 +163,7 @@ spec:
progressDeadlineSeconds: 3
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -175,26 +175,26 @@ spec:
It("should update the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 2
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 2
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
replicas: 3
@ -208,7 +208,7 @@ var _ = Describe("Merging fields of type map without openapi", func() {
Context("where a field has been deleted", func() {
It("should delete the field when it is the only field in the map", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
# delete - recorded/remote match
@ -217,14 +217,14 @@ spec:
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
# delete - not present in recorded
replicas: null
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 3
@ -233,7 +233,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
`)
@ -242,7 +242,7 @@ spec:
It("should delete the field when there are other fields in the map", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
# delete - recorded/remote match
@ -251,7 +251,7 @@ spec:
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
# delete - not present in recorded
@ -260,7 +260,7 @@ spec:
revisionHistoryLimit: 1
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 3
@ -270,7 +270,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
revisionHistoryLimit: 1
@ -282,14 +282,14 @@ spec:
Context("where a field is has been added", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
paused: true
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
# Add this - it is missing from recorded and remote
@ -300,12 +300,12 @@ spec:
progressDeadlineSeconds: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 3
@ -319,14 +319,14 @@ spec:
Context("where a field is has been updated", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
paused: true
progressDeadlineSeconds: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
# Matches recorded
@ -337,7 +337,7 @@ spec:
progressDeadlineSeconds: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 2
@ -345,7 +345,7 @@ spec:
progressDeadlineSeconds: 3
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 3
@ -357,26 +357,26 @@ spec:
It("should update the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 2
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 3
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 2
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
replicas: 3
@ -390,7 +390,7 @@ var _ = Describe("Merging fields of type map with openapi", func() {
Context("where a field has been deleted", func() {
It("should delete the field when it is the only field in the map", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - recorded/remote match
@ -399,14 +399,14 @@ spec:
bar: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - not present in recorded
baz: null
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
baz: 3
@ -415,7 +415,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
@ -424,7 +424,7 @@ spec:
It("should delete the field when there are other fields in the map", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - recorded/remote match
@ -433,7 +433,7 @@ spec:
bar: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# delete - not present in recorded
@ -442,7 +442,7 @@ spec:
biz: 1
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
bar: 3
@ -452,7 +452,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
biz: 1
@ -464,14 +464,14 @@ spec:
Context("where a field is has been added", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo: true
biz: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# Add this - it is missing from recorded and remote
@ -482,12 +482,12 @@ spec:
biz: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
baz: 3
@ -501,14 +501,14 @@ spec:
Context("where a field is has been updated", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
foo: true
baz: 1
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
# Missing from recorded
@ -519,7 +519,7 @@ spec:
baz: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
bar: 2
@ -527,7 +527,7 @@ spec:
baz: 3
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
bar: 3

View File

@ -26,7 +26,7 @@ var _ = Describe("Replacing fields of type list without openapi", func() {
Context("where a field is has been updated", func() {
It("should replace the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
bar:
@ -36,7 +36,7 @@ spec:
value: 2
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
bar:
@ -46,7 +46,7 @@ spec:
value: 2
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
bar:
@ -58,7 +58,7 @@ spec:
value: 4
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
bar:

View File

@ -33,7 +33,7 @@ var _ = Describe("Replacing fields of type map with openapi for some fields", fu
Context("where a field is has been updated", func() {
It("should update the field", func() {
recorded := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
spec:
template:
@ -42,7 +42,7 @@ spec:
image: image1
`)
local := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
spec:
template:
@ -51,7 +51,7 @@ spec:
image: image1
`)
remote := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
spec:
template:
@ -64,7 +64,7 @@ spec:
image: image3
`)
expected := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: ReplicaSet
spec:
template:

View File

@ -26,7 +26,7 @@ var _ = Describe("Replacing fields of type list with openapi", func() {
Context("where the field has been deleted", func() {
It("should delete the field if present in recorded and missing from local.", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -38,7 +38,7 @@ spec:
- b
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -47,7 +47,7 @@ spec:
- name: container
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -62,7 +62,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -75,7 +75,7 @@ spec:
It("should delete the field if missing in recorded and set to null in local.", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -84,7 +84,7 @@ spec:
- name: container
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -95,7 +95,7 @@ spec:
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -109,7 +109,7 @@ spec:
- "y"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -124,14 +124,14 @@ spec:
Context("where the field is has been added", func() {
It("should add the field when missing from recorded", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -144,14 +144,14 @@ spec:
- c
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -168,7 +168,7 @@ spec:
It("should add the field when even when present in recorded", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -181,7 +181,7 @@ spec:
- c
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -194,14 +194,14 @@ spec:
- c
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -218,12 +218,12 @@ spec:
It("should add the field when the parent field is missing as well", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -236,12 +236,12 @@ spec:
- c
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -260,7 +260,7 @@ spec:
Context("where a field is has been updated", func() {
It("should replace the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -273,7 +273,7 @@ spec:
- c
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -286,7 +286,7 @@ spec:
- f
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
spec:
@ -302,7 +302,7 @@ spec:
- "y"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -319,7 +319,7 @@ spec:
It("should replace the field even if recorded matches", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -332,7 +332,7 @@ spec:
- f
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -345,7 +345,7 @@ spec:
- f
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
spec:
@ -361,7 +361,7 @@ spec:
- "y"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -378,7 +378,7 @@ spec:
It("should replace the field even if the only change is ordering", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -391,7 +391,7 @@ spec:
- f
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -404,7 +404,7 @@ spec:
- f
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
spec:
@ -418,7 +418,7 @@ spec:
- c
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -439,7 +439,7 @@ var _ = Describe("Replacing fields of type list with openapi for the type, but n
Context("where a field is has been updated", func() {
It("should replace the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -452,7 +452,7 @@ spec:
- c
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -471,7 +471,7 @@ spec:
- g
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
spec:
@ -503,7 +503,7 @@ spec:
- m
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -530,7 +530,7 @@ var _ = Describe("Replacing fields of type list without openapi", func() {
Context("where the field has been deleted", func() {
It("should delete the field.", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -539,14 +539,14 @@ spec:
- b
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
arguments:
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -570,7 +570,7 @@ spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -587,7 +587,7 @@ spec:
Context("where the field is has been added", func() {
It("should add the field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -598,7 +598,7 @@ spec:
- "y"
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -616,12 +616,12 @@ spec:
- w
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -643,7 +643,7 @@ spec:
Context("where a field is has been updated", func() {
It("should replace field", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -657,7 +657,7 @@ spec:
- u
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:
@ -677,7 +677,7 @@ spec:
- u
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
spec:
@ -698,7 +698,7 @@ spec:
- "t"
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Foo
spec:
template:

View File

@ -26,20 +26,20 @@ var _ = Describe("Merging fields with the retainkeys strategy", func() {
Context("where some fields are only defined remotely", func() {
It("should drop those fields ", func() {
recorded := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
`)
local := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
type: Recreate
`)
remote := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
@ -49,7 +49,7 @@ spec:
maxSurge: 1
`)
expected := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
@ -62,13 +62,13 @@ spec:
Context("where some fields are defined both locally and remotely", func() {
It("should merge those fields", func() {
recorded := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
`)
local := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
@ -77,7 +77,7 @@ spec:
maxUnavailable: 2
`)
remote := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
@ -86,7 +86,7 @@ spec:
maxSurge: 1
`)
expected := create(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
strategy:
@ -102,14 +102,14 @@ spec:
Context("where the elements are in a list and some fields are only defined remotely", func() {
It("should drop those fields ", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -119,7 +119,7 @@ spec:
emptyDir:
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -130,7 +130,7 @@ spec:
path: /tmp/cache-volume
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -146,14 +146,14 @@ spec:
Context("where the elements are in a list", func() {
It("the fields defined both locally and remotely should be merged", func() {
recorded := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
`)
local := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -165,7 +165,7 @@ spec:
emptyDir:
`)
remote := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:
@ -177,7 +177,7 @@ spec:
type: Directory
`)
expected := create(`
apiVersion: apps/v1beta1
apiVersion: apps/v1
kind: Deployment
spec:
template:

View File

@ -1,11 +1,10 @@
{
"swagger": "2.0",
"info": {
"title": "Kubernetes",
"version": "v1.9.0"
},
"paths": {
"title": "Kubernetes",
"version": "v1.9.0"
},
"paths": {},
"definitions": {
"io.k8s.api.core.v1.Container": {
"description": "A single application container that you want to run within a pod.",
@ -63,8 +62,8 @@
}
}
},
"io.k8s.api.apps.v1beta1.Deployment": {
"description": "DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for more information. Deployment enables declarative updates for Pods and ReplicaSets.",
"io.k8s.api.apps.v1.Deployment": {
"description": "Deployment enables declarative updates for Pods and ReplicaSets.",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
@ -80,20 +79,21 @@
},
"spec": {
"description": "Specification of the desired behavior of the Deployment.",
"$ref": "#/definitions/io.k8s.api.apps.v1beta1.DeploymentSpec"
"$ref": "#/definitions/io.k8s.api.apps.v1.DeploymentSpec"
}
},
"x-kubernetes-group-version-kind": [
{
"group": "apps",
"kind": "Deployment",
"version": "v1beta1"
"version": "v1"
}
]
},
"io.k8s.api.apps.v1beta1.DeploymentSpec": {
"io.k8s.api.apps.v1.DeploymentSpec": {
"description": "DeploymentSpec is the specification of the desired behavior of the Deployment.",
"required": [
"selector",
"template"
],
"properties": {
@ -107,7 +107,7 @@
"type": "boolean"
},
"progressDeadlineSeconds": {
"description": "The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Once autoRollback is implemented, the deployment controller will automatically rollback failed deployments. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.",
"description": "The maximum time in seconds for a deployment to make progress before it is considered to be failed. The deployment controller will continue to process failed deployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the deployment status. Note that progress will not be estimated during the time a deployment is paused. Defaults to 600s.",
"type": "integer",
"format": "int32"
},
@ -117,16 +117,56 @@
"format": "int32"
},
"revisionHistoryLimit": {
"description": "The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 2.",
"description": "The number of old ReplicaSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified. Defaults to 10.",
"type": "integer",
"format": "int32"
},
"selector": {
"description": "Label selector for pods. Existing ReplicaSets whose pods are selected by this will be the ones affected by this deployment. It must match the pod template's labels.",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
},
"strategy": {
"description": "The deployment strategy to use to replace existing pods with new ones.",
"x-kubernetes-patch-strategy": "retainKeys",
"$ref": "#/definitions/io.k8s.api.apps.v1.DeploymentStrategy"
},
"template": {
"description": "Template describes the pods that will be created.",
"$ref": "#/definitions/io.k8s.api.core.v1.PodTemplateSpec"
}
}
},
"io.k8s.api.apps.v1.DeploymentStrategy": {
"description": "DeploymentStrategy describes how to replace existing pods with new ones.",
"properties": {
"rollingUpdate": {
"description": "Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate.",
"$ref": "#/definitions/io.k8s.api.apps.v1.RollingUpdateDeployment"
},
"type": {
"description": "Type of deployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.",
"type": "string"
}
}
},
"io.k8s.api.apps.v1.RollingUpdateDeployment": {
"description": "Spec to control the desired behavior of rolling update.",
"properties": {
"maxSurge": {
"description": "The maximum number of pods that can be scheduled above the desired number of pods. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). This can not be 0 if MaxUnavailable is 0. Absolute number is calculated from percentage by rounding up. Defaults to 25%. Example: when this is set to 30%, the new ReplicaSet can be scaled up immediately when the rolling update starts, such that the total number of old and new pods do not exceed 130% of desired pods. Once old pods have been killed, new ReplicaSet can be scaled up further, ensuring that total number of pods running at any time during the update is at most 130% of desired pods.",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
},
"maxUnavailable": {
"description": "The maximum number of pods that can be unavailable during the update. Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%). Absolute number is calculated from percentage by rounding down. This can not be 0 if MaxSurge is 0. Defaults to 25%. Example: when this is set to 30%, the old ReplicaSet can be scaled down to 70% of desired pods immediately when the rolling update starts. Once new pods are ready, old ReplicaSet can be scaled down further, followed by scaling up the new ReplicaSet, ensuring that the total number of pods available at all times during the update is at least 70% of desired pods.",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.util.intstr.IntOrString"
}
}
},
"io.k8s.apimachinery.pkg.util.intstr.IntOrString": {
"description": "IntOrString is a type that can hold an int32 or a string. When used in JSON or YAML marshalling and unmarshalling, it produces or consumes the inner type. This allows you to have, for example, a JSON field that can accept a name or number.",
"type": "string",
"format": "int-or-string"
},
"io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta": {
"description": "ObjectMeta is metadata that all persisted resources must have, which includes all objects users must create.",
"properties": {
@ -184,8 +224,8 @@
}
}
},
"io.k8s.api.extensions.v1beta1.ReplicaSet": {
"description": "DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for more information. ReplicaSet represents the configuration of a ReplicaSet.",
"io.k8s.api.apps.v1.ReplicaSet": {
"description": "ReplicaSet ensures that a specified number of pod replicas are running at any given time.",
"properties": {
"apiVersion": {
"description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources",
@ -201,21 +241,22 @@
},
"spec": {
"description": "Spec defines the specification of the desired behavior of the ReplicaSet. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status",
"$ref": "#/definitions/io.k8s.api.extensions.v1beta1.ReplicaSetSpec",
"x-kubernetes-patch-strategy": "replace"
"$ref": "#/definitions/io.k8s.api.apps.v1.ReplicaSetSpec"
}
},
"x-kubernetes-group-version-kind": [
{
"group": "extensions",
"group": "apps",
"kind": "ReplicaSet",
"version": "v1beta1"
"version": "v1"
}
]
},
"io.k8s.api.extensions.v1beta1.ReplicaSetSpec": {
"io.k8s.api.apps.v1.ReplicaSetSpec": {
"description": "ReplicaSetSpec is the specification of a ReplicaSet.",
"required": [
"selector"
],
"properties": {
"minReadySeconds": {
"description": "Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (pod will be considered available as soon as it is ready)",
@ -227,24 +268,73 @@
"type": "integer",
"format": "int32"
},
"selector": {
"description": "Selector is a label query over pods that should match the replica count. Label keys and values that must match in order to be controlled by this replica set. It must match the pod template's labels. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
},
"template": {
"description": "Template is the object that describes the pod that will be created if insufficient replicas are detected. More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template",
"$ref": "#/definitions/io.k8s.api.core.v1.PodTemplateSpec"
}
}
},
"io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector": {
"description": "A label selector is a label query over a set of resources. The result of matchLabels and matchExpressions are ANDed. An empty label selector matches all objects. A null label selector matches no objects.",
"properties": {
"matchExpressions": {
"description": "matchExpressions is a list of label selector requirements. The requirements are ANDed.",
"type": "array",
"items": {
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement"
}
},
"matchLabels": {
"description": "matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is \"key\", the operator is \"In\", and the values array contains only \"value\". The requirements are ANDed.",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
}
},
"io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement": {
"description": "A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.",
"required": [
"key",
"operator"
],
"properties": {
"key": {
"description": "key is the label key that the selector applies to.",
"type": "string",
"x-kubernetes-patch-merge-key": "key",
"x-kubernetes-patch-strategy": "merge"
},
"operator": {
"description": "operator represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist.",
"type": "string"
},
"values": {
"description": "values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic merge patch.",
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"securityDefinitions": {
"BearerToken": {
"description": "Bearer Token authentication",
"type": "apiKey",
"name": "authorization",
"in": "header"
}
"BearerToken": {
"description": "Bearer Token authentication",
"type": "apiKey",
"name": "authorization",
"in": "header"
}
},
"security": [
{
"BearerToken": []
}
{
"BearerToken": []
}
]
}
}

View File

@ -59,8 +59,8 @@ go_test(
"//pkg/kubectl/cmd/util:go_default_library",
"//pkg/kubectl/cmd/util/openapi:go_default_library",
"//pkg/kubectl/scheme:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/meta:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured:go_default_library",

View File

@ -32,8 +32,8 @@ import (
"github.com/googleapis/gnostic/OpenAPIv2"
"github.com/spf13/cobra"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
kubeerr "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@ -876,7 +876,7 @@ const (
func readDeploymentFromFile(t *testing.T, file string) []byte {
raw := readBytesFromFile(t, file)
obj := &extensionsv1beta1.Deployment{}
obj := &appsv1.Deployment{}
if err := runtime.DecodeInto(codec, raw, obj); err != nil {
t.Fatal(err)
}
@ -948,7 +948,7 @@ func TestApplyNULLPreservation(t *testing.T) {
cmd.Run(cmd, []string{})
expected := "deployment.extensions/" + deploymentName + "\n"
expected := "deployment.apps/" + deploymentName + "\n"
if buf.String() != expected {
t.Fatalf("unexpected output: %s\nexpected: %s", buf.String(), expected)
}

View File

@ -40,9 +40,9 @@ go_test(
"//pkg/kubectl/cmd/testing:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library",
"//pkg/kubectl/scheme:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/batch/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@ -401,7 +401,7 @@ func (o *DrainOptions) daemonsetFilter(pod corev1.Pod) (bool, *warning, *fatal)
return true, nil, nil
}
if _, err := o.client.ExtensionsV1beta1().DaemonSets(pod.Namespace).Get(controllerRef.Name, metav1.GetOptions{}); err != nil {
if _, err := o.client.AppsV1().DaemonSets(pod.Namespace).Get(controllerRef.Name, metav1.GetOptions{}); err != nil {
// remove orphaned pods with a warning if --force is used
if apierrors.IsNotFound(err) && o.Force {
return true, &warning{err.Error()}, nil

View File

@ -33,9 +33,9 @@ import (
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -294,13 +294,13 @@ func TestDrain(t *testing.T) {
},
}
ds := extensionsv1beta1.DaemonSet{
ds := appsv1.DaemonSet{
ObjectMeta: metav1.ObjectMeta{
Name: "ds",
Namespace: "default",
CreationTimestamp: metav1.Time{Time: time.Now()},
},
Spec: extensionsv1beta1.DaemonSetSpec{
Spec: appsv1.DaemonSetSpec{
Selector: &metav1.LabelSelector{MatchLabels: labels},
},
}
@ -313,7 +313,7 @@ func TestDrain(t *testing.T) {
Labels: labels,
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds",
BlockOwnerDeletion: boolptr(true),
@ -334,7 +334,7 @@ func TestDrain(t *testing.T) {
Labels: labels,
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds",
BlockOwnerDeletion: boolptr(true),
@ -358,7 +358,7 @@ func TestDrain(t *testing.T) {
Labels: labels,
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds",
BlockOwnerDeletion: boolptr(true),
@ -457,14 +457,14 @@ func TestDrain(t *testing.T) {
},
}
rs := extensionsv1beta1.ReplicaSet{
rs := appsv1.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
Name: "rs",
Namespace: "default",
CreationTimestamp: metav1.Time{Time: time.Now()},
Labels: labels,
},
Spec: extensionsv1beta1.ReplicaSetSpec{
Spec: appsv1.ReplicaSetSpec{
Selector: &metav1.LabelSelector{MatchLabels: labels},
},
}
@ -546,7 +546,7 @@ func TestDrain(t *testing.T) {
expected *corev1.Node
pods []corev1.Pod
rcs []corev1.ReplicationController
replicaSets []extensionsv1beta1.ReplicaSet
replicaSets []appsv1.ReplicaSet
args []string
expectWarning string
expectFatal bool
@ -648,7 +648,7 @@ func TestDrain(t *testing.T) {
node: node,
expected: cordonedNode,
pods: []corev1.Pod{rsPod},
replicaSets: []extensionsv1beta1.ReplicaSet{rs},
replicaSets: []appsv1.ReplicaSet{rs},
args: []string{"node"},
expectFatal: false,
expectDelete: true,
@ -776,7 +776,7 @@ func TestDrain(t *testing.T) {
case m.isFor("GET", "/namespaces/default/daemonsets/ds"):
return &http.Response{StatusCode: 200, Header: cmdtesting.DefaultHeader(), Body: cmdtesting.ObjBody(codec, &ds)}, nil
case m.isFor("GET", "/namespaces/default/daemonsets/missing-ds"):
return &http.Response{StatusCode: 404, Header: cmdtesting.DefaultHeader(), Body: cmdtesting.ObjBody(codec, &extensionsv1beta1.DaemonSet{})}, nil
return &http.Response{StatusCode: 404, Header: cmdtesting.DefaultHeader(), Body: cmdtesting.ObjBody(codec, &appsv1.DaemonSet{})}, nil
case m.isFor("GET", "/namespaces/default/jobs/job"):
return &http.Response{StatusCode: 200, Header: cmdtesting.DefaultHeader(), Body: cmdtesting.ObjBody(codec, &job)}, nil
case m.isFor("GET", "/namespaces/default/replicasets/rs"):
@ -1027,6 +1027,6 @@ func (m *MyReq) isFor(method string, path string) bool {
return method == req.Method && (req.URL.Path == path ||
req.URL.Path == strings.Join([]string{"/api/v1", path}, "") ||
req.URL.Path == strings.Join([]string{"/apis/extensions/v1beta1", path}, "") ||
req.URL.Path == strings.Join([]string{"/apis/apps/v1", path}, "") ||
req.URL.Path == strings.Join([]string{"/apis/batch/v1", path}, ""))
}

View File

@ -421,6 +421,7 @@ func (f *TestFactory) KubernetesClientSet() (*kubernetes.Clientset, error) {
clientset.StorageV1beta1().RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
clientset.AppsV1beta1().RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
clientset.AppsV1beta2().RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
clientset.AppsV1().RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
clientset.PolicyV1beta1().RESTClient().(*restclient.RESTClient).Client = fakeClient.Client
clientset.DiscoveryClient.RESTClient().(*restclient.RESTClient).Client = fakeClient.Client

View File

@ -24,6 +24,7 @@ import (
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/kube-openapi/pkg/util/proto/validation"
// This dependency is needed to register API types.
"k8s.io/kube-openapi/pkg/util/proto/testing"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/openapi"
@ -44,7 +45,7 @@ var _ = Describe("resource validation using OpenAPI Schema", func() {
It("finds Deployment in Schema and validates it", func() {
err := validator.ValidateBytes([]byte(`
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
@ -52,6 +53,9 @@ metadata:
name: name
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:

View File

@ -382,6 +382,92 @@ func TestMapBasedSelectorForObject(t *testing.T) {
expectErr: true,
},
// Node can not be exposed -- error
{
object: &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"foo": "bar",
},
},
},
},
expectSelector: "foo=bar",
},
{
object: &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{
{
Key: "foo",
},
},
},
},
},
expectErr: true,
},
{
object: &appsv1.ReplicaSet{
Spec: appsv1.ReplicaSetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{
"foo": "bar",
},
},
},
},
expectSelector: "foo=bar",
},
{
object: &appsv1.ReplicaSet{
Spec: appsv1.ReplicaSetSpec{
Selector: &metav1.LabelSelector{
MatchExpressions: []metav1.LabelSelectorRequirement{
{
Key: "foo",
},
},
},
},
},
expectErr: true,
},
{
object: &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Selector: nil,
},
},
expectErr: true,
},
{
object: &appsv1.Deployment{
Spec: appsv1.DeploymentSpec{
Selector: nil,
},
},
expectErr: true,
},
{
object: &appsv1.ReplicaSet{
Spec: appsv1.ReplicaSetSpec{
Selector: nil,
},
},
expectErr: true,
},
{
object: &appsv1.ReplicaSet{
Spec: appsv1.ReplicaSetSpec{
Selector: nil,
},
},
expectErr: true,
},
{
object: &corev1.Node{},
expectErr: true,

View File

@ -293,7 +293,7 @@ func (r *DaemonSetRollbacker) Rollback(obj runtime.Object, updatedAnnotations ma
}
// Restore revision
if _, err = r.c.ExtensionsV1beta1().DaemonSets(accessor.GetNamespace()).Patch(accessor.GetName(), types.StrategicMergePatchType, toHistory.Data.Raw); err != nil {
if _, err = r.c.AppsV1().DaemonSets(accessor.GetNamespace()).Patch(accessor.GetName(), types.StrategicMergePatchType, toHistory.Data.Raw); err != nil {
return "", fmt.Errorf("failed restoring revision %d: %v", toRevision, err)
}

View File

@ -29,8 +29,8 @@ go_test(
deps = [
"//pkg/apis/core:go_default_library",
"//pkg/kubeapiserver/admission:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",

View File

@ -21,8 +21,8 @@ import (
"strings"
"testing"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
extensionv1beta1 "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
@ -112,7 +112,7 @@ func newGCPermissionsEnforcement() (*gcPermissionsEnforcement, error) {
},
},
{
GroupVersion: extensionv1beta1.SchemeGroupVersion.String(),
GroupVersion: appsv1.SchemeGroupVersion.String(),
APIResources: []metav1.APIResource{
{Name: "daemonsets", Namespaced: true, Kind: "DaemonSet"},
},
@ -372,13 +372,13 @@ func TestBlockOwnerDeletionAdmission(t *testing.T) {
Name: "rc2",
}
blockDS1 := metav1.OwnerReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds1",
BlockOwnerDeletion: getTrueVar(),
}
notBlockDS1 := metav1.OwnerReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "DaemonSet",
Name: "ds1",
BlockOwnerDeletion: getFalseVar(),

View File

@ -34,7 +34,7 @@ func TestGroupVersionUnmarshalJSON(t *testing.T) {
expect GroupVersion
}{
{[]byte(`{"val": "v1"}`), GroupVersion{"", "v1"}},
{[]byte(`{"val": "extensions/v1beta1"}`), GroupVersion{"extensions", "v1beta1"}},
{[]byte(`{"val": "apps/v1"}`), GroupVersion{"apps", "v1"}},
}
for _, c := range cases {
@ -63,7 +63,7 @@ func TestGroupVersionMarshalJSON(t *testing.T) {
expect []byte
}{
{GroupVersion{"", "v1"}, []byte(`{"val":"v1"}`)},
{GroupVersion{"extensions", "v1beta1"}, []byte(`{"val":"extensions/v1beta1"}`)},
{GroupVersion{"apps", "v1"}, []byte(`{"val":"apps/v1"}`)},
}
for _, c := range cases {

View File

@ -66,7 +66,7 @@ func TestParseRuntimeConfig(t *testing.T) {
{
// version enabled by runtimeConfig override.
runtimeConfig: map[string]string{
"extensions/v1beta1": "",
"apps/v1": "",
},
defaultResourceConfig: func() *serverstore.ResourceConfig {
config := newFakeAPIResourceConfigSource()

View File

@ -183,7 +183,7 @@ run_deployment_tests() {
# Post-Condition: Deployment "nginx" is created.
kube::test::get_object_assert 'deploy test-nginx-extensions' "{{$container_name_field}}" 'nginx'
# and old generator was used, iow. old defaults are applied
output_message=$(kubectl get deployment.extensions/test-nginx-extensions -o jsonpath='{.spec.revisionHistoryLimit}')
output_message=$(kubectl get deployment.apps/test-nginx-extensions -o jsonpath='{.spec.revisionHistoryLimit}')
kube::test::if_has_not_string "${output_message}" '2'
# Ensure we can interact with deployments through extensions and apps endpoints
output_message=$(kubectl get deployment.extensions -o=jsonpath='{.items[0].apiVersion}' 2>&1 "${kube_flags[@]}")
@ -275,7 +275,7 @@ run_deployment_tests() {
# Clean up
# Note that we should delete hpa first, otherwise it may fight with the deployment reaper.
kubectl delete hpa nginx-deployment "${kube_flags[@]}"
kubectl delete deployment.extensions nginx-deployment "${kube_flags[@]}"
kubectl delete deployment.apps nginx-deployment "${kube_flags[@]}"
### Rollback a deployment
# Pre-condition: no deployment exists
@ -290,10 +290,10 @@ run_deployment_tests() {
kube::test::get_object_assert deployment "{{range.items}}{{$image_field0}}:{{end}}" "${IMAGE_DEPLOYMENT_R1}:"
# Update the deployment (revision 2)
kubectl apply -f hack/testdata/deployment-revision2.yaml "${kube_flags[@]}"
kube::test::get_object_assert deployment.extensions "{{range.items}}{{$image_field0}}:{{end}}" "${IMAGE_DEPLOYMENT_R2}:"
kube::test::get_object_assert deployment.apps "{{range.items}}{{$image_field0}}:{{end}}" "${IMAGE_DEPLOYMENT_R2}:"
# Rollback to revision 1 with dry-run - should be no-op
kubectl rollout undo deployment nginx --dry-run=true "${kube_flags[@]}" | grep "test-cmd"
kube::test::get_object_assert deployment.extensions "{{range.items}}{{$image_field0}}:{{end}}" "${IMAGE_DEPLOYMENT_R2}:"
kube::test::get_object_assert deployment.apps "{{range.items}}{{$image_field0}}:{{end}}" "${IMAGE_DEPLOYMENT_R2}:"
# Rollback to revision 1
kubectl rollout undo deployment nginx --to-revision=1 "${kube_flags[@]}"
sleep 1

View File

@ -268,10 +268,10 @@ run_recursive_resources_tests() {
kube::test::get_object_assert deployment "{{range.items}}{{$id_field}}:{{end}}" 'nginx:'
kube::test::get_object_assert deployment "{{range.items}}{{$image_field0}}:{{end}}" "${IMAGE_DEPLOYMENT_R1}:"
# Command
output_message=$(kubectl convert --local -f hack/testdata/deployment-revision1.yaml --output-version=apps/v1beta1 -o yaml "${kube_flags[@]}")
output_message=$(kubectl convert --local -f hack/testdata/deployment-revision1.yaml --output-version=apps/v1 -o yaml "${kube_flags[@]}")
# Post-condition: apiVersion is still extensions/v1beta1 in the live deployment, but command output is the new value
kube::test::get_object_assert 'deployment nginx' "{{ .apiVersion }}" 'extensions/v1beta1'
kube::test::if_has_string "${output_message}" "apps/v1beta1"
kube::test::if_has_string "${output_message}" "apps/v1"
# Clean up
kubectl delete deployment nginx "${kube_flags[@]}"

View File

@ -34,10 +34,10 @@ run_clusterroles_tests() {
kube::test::get_object_assert clusterrole/pod-admin "{{range.rules}}{{range.verbs}}{{.}}:{{end}}{{end}}" '\*:'
kube::test::get_object_assert clusterrole/pod-admin "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'pods:'
kube::test::get_object_assert clusterrole/pod-admin "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':'
kubectl create "${kube_flags[@]}" clusterrole resource-reader --verb=get,list --resource=pods,deployments.extensions
kubectl create "${kube_flags[@]}" clusterrole resource-reader --verb=get,list --resource=pods,deployments.apps
kube::test::get_object_assert clusterrole/resource-reader "{{range.rules}}{{range.verbs}}{{.}}:{{end}}{{end}}" 'get:list:get:list:'
kube::test::get_object_assert clusterrole/resource-reader "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'pods:deployments:'
kube::test::get_object_assert clusterrole/resource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':extensions:'
kube::test::get_object_assert clusterrole/resource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':apps:'
kubectl create "${kube_flags[@]}" clusterrole resourcename-reader --verb=get,list --resource=pods --resource-name=foo
kube::test::get_object_assert clusterrole/resourcename-reader "{{range.rules}}{{range.verbs}}{{.}}:{{end}}{{end}}" 'get:list:'
kube::test::get_object_assert clusterrole/resourcename-reader "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'pods:'
@ -124,10 +124,10 @@ run_role_tests() {
output_message=$(! kubectl create "${kube_flags[@]}" role invalid-pod-admin --verb=* --resource=invalid-resource 2>&1)
kube::test::if_has_string "${output_message}" "the server doesn't have a resource type \"invalid-resource\""
# Create Role from command (resource + group)
kubectl create "${kube_flags[@]}" role group-reader --verb=get,list --resource=deployments.extensions
kubectl create "${kube_flags[@]}" role group-reader --verb=get,list --resource=deployments.apps
kube::test::get_object_assert role/group-reader "{{range.rules}}{{range.verbs}}{{.}}:{{end}}{{end}}" 'get:list:'
kube::test::get_object_assert role/group-reader "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'deployments:'
kube::test::get_object_assert role/group-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" 'extensions:'
kube::test::get_object_assert role/group-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" 'apps:'
output_message=$(! kubectl create "${kube_flags[@]}" role invalid-group --verb=get,list --resource=deployments.invalid-group 2>&1)
kube::test::if_has_string "${output_message}" "the server doesn't have a resource type \"deployments\" in group \"invalid-group\""
# Create Role from command (resource / subresource)
@ -136,10 +136,10 @@ run_role_tests() {
kube::test::get_object_assert role/subresource-reader "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'pods/status:'
kube::test::get_object_assert role/subresource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':'
# Create Role from command (resource + group / subresource)
kubectl create "${kube_flags[@]}" role group-subresource-reader --verb=get,list --resource=replicasets.extensions/scale
kubectl create "${kube_flags[@]}" role group-subresource-reader --verb=get,list --resource=replicasets.apps/scale
kube::test::get_object_assert role/group-subresource-reader "{{range.rules}}{{range.verbs}}{{.}}:{{end}}{{end}}" 'get:list:'
kube::test::get_object_assert role/group-subresource-reader "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'replicasets/scale:'
kube::test::get_object_assert role/group-subresource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" 'extensions:'
kube::test::get_object_assert role/group-subresource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" 'apps:'
output_message=$(! kubectl create "${kube_flags[@]}" role invalid-group --verb=get,list --resource=rs.invalid-group/scale 2>&1)
kube::test::if_has_string "${output_message}" "the server doesn't have a resource type \"rs\" in group \"invalid-group\""
# Create Role from command (resource + resourcename)
@ -149,10 +149,10 @@ run_role_tests() {
kube::test::get_object_assert role/resourcename-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':'
kube::test::get_object_assert role/resourcename-reader "{{range.rules}}{{range.resourceNames}}{{.}}:{{end}}{{end}}" 'foo:'
# Create Role from command (multi-resources)
kubectl create "${kube_flags[@]}" role resource-reader --verb=get,list --resource=pods/status,deployments.extensions
kubectl create "${kube_flags[@]}" role resource-reader --verb=get,list --resource=pods/status,deployments.apps
kube::test::get_object_assert role/resource-reader "{{range.rules}}{{range.verbs}}{{.}}:{{end}}{{end}}" 'get:list:get:list:'
kube::test::get_object_assert role/resource-reader "{{range.rules}}{{range.resources}}{{.}}:{{end}}{{end}}" 'pods/status:deployments:'
kube::test::get_object_assert role/resource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':extensions:'
kube::test::get_object_assert role/resource-reader "{{range.rules}}{{range.apiGroups}}{{.}}:{{end}}{{end}}" ':apps:'
set +o nounset
set +o errexit

View File

@ -43,7 +43,7 @@ run_kubectl_run_tests() {
# Command
kubectl run nginx-extensions "--image=$IMAGE_NGINX" "${kube_flags[@]}"
# Post-Condition: Deployment "nginx" is created
kube::test::get_object_assert deployment.extensions "{{range.items}}{{$id_field}}:{{end}}" 'nginx-extensions:'
kube::test::get_object_assert deployment.apps "{{range.items}}{{$id_field}}:{{end}}" 'nginx-extensions:'
# new generator was used
output_message=$(kubectl get deployment.apps/nginx-extensions -o jsonpath='{.spec.revisionHistoryLimit}')
kube::test::if_has_string "${output_message}" '10'

View File

@ -36,7 +36,6 @@ go_library(
"//staging/src/k8s.io/api/batch/v1:go_default_library",
"//staging/src/k8s.io/api/batch/v1beta1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1beta1:go_default_library",
"//staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1:go_default_library",

View File

@ -21,10 +21,10 @@ import (
"sync/atomic"
"time"
apps "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
batchv1beta1 "k8s.io/api/batch/v1beta1"
"k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
apiextensionsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
apiextensionsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
apiextensionstestserver "k8s.io/apiextensions-apiserver/test/integration/fixtures"
@ -111,17 +111,17 @@ func getPodTemplateSpec(labels map[string]string) v1.PodTemplateSpec {
}
}
func newOwnerDeployment(f *framework.Framework, deploymentName string, labels map[string]string) *v1beta1.Deployment {
func newOwnerDeployment(f *framework.Framework, deploymentName string, labels map[string]string) *apps.Deployment {
replicas := int32(2)
return &v1beta1.Deployment{
return &apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: deploymentName,
},
Spec: v1beta1.DeploymentSpec{
Spec: apps.DeploymentSpec{
Replicas: &replicas,
Selector: &metav1.LabelSelector{MatchLabels: labels},
Strategy: v1beta1.DeploymentStrategy{
Type: v1beta1.RollingUpdateDeploymentStrategyType,
Strategy: apps.DeploymentStrategy{
Type: apps.RollingUpdateDeploymentStrategyType,
},
Template: getPodTemplateSpec(labels),
},
@ -185,7 +185,7 @@ func verifyRemainingObjects(f *framework.Framework, objects map[string]int) (boo
By(fmt.Sprintf("expected %d pods, got %d pods", num, len(pods.Items)))
}
case "Deployments":
deployments, err := f.ClientSet.ExtensionsV1beta1().Deployments(f.Namespace.Name).List(metav1.ListOptions{})
deployments, err := f.ClientSet.AppsV1().Deployments(f.Namespace.Name).List(metav1.ListOptions{})
if err != nil {
return false, fmt.Errorf("failed to list deployments: %v", err)
}
@ -194,7 +194,7 @@ func verifyRemainingObjects(f *framework.Framework, objects map[string]int) (boo
By(fmt.Sprintf("expected %d Deployments, got %d Deployments", num, len(deployments.Items)))
}
case "ReplicaSets":
rs, err := f.ClientSet.ExtensionsV1beta1().ReplicaSets(f.Namespace.Name).List(metav1.ListOptions{})
rs, err := f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).List(metav1.ListOptions{})
if err != nil {
return false, fmt.Errorf("failed to list rs: %v", err)
}
@ -480,8 +480,8 @@ var _ = SIGDescribe("Garbage collector", func() {
*/
framework.ConformanceIt("should delete RS created by deployment when not orphaning", func() {
clientSet := f.ClientSet
deployClient := clientSet.ExtensionsV1beta1().Deployments(f.Namespace.Name)
rsClient := clientSet.ExtensionsV1beta1().ReplicaSets(f.Namespace.Name)
deployClient := clientSet.AppsV1().Deployments(f.Namespace.Name)
rsClient := clientSet.AppsV1().ReplicaSets(f.Namespace.Name)
deploymentName := "simpletest.deployment"
uniqLabels := getUniqLabel("gctest", "delete_rs")
deployment := newOwnerDeployment(f, deploymentName, uniqLabels)
@ -539,8 +539,8 @@ var _ = SIGDescribe("Garbage collector", func() {
*/
framework.ConformanceIt("should orphan RS created by deployment when deleteOptions.PropagationPolicy is Orphan", func() {
clientSet := f.ClientSet
deployClient := clientSet.ExtensionsV1beta1().Deployments(f.Namespace.Name)
rsClient := clientSet.ExtensionsV1beta1().ReplicaSets(f.Namespace.Name)
deployClient := clientSet.AppsV1().Deployments(f.Namespace.Name)
rsClient := clientSet.AppsV1().ReplicaSets(f.Namespace.Name)
deploymentName := "simpletest.deployment"
uniqLabels := getUniqLabel("gctest", "orphan_rs")
deployment := newOwnerDeployment(f, deploymentName, uniqLabels)
@ -593,7 +593,7 @@ var _ = SIGDescribe("Garbage collector", func() {
aggregatedError := utilerrors.NewAggregate(errList)
framework.Failf("Failed to verify remaining deployments, rs, and pods: %v", aggregatedError)
}
rs, err := clientSet.ExtensionsV1beta1().ReplicaSets(f.Namespace.Name).List(metav1.ListOptions{})
rs, err := clientSet.AppsV1().ReplicaSets(f.Namespace.Name).List(metav1.ListOptions{})
if err != nil {
framework.Failf("Failed to list ReplicaSet %v", err)
}

View File

@ -25,8 +25,8 @@ import (
. "github.com/onsi/gomega"
"k8s.io/api/admissionregistration/v1alpha1"
apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
"k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
@ -242,7 +242,7 @@ var _ = SIGDescribe("Initializers [Feature:Initializers]", func() {
// create a replicaset
rs := newReplicaset()
persistedRS, err := c.ExtensionsV1beta1().ReplicaSets(ns).Create(rs)
persistedRS, err := c.AppsV1().ReplicaSets(ns).Create(rs)
Expect(err).NotTo(HaveOccurred(), "failed to create replicaset %s in namespace: %s", persistedRS.Name, ns)
// wait for replicaset controller to confirm that it has handled the creation
err = waitForRSObservedGeneration(c, persistedRS.Namespace, persistedRS.Name, persistedRS.Generation)
@ -250,7 +250,7 @@ var _ = SIGDescribe("Initializers [Feature:Initializers]", func() {
// update the replicaset spec to trigger a resync
patch := []byte(`{"spec":{"minReadySeconds":5}}`)
persistedRS, err = c.ExtensionsV1beta1().ReplicaSets(ns).Patch(persistedRS.Name, types.StrategicMergePatchType, patch)
persistedRS, err = c.AppsV1().ReplicaSets(ns).Patch(persistedRS.Name, types.StrategicMergePatchType, patch)
Expect(err).NotTo(HaveOccurred(), "failed to apply to replicaset %s in namespace %s a strategic merge patch: %s", persistedRS.Name, ns, patch)
// wait for replicaset controller to confirm that it has handle the spec update
@ -302,15 +302,15 @@ func newUninitializedPod(podName string) *v1.Pod {
return pod
}
func newReplicaset() *v1beta1.ReplicaSet {
func newReplicaset() *apps.ReplicaSet {
name := "initializer-test-replicaset"
replicas := int32(1)
labels := map[string]string{"initializer-test": "single-replicaset"}
return &v1beta1.ReplicaSet{
return &apps.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: v1beta1.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &replicas,
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
@ -411,7 +411,7 @@ func cleanupInitializer(c clientset.Interface, initializerConfigName, initialize
// waits till the RS status.observedGeneration matches metadata.generation.
func waitForRSObservedGeneration(c clientset.Interface, ns, name string, generation int64) error {
return wait.PollImmediate(1*time.Second, 1*time.Minute, func() (bool, error) {
rs, err := c.ExtensionsV1beta1().ReplicaSets(ns).Get(name, metav1.GetOptions{})
rs, err := c.AppsV1().ReplicaSets(ns).Get(name, metav1.GetOptions{})
if err != nil {
return false, err
}

View File

@ -22,8 +22,9 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
policy "k8s.io/api/policy/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
@ -310,12 +311,12 @@ func createReplicaSetOrDie(cs kubernetes.Interface, ns string, size int32, exclu
}
}
rs := &extensions.ReplicaSet{
rs := &apps.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
Name: "rs",
Namespace: ns,
},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &size,
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"foo": "bar"},
@ -331,6 +332,6 @@ func createReplicaSetOrDie(cs kubernetes.Interface, ns string, size int32, exclu
},
}
_, err := cs.ExtensionsV1beta1().ReplicaSets(ns).Create(rs)
_, err := cs.AppsV1().ReplicaSets(ns).Create(rs)
framework.ExpectNoError(err, "Creating replica set %q in namespace %q", rs.Name, ns)
}

View File

@ -19,9 +19,9 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e/autoscaling",
deps = [
"//pkg/apis/core:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v2beta1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/api/scheduling/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",

View File

@ -22,9 +22,9 @@ import (
"time"
gcm "google.golang.org/api/monitoring/v3"
appsv1 "k8s.io/api/apps/v1"
as "k8s.io/api/autoscaling/v2beta1"
corev1 "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/util/wait"
@ -219,7 +219,7 @@ type CustomMetricTestCase struct {
framework *framework.Framework
hpa *as.HorizontalPodAutoscaler
kubeClient clientset.Interface
deployment *extensions.Deployment
deployment *appsv1.Deployment
pod *corev1.Pod
initialReplicas int
scaledReplicas int
@ -282,9 +282,9 @@ func (tc *CustomMetricTestCase) Run() {
waitForReplicas(tc.deployment.ObjectMeta.Name, tc.framework.Namespace.ObjectMeta.Name, tc.kubeClient, 15*time.Minute, tc.scaledReplicas)
}
func createDeploymentToScale(f *framework.Framework, cs clientset.Interface, deployment *extensions.Deployment, pod *corev1.Pod) error {
func createDeploymentToScale(f *framework.Framework, cs clientset.Interface, deployment *appsv1.Deployment, pod *corev1.Pod) error {
if deployment != nil {
_, err := cs.Extensions().Deployments(f.Namespace.ObjectMeta.Name).Create(deployment)
_, err := cs.AppsV1().Deployments(f.Namespace.ObjectMeta.Name).Create(deployment)
if err != nil {
return err
}
@ -298,9 +298,9 @@ func createDeploymentToScale(f *framework.Framework, cs clientset.Interface, dep
return nil
}
func cleanupDeploymentsToScale(f *framework.Framework, cs clientset.Interface, deployment *extensions.Deployment, pod *corev1.Pod) {
func cleanupDeploymentsToScale(f *framework.Framework, cs clientset.Interface, deployment *appsv1.Deployment, pod *corev1.Pod) {
if deployment != nil {
_ = cs.Extensions().Deployments(f.Namespace.ObjectMeta.Name).Delete(deployment.ObjectMeta.Name, &metav1.DeleteOptions{})
_ = cs.AppsV1().Deployments(f.Namespace.ObjectMeta.Name).Delete(deployment.ObjectMeta.Name, &metav1.DeleteOptions{})
}
if pod != nil {
_ = cs.CoreV1().Pods(f.Namespace.ObjectMeta.Name).Delete(pod.ObjectMeta.Name, &metav1.DeleteOptions{})
@ -333,7 +333,7 @@ func podsHPA(namespace string, deploymentName string, metricTargets map[string]i
MaxReplicas: 3,
MinReplicas: &minReplicas,
ScaleTargetRef: as.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: deploymentName,
},
@ -365,7 +365,7 @@ func objectHPA(namespace string, metricTarget int64) *as.HorizontalPodAutoscaler
MaxReplicas: 3,
MinReplicas: &minReplicas,
ScaleTargetRef: as.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: dummyDeploymentName,
},
@ -424,7 +424,7 @@ func externalHPA(namespace string, metricTargets map[string]externalMetricTarget
MaxReplicas: 3,
MinReplicas: &minReplicas,
ScaleTargetRef: as.CrossVersionObjectReference{
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
Kind: "Deployment",
Name: dummyDeploymentName,
},
@ -437,7 +437,7 @@ func externalHPA(namespace string, metricTargets map[string]externalMetricTarget
func waitForReplicas(deploymentName, namespace string, cs clientset.Interface, timeout time.Duration, desiredReplicas int) {
interval := 20 * time.Second
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
deployment, err := cs.ExtensionsV1beta1().Deployments(namespace).Get(deploymentName, metav1.GetOptions{})
deployment, err := cs.AppsV1().Deployments(namespace).Get(deploymentName, metav1.GetOptions{})
if err != nil {
framework.Failf("Failed to get replication controller %s: %v", deployment, err)
}

View File

@ -292,7 +292,7 @@ func updateDNSScalingConfigMap(c clientset.Interface, configMap *v1.ConfigMap) e
func getDNSReplicas(c clientset.Interface) (int, error) {
label := labels.SelectorFromSet(labels.Set(map[string]string{ClusterAddonLabelKey: DNSLabelName}))
listOpts := metav1.ListOptions{LabelSelector: label.String()}
deployments, err := c.ExtensionsV1beta1().Deployments(metav1.NamespaceSystem).List(listOpts)
deployments, err := c.AppsV1().Deployments(metav1.NamespaceSystem).List(listOpts)
if err != nil {
return 0, err
}

View File

@ -340,14 +340,14 @@ func (rc *ResourceConsumer) GetReplicas() int {
}
return int(replicationController.Status.ReadyReplicas)
case KindDeployment:
deployment, err := rc.clientSet.ExtensionsV1beta1().Deployments(rc.nsName).Get(rc.name, metav1.GetOptions{})
deployment, err := rc.clientSet.AppsV1().Deployments(rc.nsName).Get(rc.name, metav1.GetOptions{})
framework.ExpectNoError(err)
if deployment == nil {
framework.Failf(deploymentIsNil)
}
return int(deployment.Status.ReadyReplicas)
case KindReplicaSet:
rs, err := rc.clientSet.ExtensionsV1beta1().ReplicaSets(rc.nsName).Get(rc.name, metav1.GetOptions{})
rs, err := rc.clientSet.AppsV1().ReplicaSets(rc.nsName).Get(rc.name, metav1.GetOptions{})
framework.ExpectNoError(err)
if rs == nil {
framework.Failf(rsIsNil)

View File

@ -6,6 +6,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e/framework/ingress",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",

View File

@ -34,9 +34,10 @@ import (
"strings"
"time"
compute "google.golang.org/api/compute/v1"
"k8s.io/klog"
compute "google.golang.org/api/compute/v1"
apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
@ -896,12 +897,12 @@ func generateBacksideHTTPSServiceSpec() *v1.Service {
}
}
func generateBacksideHTTPSDeploymentSpec() *extensions.Deployment {
return &extensions.Deployment{
func generateBacksideHTTPSDeploymentSpec() *apps.Deployment {
return &apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: "echoheaders-https",
},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{
"app": "echoheaders-https",
}},
@ -929,8 +930,8 @@ func generateBacksideHTTPSDeploymentSpec() *extensions.Deployment {
}
// SetUpBacksideHTTPSIngress sets up deployment, service and ingress with backside HTTPS configured.
func (j *IngressTestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, namespace string, staticIPName string) (*extensions.Deployment, *v1.Service, *extensions.Ingress, error) {
deployCreated, err := cs.ExtensionsV1beta1().Deployments(namespace).Create(generateBacksideHTTPSDeploymentSpec())
func (j *IngressTestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, namespace string, staticIPName string) (*apps.Deployment, *v1.Service, *extensions.Ingress, error) {
deployCreated, err := cs.AppsV1().Deployments(namespace).Create(generateBacksideHTTPSDeploymentSpec())
if err != nil {
return nil, nil, nil, err
}
@ -953,7 +954,7 @@ func (j *IngressTestJig) SetUpBacksideHTTPSIngress(cs clientset.Interface, names
}
// DeleteTestResource deletes given deployment, service and ingress.
func (j *IngressTestJig) DeleteTestResource(cs clientset.Interface, deploy *extensions.Deployment, svc *v1.Service, ing *extensions.Ingress) []error {
func (j *IngressTestJig) DeleteTestResource(cs clientset.Interface, deploy *apps.Deployment, svc *v1.Service, ing *extensions.Ingress) []error {
var errs []error
if ing != nil {
if err := j.runDelete(ing); err != nil {
@ -966,7 +967,7 @@ func (j *IngressTestJig) DeleteTestResource(cs clientset.Interface, deploy *exte
}
}
if deploy != nil {
if err := cs.ExtensionsV1beta1().Deployments(deploy.Namespace).Delete(deploy.Name, nil); err != nil {
if err := cs.AppsV1().Deployments(deploy.Namespace).Delete(deploy.Name, nil); err != nil {
errs = append(errs, fmt.Errorf("error while deleting deployment %s/%s: %v", deploy.Namespace, deploy.Name, err))
}
}

View File

@ -78,7 +78,7 @@ func PrivilegedPSP(name string) *policy.PodSecurityPolicy {
func IsPodSecurityPolicyEnabled(f *Framework) bool {
isPSPEnabledOnce.Do(func() {
psps, err := f.ClientSet.ExtensionsV1beta1().PodSecurityPolicies().List(metav1.ListOptions{})
psps, err := f.ClientSet.PolicyV1beta1().PodSecurityPolicies().List(metav1.ListOptions{})
if err != nil {
Logf("Error listing PodSecurityPolicies; assuming PodSecurityPolicy is disabled: %v", err)
isPSPEnabled = false
@ -103,7 +103,7 @@ func CreatePrivilegedPSPBinding(f *Framework, namespace string) {
}
// Create the privileged PSP & role
privilegedPSPOnce.Do(func() {
_, err := f.ClientSet.ExtensionsV1beta1().PodSecurityPolicies().Get(
_, err := f.ClientSet.PolicyV1beta1().PodSecurityPolicies().Get(
podSecurityPolicyPrivileged, metav1.GetOptions{})
if !apierrs.IsNotFound(err) {
// Privileged PSP was already created.

View File

@ -130,7 +130,7 @@ func NewReplicaSet(name, namespace string, replicas int32, podLabels map[string]
return &apps.ReplicaSet{
TypeMeta: metav1.TypeMeta{
Kind: "ReplicaSet",
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
},
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,

View File

@ -666,7 +666,7 @@ func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods, allowedN
replicaOk += rc.Status.ReadyReplicas
}
rsList, err := c.ExtensionsV1beta1().ReplicaSets(ns).List(metav1.ListOptions{})
rsList, err := c.AppsV1().ReplicaSets(ns).List(metav1.ListOptions{})
if err != nil {
Logf("Error getting replication sets in namespace %q: %v", ns, err)
if testutils.IsRetryableAPIError(err) {
@ -3092,11 +3092,11 @@ func getRuntimeObjectForKind(c clientset.Interface, kind schema.GroupKind, ns, n
case api.Kind("ReplicationController"):
return c.CoreV1().ReplicationControllers(ns).Get(name, metav1.GetOptions{})
case extensionsinternal.Kind("ReplicaSet"), appsinternal.Kind("ReplicaSet"):
return c.ExtensionsV1beta1().ReplicaSets(ns).Get(name, metav1.GetOptions{})
return c.AppsV1().ReplicaSets(ns).Get(name, metav1.GetOptions{})
case extensionsinternal.Kind("Deployment"), appsinternal.Kind("Deployment"):
return c.ExtensionsV1beta1().Deployments(ns).Get(name, metav1.GetOptions{})
return c.AppsV1().Deployments(ns).Get(name, metav1.GetOptions{})
case extensionsinternal.Kind("DaemonSet"):
return c.ExtensionsV1beta1().DaemonSets(ns).Get(name, metav1.GetOptions{})
return c.AppsV1().DaemonSets(ns).Get(name, metav1.GetOptions{})
case batchinternal.Kind("Job"):
return c.BatchV1().Jobs(ns).Get(name, metav1.GetOptions{})
default:
@ -3110,10 +3110,16 @@ func getSelectorFromRuntimeObject(obj runtime.Object) (labels.Selector, error) {
return labels.SelectorFromSet(typed.Spec.Selector), nil
case *extensions.ReplicaSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *apps.ReplicaSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *extensions.Deployment:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *apps.Deployment:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *extensions.DaemonSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *apps.DaemonSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *batch.Job:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
default:
@ -3133,13 +3139,25 @@ func getReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *apps.ReplicaSet:
if typed.Spec.Replicas != nil {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *extensions.Deployment:
if typed.Spec.Replicas != nil {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *apps.Deployment:
if typed.Spec.Replicas != nil {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *extensions.DaemonSet:
return 0, nil
case *apps.DaemonSet:
return 0, nil
case *batch.Job:
// TODO: currently we use pause pods so that's OK. When we'll want to switch to Pods
// that actually finish we need a better way to do this.

View File

@ -19,8 +19,8 @@ go_library(
],
importpath = "k8s.io/kubernetes/test/e2e/instrumentation/monitoring",
deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@ -20,13 +20,14 @@ import (
"fmt"
"strings"
"os/exec"
gcm "google.golang.org/api/monitoring/v3"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
rbac "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/test/e2e/framework"
"os/exec"
)
var (
@ -71,7 +72,7 @@ type CustomMetricContainerSpec struct {
// SimpleStackdriverExporterDeployment is a Deployment of simple application that exports a metric of
// fixed value to Stackdriver in a loop.
func SimpleStackdriverExporterDeployment(name, namespace string, replicas int32, metricValue int64) *extensions.Deployment {
func SimpleStackdriverExporterDeployment(name, namespace string, replicas int32, metricValue int64) *appsv1.Deployment {
return StackdriverExporterDeployment(name, namespace, replicas,
[]CustomMetricContainerSpec{
{
@ -86,18 +87,18 @@ func SimpleStackdriverExporterDeployment(name, namespace string, replicas int32,
// an arbitrary amount of metrics of fixed value to Stackdriver in a loop. Each metric
// is exposed by a different container in one pod.
// The metric names and values are configured via the containers parameter.
func StackdriverExporterDeployment(name, namespace string, replicas int32, containers []CustomMetricContainerSpec) *extensions.Deployment {
func StackdriverExporterDeployment(name, namespace string, replicas int32, containers []CustomMetricContainerSpec) *appsv1.Deployment {
podSpec := corev1.PodSpec{Containers: []corev1.Container{}}
for _, containerSpec := range containers {
podSpec.Containers = append(podSpec.Containers, stackdriverExporterContainerSpec(containerSpec.Name, namespace, containerSpec.MetricName, containerSpec.MetricValue))
}
return &extensions.Deployment{
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: extensions.DeploymentSpec{
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"name": name},
},
@ -175,13 +176,13 @@ func stackdriverExporterContainerSpec(name string, namespace string, metricName
// PrometheusExporterDeployment is a Deployment of simple application with two containers
// one exposing a metric in prometheus format and second a prometheus-to-sd container
// that scrapes the metric and pushes it to stackdriver.
func PrometheusExporterDeployment(name, namespace string, replicas int32, metricValue int64) *extensions.Deployment {
return &extensions.Deployment{
func PrometheusExporterDeployment(name, namespace string, replicas int32, metricValue int64) *appsv1.Deployment {
return &appsv1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: extensions.DeploymentSpec{
Spec: appsv1.DeploymentSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"name": name},
},

View File

@ -1424,7 +1424,7 @@ metadata:
By("running the image " + nginxImage)
framework.RunKubectlOrDie("run", dName, "--image="+nginxImage, "--generator=deployment/v1beta1", nsFlag)
By("verifying the deployment " + dName + " was created")
d, err := c.ExtensionsV1beta1().Deployments(ns).Get(dName, metav1.GetOptions{})
d, err := c.AppsV1().Deployments(ns).Get(dName, metav1.GetOptions{})
if err != nil {
framework.Failf("Failed getting deployment %s: %v", dName, err)
}

View File

@ -562,11 +562,11 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
It("should sync endpoints to NEG", func() {
name := "hostname"
scaleAndValidateNEG := func(num int) {
scale, err := f.ClientSet.ExtensionsV1beta1().Deployments(ns).GetScale(name, metav1.GetOptions{})
scale, err := f.ClientSet.AppsV1().Deployments(ns).GetScale(name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
if scale.Spec.Replicas != int32(num) {
scale.Spec.Replicas = int32(num)
_, err = f.ClientSet.ExtensionsV1beta1().Deployments(ns).UpdateScale(name, scale)
_, err = f.ClientSet.AppsV1().Deployments(ns).UpdateScale(name, scale)
Expect(err).NotTo(HaveOccurred())
}
wait.Poll(10*time.Second, ingress.NEGUpdateTimeout, func() (bool, error) {
@ -611,10 +611,10 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
Expect(usingNEG).To(BeTrue())
By(fmt.Sprintf("Scale backend replicas to %d", replicas))
scale, err := f.ClientSet.ExtensionsV1beta1().Deployments(ns).GetScale(name, metav1.GetOptions{})
scale, err := f.ClientSet.AppsV1().Deployments(ns).GetScale(name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
scale.Spec.Replicas = int32(replicas)
_, err = f.ClientSet.ExtensionsV1beta1().Deployments(ns).UpdateScale(name, scale)
_, err = f.ClientSet.AppsV1().Deployments(ns).UpdateScale(name, scale)
Expect(err).NotTo(HaveOccurred())
wait.Poll(10*time.Second, framework.LoadBalancerPollTimeout, func() (bool, error) {
res, err := jig.GetDistinctResponseFromIngress()
@ -625,17 +625,17 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
})
By("Trigger rolling update and observe service disruption")
deploy, err := f.ClientSet.ExtensionsV1beta1().Deployments(ns).Get(name, metav1.GetOptions{})
deploy, err := f.ClientSet.AppsV1().Deployments(ns).Get(name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
// trigger by changing graceful termination period to 60 seconds
gracePeriod := int64(60)
deploy.Spec.Template.Spec.TerminationGracePeriodSeconds = &gracePeriod
_, err = f.ClientSet.ExtensionsV1beta1().Deployments(ns).Update(deploy)
_, err = f.ClientSet.AppsV1().Deployments(ns).Update(deploy)
Expect(err).NotTo(HaveOccurred())
wait.Poll(10*time.Second, framework.LoadBalancerPollTimeout, func() (bool, error) {
res, err := jig.GetDistinctResponseFromIngress()
Expect(err).NotTo(HaveOccurred())
deploy, err := f.ClientSet.ExtensionsV1beta1().Deployments(ns).Get(name, metav1.GetOptions{})
deploy, err := f.ClientSet.AppsV1().Deployments(ns).Get(name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
if int(deploy.Status.UpdatedReplicas) == replicas {
if res.Len() == replicas {
@ -657,11 +657,11 @@ var _ = SIGDescribe("Loadbalancing: L7", func() {
expectedKeys := []int32{80, 443}
scaleAndValidateExposedNEG := func(num int) {
scale, err := f.ClientSet.ExtensionsV1beta1().Deployments(ns).GetScale(name, metav1.GetOptions{})
scale, err := f.ClientSet.AppsV1().Deployments(ns).GetScale(name, metav1.GetOptions{})
Expect(err).NotTo(HaveOccurred())
if scale.Spec.Replicas != int32(num) {
scale.Spec.Replicas = int32(num)
_, err = f.ClientSet.ExtensionsV1beta1().Deployments(ns).UpdateScale(name, scale)
_, err = f.ClientSet.AppsV1().Deployments(ns).UpdateScale(name, scale)
Expect(err).NotTo(HaveOccurred())
}
wait.Poll(10*time.Second, ingress.NEGUpdateTimeout, func() (bool, error) {

View File

@ -6,6 +6,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e/network/scale",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

View File

@ -22,6 +22,7 @@ import (
"sync"
"time"
apps "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -71,7 +72,7 @@ type IngressScaleFramework struct {
NumIngressesTest []int
OutputFile string
ScaleTestDeploy *extensions.Deployment
ScaleTestDeploy *apps.Deployment
ScaleTestSvcs []*v1.Service
ScaleTestIngs []*extensions.Ingress
@ -147,7 +148,7 @@ func (f *IngressScaleFramework) CleanupScaleTest() []error {
}
if f.ScaleTestDeploy != nil {
f.Logger.Infof("Cleaning up deployment %s...", f.ScaleTestDeploy.Name)
if err := f.Clientset.ExtensionsV1beta1().Deployments(f.ScaleTestDeploy.Namespace).Delete(f.ScaleTestDeploy.Name, nil); err != nil {
if err := f.Clientset.AppsV1().Deployments(f.ScaleTestDeploy.Namespace).Delete(f.ScaleTestDeploy.Name, nil); err != nil {
errs = append(errs, fmt.Errorf("Error while delting deployment %s/%s: %v", f.ScaleTestDeploy.Namespace, f.ScaleTestDeploy.Name, err))
}
}
@ -166,7 +167,7 @@ func (f *IngressScaleFramework) RunScaleTest() []error {
testDeploy := generateScaleTestBackendDeploymentSpec(scaleTestNumBackends)
f.Logger.Infof("Creating deployment %s...", testDeploy.Name)
testDeploy, err := f.Jig.Client.ExtensionsV1beta1().Deployments(f.Namespace).Create(testDeploy)
testDeploy, err := f.Jig.Client.AppsV1().Deployments(f.Namespace).Create(testDeploy)
if err != nil {
errs = append(errs, fmt.Errorf("Failed to create deployment %s: %v", testDeploy.Name, err))
return errs
@ -436,12 +437,12 @@ func generateScaleTestServiceSpec(suffix string) *v1.Service {
}
}
func generateScaleTestBackendDeploymentSpec(numReplicas int32) *extensions.Deployment {
return &extensions.Deployment{
func generateScaleTestBackendDeploymentSpec(numReplicas int32) *apps.Deployment {
return &apps.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: scaleTestBackendName,
},
Spec: extensions.DeploymentSpec{
Spec: apps.DeploymentSpec{
Replicas: &numReplicas,
Selector: &metav1.LabelSelector{MatchLabels: scaleTestLabels},
Template: v1.PodTemplateSpec{

View File

@ -29,7 +29,6 @@ go_library(
"//pkg/scheduler/api:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/scheduling/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",

View File

@ -20,8 +20,8 @@ import (
"fmt"
"time"
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/api/scheduling/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/resource"
@ -464,27 +464,27 @@ var _ = SIGDescribe("ResourceQuota", func() {
By("Ensuring resource quota status is calculated")
usedResources := v1.ResourceList{}
usedResources[v1.ResourceQuotas] = resource.MustParse("1")
usedResources[v1.ResourceName("count/replicasets.extensions")] = resource.MustParse("0")
usedResources[v1.ResourceName("count/replicasets.apps")] = resource.MustParse("0")
err = waitForResourceQuota(f.ClientSet, f.Namespace.Name, quotaName, usedResources)
Expect(err).NotTo(HaveOccurred())
By("Creating a ReplicaSet")
replicaSet := newTestReplicaSetForQuota("test-rs", "nginx", 0)
replicaSet, err = f.ClientSet.ExtensionsV1beta1().ReplicaSets(f.Namespace.Name).Create(replicaSet)
replicaSet, err = f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Create(replicaSet)
Expect(err).NotTo(HaveOccurred())
By("Ensuring resource quota status captures replicaset creation")
usedResources = v1.ResourceList{}
usedResources[v1.ResourceName("count/replicasets.extensions")] = resource.MustParse("1")
usedResources[v1.ResourceName("count/replicasets.apps")] = resource.MustParse("1")
err = waitForResourceQuota(f.ClientSet, f.Namespace.Name, quotaName, usedResources)
Expect(err).NotTo(HaveOccurred())
By("Deleting a ReplicaSet")
err = f.ClientSet.ExtensionsV1beta1().ReplicaSets(f.Namespace.Name).Delete(replicaSet.Name, nil)
err = f.ClientSet.AppsV1().ReplicaSets(f.Namespace.Name).Delete(replicaSet.Name, nil)
Expect(err).NotTo(HaveOccurred())
By("Ensuring resource quota status released usage")
usedResources[v1.ResourceName("count/replicasets.extensions")] = resource.MustParse("0")
usedResources[v1.ResourceName("count/replicasets.apps")] = resource.MustParse("0")
err = waitForResourceQuota(f.ClientSet, f.Namespace.Name, quotaName, usedResources)
Expect(err).NotTo(HaveOccurred())
})
@ -1351,7 +1351,7 @@ func newTestResourceQuota(name string) *v1.ResourceQuota {
hard[core.V1ResourceByStorageClass(classGold, v1.ResourcePersistentVolumeClaims)] = resource.MustParse("10")
hard[core.V1ResourceByStorageClass(classGold, v1.ResourceRequestsStorage)] = resource.MustParse("10Gi")
// test quota on discovered resource type
hard[v1.ResourceName("count/replicasets.extensions")] = resource.MustParse("5")
hard[v1.ResourceName("count/replicasets.apps")] = resource.MustParse("5")
// test quota on extended resource
hard[v1.ResourceName(v1.DefaultResourceRequestsPrefix+extendedResourceName)] = resource.MustParse("3")
return &v1.ResourceQuota{
@ -1453,14 +1453,15 @@ func newTestReplicationControllerForQuota(name, image string, replicas int32) *v
}
// newTestReplicaSetForQuota returns a simple replica set
func newTestReplicaSetForQuota(name, image string, replicas int32) *extensions.ReplicaSet {
func newTestReplicaSetForQuota(name, image string, replicas int32) *appsv1.ReplicaSet {
zero := int64(0)
return &extensions.ReplicaSet{
return &appsv1.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
Name: name,
},
Spec: extensions.ReplicaSetSpec{
Spec: appsv1.ReplicaSetSpec{
Replicas: &replicas,
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"name": name}},
Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"name": name},

View File

@ -41,7 +41,6 @@ go_library(
"//pkg/volume/util:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1beta1:go_default_library",
"//staging/src/k8s.io/api/storage/v1:go_default_library",

View File

@ -31,7 +31,6 @@ import (
appsv1 "k8s.io/api/apps/v1"
"k8s.io/api/core/v1"
extv1beta1 "k8s.io/api/extensions/v1beta1"
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
storagev1 "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/api/resource"
@ -1627,15 +1626,15 @@ func createProvisionerDaemonset(config *localTestConfig) {
provisionerPrivileged := true
mountProp := v1.MountPropagationHostToContainer
provisioner := &extv1beta1.DaemonSet{
provisioner := &appsv1.DaemonSet{
TypeMeta: metav1.TypeMeta{
Kind: "DaemonSet",
APIVersion: "extensions/v1beta1",
APIVersion: "apps/v1",
},
ObjectMeta: metav1.ObjectMeta{
Name: daemonSetName,
},
Spec: extv1beta1.DaemonSetSpec{
Spec: appsv1.DaemonSetSpec{
Selector: &metav1.LabelSelector{
MatchLabels: map[string]string{"app": "local-volume-provisioner"},
},
@ -1708,7 +1707,7 @@ func createProvisionerDaemonset(config *localTestConfig) {
},
},
}
_, err := config.client.ExtensionsV1beta1().DaemonSets(config.ns).Create(provisioner)
_, err := config.client.AppsV1().DaemonSets(config.ns).Create(provisioner)
Expect(err).NotTo(HaveOccurred())
kind := schema.GroupKind{Group: "extensions", Kind: "DaemonSet"}
@ -1732,12 +1731,12 @@ func findProvisionerDaemonsetPodName(config *localTestConfig) string {
}
func deleteProvisionerDaemonset(config *localTestConfig) {
ds, err := config.client.ExtensionsV1beta1().DaemonSets(config.ns).Get(daemonSetName, metav1.GetOptions{})
ds, err := config.client.AppsV1().DaemonSets(config.ns).Get(daemonSetName, metav1.GetOptions{})
if ds == nil {
return
}
err = config.client.ExtensionsV1beta1().DaemonSets(config.ns).Delete(daemonSetName, nil)
err = config.client.AppsV1().DaemonSets(config.ns).Delete(daemonSetName, nil)
Expect(err).NotTo(HaveOccurred())
err = wait.PollImmediate(time.Second, time.Minute, func() (bool, error) {

View File

@ -95,7 +95,7 @@ var _ = utils.SIGDescribe("Node Poweroff [Feature:vsphere] [Slow] [Disruptive]",
By("Creating a Deployment")
deployment, err := framework.CreateDeployment(client, int32(1), map[string]string{"test": "app"}, nil, namespace, pvclaims, "")
Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to create Deployment with err: %v", err))
defer client.ExtensionsV1beta1().Deployments(namespace).Delete(deployment.Name, &metav1.DeleteOptions{})
defer client.AppsV1().Deployments(namespace).Delete(deployment.Name, &metav1.DeleteOptions{})
By("Get pod from the deployement")
podList, err := framework.GetPodsForDeployment(client, deployment)

View File

@ -1,9 +1,13 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
spec:
replicas: 3
selector:
matchLabels:
app: guestbook
tier: frontend
template:
metadata:
labels:

View File

@ -1,9 +1,14 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-master
spec:
replicas: 1
selector:
matchLabels:
app: redis
role: master
tier: backend
template:
metadata:
labels:

View File

@ -1,9 +1,14 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-slave
spec:
replicas: 2
selector:
matchLabels:
app: redis
role: slave
tier: backend
template:
metadata:
labels:

View File

@ -1,9 +1,12 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: echoheaders
spec:
replicas: 1
selector:
matchLabels:
app: echoheaders
template:
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
@ -6,6 +6,9 @@ metadata:
name: hostname
spec:
minReadySeconds: 60
selector:
matchLabels:
run: hostname
template:
metadata:
labels:

View File

@ -1,10 +1,13 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
run: hostname
name: hostname
spec:
selector:
matchLabels:
run: hostname
template:
metadata:
labels:

View File

@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
@ -6,6 +6,9 @@ metadata:
name: hostname
spec:
minReadySeconds: 60
selector:
matchLabels:
run: hostname
template:
metadata:
labels:

View File

@ -25,6 +25,7 @@ go_library(
importpath = "k8s.io/kubernetes/test/e2e/upgrades",
deps = [
"//pkg/kubelet/sysctl:go_default_library",
"//staging/src/k8s.io/api/apps/v1:go_default_library",
"//staging/src/k8s.io/api/autoscaling/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",

Some files were not shown because too many files have changed in this diff Show More