Skip to content

Commit

Permalink
Switch to apps/v1
Browse files Browse the repository at this point in the history
  • Loading branch information
liggitt committed May 6, 2019
1 parent 0be28ef commit 0ff3eaf
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import (
"fmt"
"strconv"

appsv1 "k8s.io/api/apps/v1"
batch "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -57,7 +57,7 @@ func ListRuntimeObjectsForKind(c clientset.Interface, kind, namespace, labelSele
}
case "ReplicaSet":
listFunc = func() error {
list, err := c.ExtensionsV1beta1().ReplicaSets(namespace).List(listOpts)
list, err := c.AppsV1().ReplicaSets(namespace).List(listOpts)
if err != nil {
return err
}
Expand All @@ -69,7 +69,7 @@ func ListRuntimeObjectsForKind(c clientset.Interface, kind, namespace, labelSele
}
case "Deployment":
listFunc = func() error {
list, err := c.ExtensionsV1beta1().Deployments(namespace).List(listOpts)
list, err := c.AppsV1().Deployments(namespace).List(listOpts)
if err != nil {
return err
}
Expand All @@ -81,7 +81,7 @@ func ListRuntimeObjectsForKind(c clientset.Interface, kind, namespace, labelSele
}
case "DaemonSet":
listFunc = func() error {
list, err := c.ExtensionsV1beta1().DaemonSets(namespace).List(listOpts)
list, err := c.AppsV1().DaemonSets(namespace).List(listOpts)
if err != nil {
return err
}
Expand Down Expand Up @@ -161,11 +161,11 @@ func GetSelectorFromRuntimeObject(obj runtime.Object) (labels.Selector, error) {
return getSelectorFromUnstrutured(typed)
case *corev1.ReplicationController:
return labels.SelectorFromSet(typed.Spec.Selector), nil
case *extensions.ReplicaSet:
case *appsv1.ReplicaSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *extensions.Deployment:
case *appsv1.Deployment:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *extensions.DaemonSet:
case *appsv1.DaemonSet:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
case *batch.Job:
return metav1.LabelSelectorAsSelector(typed.Spec.Selector)
Expand Down Expand Up @@ -215,11 +215,11 @@ func GetSpecFromRuntimeObject(obj runtime.Object) (interface{}, error) {
return getSpecFromUnstrutured(typed)
case *corev1.ReplicationController:
return typed.Spec, nil
case *extensions.ReplicaSet:
case *appsv1.ReplicaSet:
return typed.Spec, nil
case *extensions.Deployment:
case *appsv1.Deployment:
return typed.Spec, nil
case *extensions.DaemonSet:
case *appsv1.DaemonSet:
return typed.Spec, nil
case *batch.Job:
return typed.Spec, nil
Expand Down Expand Up @@ -253,17 +253,17 @@ func GetReplicasFromRuntimeObject(obj runtime.Object) (int32, error) {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *extensions.ReplicaSet:
case *appsv1.ReplicaSet:
if typed.Spec.Replicas != nil {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *extensions.Deployment:
case *appsv1.Deployment:
if typed.Spec.Replicas != nil {
return *typed.Spec.Replicas, nil
}
return 0, nil
case *extensions.DaemonSet:
case *appsv1.DaemonSet:
return 0, nil
case *batch.Job:
if typed.Spec.Parallelism != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
batch "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
extensions "k8s.io/api/extensions/v1beta1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -63,13 +62,13 @@ var replicationcontroller = &corev1.ReplicationController{
},
}

var replicaset = &extensions.ReplicaSet{
var replicaset = &apps.ReplicaSet{
ObjectMeta: metav1.ObjectMeta{
Name: controllerName,
Namespace: testNamespace,
ResourceVersion: defaultResourceVersion,
},
Spec: extensions.ReplicaSetSpec{
Spec: apps.ReplicaSetSpec{
Replicas: &defaultReplicas,
Selector: &metav1.LabelSelector{
MatchLabels: simpleLabel,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down
2 changes: 1 addition & 1 deletion dns/cluster/coredns-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: dns-perf-server
Expand Down
2 changes: 1 addition & 1 deletion dns/cluster/kube-dns-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: dns-perf-server
Expand Down
2 changes: 1 addition & 1 deletion perfdash/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: perfdash
Expand Down
2 changes: 1 addition & 1 deletion slo-monitor/slo-monitor-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Deployment config for performance monitor. To be used when deploying in on the cluster.
# RBAC: requires view access to Pods and Events.
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: slo-monitor
Expand Down

0 comments on commit 0ff3eaf

Please sign in to comment.