Promote SS to apps/v1

This commit is contained in:
dhilipkumars
2017-11-15 17:21:34 +05:30
parent ae96999b07
commit aba725a391
36 changed files with 200 additions and 152 deletions

View File

@@ -23,10 +23,10 @@ import (
"sort"
"strconv"
apps "k8s.io/api/apps/v1beta1"
appsinformers "k8s.io/client-go/informers/apps/v1beta1"
apps "k8s.io/api/apps/v1"
appsinformers "k8s.io/client-go/informers/apps/v1"
clientset "k8s.io/client-go/kubernetes"
appslisters "k8s.io/client-go/listers/apps/v1beta1"
appslisters "k8s.io/client-go/listers/apps/v1"
hashutil "k8s.io/kubernetes/pkg/util/hash"
apiequality "k8s.io/apimachinery/pkg/api/equality"
@@ -251,7 +251,7 @@ func (rh *realHistory) CreateControllerRevision(parent metav1.Object, revision *
hash := HashControllerRevision(revision, collisionCount)
// Update the revisions name and labels
clone.Name = ControllerRevisionName(parent.GetName(), hash)
created, err := rh.client.AppsV1beta1().ControllerRevisions(parent.GetNamespace()).Create(clone)
created, err := rh.client.AppsV1().ControllerRevisions(parent.GetNamespace()).Create(clone)
if errors.IsAlreadyExists(err) {
*collisionCount++
continue
@@ -267,7 +267,7 @@ func (rh *realHistory) UpdateControllerRevision(revision *apps.ControllerRevisio
return nil
}
clone.Revision = newRevision
updated, updateErr := rh.client.AppsV1beta1().ControllerRevisions(clone.Namespace).Update(clone)
updated, updateErr := rh.client.AppsV1().ControllerRevisions(clone.Namespace).Update(clone)
if updateErr == nil {
return nil
}
@@ -284,7 +284,7 @@ func (rh *realHistory) UpdateControllerRevision(revision *apps.ControllerRevisio
}
func (rh *realHistory) DeleteControllerRevision(revision *apps.ControllerRevision) error {
return rh.client.AppsV1beta1().ControllerRevisions(revision.Namespace).Delete(revision.Name, nil)
return rh.client.AppsV1().ControllerRevisions(revision.Namespace).Delete(revision.Name, nil)
}
func (rh *realHistory) AdoptControllerRevision(parent metav1.Object, parentKind schema.GroupVersionKind, revision *apps.ControllerRevision) (*apps.ControllerRevision, error) {
@@ -293,7 +293,7 @@ func (rh *realHistory) AdoptControllerRevision(parent metav1.Object, parentKind
return nil, fmt.Errorf("attempt to adopt revision owned by %v", owner)
}
// Use strategic merge patch to add an owner reference indicating a controller ref
return rh.client.AppsV1beta1().ControllerRevisions(parent.GetNamespace()).Patch(revision.GetName(),
return rh.client.AppsV1().ControllerRevisions(parent.GetNamespace()).Patch(revision.GetName(),
types.StrategicMergePatchType, []byte(fmt.Sprintf(
`{"metadata":{"ownerReferences":[{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`,
parentKind.GroupVersion().String(), parentKind.Kind,
@@ -302,7 +302,7 @@ func (rh *realHistory) AdoptControllerRevision(parent metav1.Object, parentKind
func (rh *realHistory) ReleaseControllerRevision(parent metav1.Object, revision *apps.ControllerRevision) (*apps.ControllerRevision, error) {
// Use strategic merge patch to add an owner reference indicating a controller ref
released, err := rh.client.AppsV1beta1().ControllerRevisions(revision.GetNamespace()).Patch(revision.GetName(),
released, err := rh.client.AppsV1().ControllerRevisions(revision.GetNamespace()).Patch(revision.GetName(),
types.StrategicMergePatchType,
[]byte(fmt.Sprintf(`{"metadata":{"ownerReferences":[{"$patch":"delete","uid":"%s"}],"uid":"%s"}}`, parent.GetUID(), revision.UID)))