Commit 26bcdb1b authored by Janet Kuo's avatar Janet Kuo

Separate GetOldRS and GetNewRS in deployment controller (get and mutate) and…

Separate GetOldRS and GetNewRS in deployment controller (get and mutate) and deployment util (get only)
parent d0437a16
...@@ -21,10 +21,13 @@ import ( ...@@ -21,10 +21,13 @@ import (
"time" "time"
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors" "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/apis/extensions" "k8s.io/kubernetes/pkg/apis/extensions"
unversionedextensions "k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned" unversionedextensions "k8s.io/kubernetes/pkg/client/typed/generated/extensions/unversioned"
errorsutil "k8s.io/kubernetes/pkg/util/errors" errorsutil "k8s.io/kubernetes/pkg/util/errors"
labelsutil "k8s.io/kubernetes/pkg/util/labels"
podutil "k8s.io/kubernetes/pkg/util/pod"
"k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/util/wait"
) )
...@@ -78,3 +81,13 @@ func UpdateRSWithRetries(rsClient unversionedextensions.ReplicaSetInterface, rs ...@@ -78,3 +81,13 @@ func UpdateRSWithRetries(rsClient unversionedextensions.ReplicaSetInterface, rs
// if the error is nil and rsUpdated is true, the returned RS contains the applied update. // if the error is nil and rsUpdated is true, the returned RS contains the applied update.
return rs, rsUpdated, err return rs, rsUpdated, err
} }
// GetPodTemplateSpecHash returns the pod template hash of a ReplicaSet's pod template space
func GetPodTemplateSpecHash(rs extensions.ReplicaSet) string {
meta := rs.Spec.Template.ObjectMeta
meta.Labels = labelsutil.CloneAndRemoveLabel(meta.Labels, extensions.DefaultDeploymentUniqueLabelKey)
return fmt.Sprintf("%d", podutil.GetPodTemplateSpecHash(api.PodTemplateSpec{
ObjectMeta: meta,
Spec: rs.Spec.Template.Spec,
}))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment