experimental. -> extensions.

This commit is contained in:
Chao Xu
2015-10-09 15:49:10 -07:00
parent 2816eb0f8a
commit 7c9f4cc42f
81 changed files with 839 additions and 839 deletions

View File

@@ -45,7 +45,7 @@ type JobController struct {
podControl controller.PodControlInterface
// To allow injection of updateJobStatus for testing.
updateHandler func(job *experimental.Job) error
updateHandler func(job *extensions.Job) error
syncHandler func(jobKey string) error
// podStoreSynced returns true if the pod store has been synced at least once.
// Added as a member to the struct to allow injection for testing.
@@ -92,13 +92,13 @@ func NewJobController(kubeClient client.Interface, resyncPeriod controller.Resyn
return jm.kubeClient.Experimental().Jobs(api.NamespaceAll).Watch(labels.Everything(), fields.Everything(), rv)
},
},
&experimental.Job{},
&extensions.Job{},
// TODO: Can we have much longer period here?
replicationcontroller.FullControllerResyncPeriod,
framework.ResourceEventHandlerFuncs{
AddFunc: jm.enqueueController,
UpdateFunc: func(old, cur interface{}) {
if job := cur.(*experimental.Job); !isJobFinished(job) {
if job := cur.(*extensions.Job); !isJobFinished(job) {
jm.enqueueController(job)
}
},
@@ -144,7 +144,7 @@ func (jm *JobController) Run(workers int, stopCh <-chan struct{}) {
}
// getPodJob returns the job managing the given pod.
func (jm *JobController) getPodJob(pod *api.Pod) *experimental.Job {
func (jm *JobController) getPodJob(pod *api.Pod) *extensions.Job {
jobs, err := jm.jobStore.GetPodJobs(pod)
if err != nil {
glog.V(4).Infof("No jobs found for pod %v, job controller will avoid syncing", pod.Name)
@@ -240,7 +240,7 @@ func (jm *JobController) deletePod(obj interface{}) {
}
}
// obj could be an *experimental.Job, or a DeletionFinalStateUnknown marker item.
// obj could be an *extensions.Job, or a DeletionFinalStateUnknown marker item.
func (jm *JobController) enqueueController(obj interface{}) {
key, err := controller.KeyFunc(obj)
if err != nil {
@@ -295,7 +295,7 @@ func (jm *JobController) syncJob(key string) error {
jm.queue.Add(key)
return err
}
job := *obj.(*experimental.Job)
job := *obj.(*extensions.Job)
if !jm.podStoreSynced() {
// Sleep so we give the pod reflector goroutine a chance to run.
time.Sleep(replicationcontroller.PodStoreSyncedPollPeriod)
@@ -345,9 +345,9 @@ func (jm *JobController) syncJob(key string) error {
return nil
}
func newCondition() experimental.JobCondition {
return experimental.JobCondition{
Type: experimental.JobComplete,
func newCondition() extensions.JobCondition {
return extensions.JobCondition{
Type: extensions.JobComplete,
Status: api.ConditionTrue,
LastProbeTime: unversioned.Now(),
LastTransitionTime: unversioned.Now(),
@@ -360,7 +360,7 @@ func getStatus(pods []api.Pod) (succeeded, failed int) {
return
}
func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *experimental.Job) int {
func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *extensions.Job) int {
var activeLock sync.Mutex
active := len(activePods)
parallelism := *job.Spec.Parallelism
@@ -430,7 +430,7 @@ func (jm *JobController) manageJob(activePods []*api.Pod, succeeded int, job *ex
return active
}
func (jm *JobController) updateJobStatus(job *experimental.Job) error {
func (jm *JobController) updateJobStatus(job *extensions.Job) error {
_, err := jm.kubeClient.Experimental().Jobs(job.Namespace).UpdateStatus(job)
return err
}
@@ -446,9 +446,9 @@ func filterPods(pods []api.Pod, phase api.PodPhase) int {
return result
}
func isJobFinished(j *experimental.Job) bool {
func isJobFinished(j *extensions.Job) bool {
for _, c := range j.Status.Conditions {
if c.Type == experimental.JobComplete && c.Status == api.ConditionTrue {
if c.Type == extensions.JobComplete && c.Status == api.ConditionTrue {
return true
}
}
@@ -456,7 +456,7 @@ func isJobFinished(j *experimental.Job) bool {
}
// byCreationTimestamp sorts a list by creation timestamp, using their names as a tie breaker.
type byCreationTimestamp []experimental.Job
type byCreationTimestamp []extensions.Job
func (o byCreationTimestamp) Len() int { return len(o) }
func (o byCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] }