experimental. -> extensions.
This commit is contained in:
@@ -880,7 +880,7 @@ func (d *JobDescriber) Describe(namespace, name string) (string, error) {
|
||||
return describeJob(job, events)
|
||||
}
|
||||
|
||||
func describeJob(job *experimental.Job, events *api.EventList) (string, error) {
|
||||
func describeJob(job *extensions.Job, events *api.EventList) (string, error) {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
fmt.Fprintf(out, "Name:\t%s\n", job.Name)
|
||||
fmt.Fprintf(out, "Namespace:\t%s\n", job.Namespace)
|
||||
@@ -928,7 +928,7 @@ func (d *DaemonSetDescriber) Describe(namespace, name string) (string, error) {
|
||||
return describeDaemonSet(daemon, events, running, waiting, succeeded, failed)
|
||||
}
|
||||
|
||||
func describeDaemonSet(daemon *experimental.DaemonSet, events *api.EventList, running, waiting, succeeded, failed int) (string, error) {
|
||||
func describeDaemonSet(daemon *extensions.DaemonSet, events *api.EventList, running, waiting, succeeded, failed int) (string, error) {
|
||||
return tabbedString(func(out io.Writer) error {
|
||||
fmt.Fprintf(out, "Name:\t%s\n", daemon.Name)
|
||||
if daemon.Spec.Template != nil {
|
||||
@@ -1448,7 +1448,7 @@ func (dd *DeploymentDescriber) Describe(namespace, name string) (string, error)
|
||||
// of getting all DS's and searching through them manually).
|
||||
// TODO: write an interface for controllers and fuse getReplicationControllersForLabels
|
||||
// and getDaemonSetsForLabels.
|
||||
func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.Labels) ([]experimental.DaemonSet, error) {
|
||||
func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.Labels) ([]extensions.DaemonSet, error) {
|
||||
// Get all daemon sets
|
||||
// TODO: this needs a namespace scope as argument
|
||||
dss, err := c.List(labels.Everything())
|
||||
@@ -1457,7 +1457,7 @@ func getDaemonSetsForLabels(c client.DaemonSetInterface, labelsToMatch labels.La
|
||||
}
|
||||
|
||||
// Find the ones that match labelsToMatch.
|
||||
var matchingDaemonSets []experimental.DaemonSet
|
||||
var matchingDaemonSets []extensions.DaemonSet
|
||||
for _, ds := range dss.Items {
|
||||
selector := labels.SelectorFromSet(ds.Spec.Selector)
|
||||
if selector.Matches(labelsToMatch) {
|
||||
|
||||
@@ -481,12 +481,12 @@ func TestPersistentVolumeDescriber(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDescribeDeployment(t *testing.T) {
|
||||
fake := testclient.NewSimpleFake(&experimental.Deployment{
|
||||
fake := testclient.NewSimpleFake(&extensions.Deployment{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "bar",
|
||||
Namespace: "foo",
|
||||
},
|
||||
Spec: experimental.DeploymentSpec{
|
||||
Spec: extensions.DeploymentSpec{
|
||||
Template: &api.PodTemplateSpec{},
|
||||
},
|
||||
})
|
||||
|
||||
@@ -723,7 +723,7 @@ func printReplicationControllerList(list *api.ReplicationControllerList, w io.Wr
|
||||
return nil
|
||||
}
|
||||
|
||||
func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printJob(job *extensions.Job, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
name := job.Name
|
||||
namespace := job.Namespace
|
||||
containers := job.Spec.Template.Spec.Containers
|
||||
@@ -766,7 +766,7 @@ func printJob(job *experimental.Job, w io.Writer, withNamespace bool, wide bool,
|
||||
return nil
|
||||
}
|
||||
|
||||
func printJobList(list *experimental.JobList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printJobList(list *extensions.JobList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
for _, job := range list.Items {
|
||||
if err := printJob(&job, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||
return err
|
||||
@@ -857,14 +857,14 @@ func printServiceList(list *api.ServiceList, w io.Writer, withNamespace bool, wi
|
||||
}
|
||||
|
||||
// backendStringer behaves just like a string interface and converts the given backend to a string.
|
||||
func backendStringer(backend *experimental.IngressBackend) string {
|
||||
func backendStringer(backend *extensions.IngressBackend) string {
|
||||
if backend == nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String())
|
||||
}
|
||||
|
||||
func printIngress(ingress *experimental.Ingress, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printIngress(ingress *extensions.Ingress, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
||||
name := ingress.Name
|
||||
namespace := ingress.Namespace
|
||||
|
||||
@@ -912,7 +912,7 @@ func printIngress(ingress *experimental.Ingress, w io.Writer, withNamespace, wid
|
||||
return nil
|
||||
}
|
||||
|
||||
func printIngressList(ingressList *experimental.IngressList, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printIngressList(ingressList *extensions.IngressList, w io.Writer, withNamespace, wide bool, showAll bool, columnLabels []string) error {
|
||||
for _, ingress := range ingressList.Items {
|
||||
if err := printIngress(&ingress, w, withNamespace, wide, true, columnLabels); err != nil {
|
||||
return err
|
||||
@@ -921,7 +921,7 @@ func printIngressList(ingressList *experimental.IngressList, w io.Writer, withNa
|
||||
return nil
|
||||
}
|
||||
|
||||
func printDaemonSet(ds *experimental.DaemonSet, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printDaemonSet(ds *extensions.DaemonSet, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
name := ds.Name
|
||||
namespace := ds.Namespace
|
||||
|
||||
@@ -966,7 +966,7 @@ func printDaemonSet(ds *experimental.DaemonSet, w io.Writer, withNamespace bool,
|
||||
return nil
|
||||
}
|
||||
|
||||
func printDaemonSetList(list *experimental.DaemonSetList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printDaemonSetList(list *extensions.DaemonSetList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
for _, ds := range list.Items {
|
||||
if err := printDaemonSet(&ds, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||
return err
|
||||
@@ -1330,7 +1330,7 @@ func printComponentStatusList(list *api.ComponentStatusList, w io.Writer, withNa
|
||||
return nil
|
||||
}
|
||||
|
||||
func printThirdPartyResource(rsrc *experimental.ThirdPartyResource, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printThirdPartyResource(rsrc *extensions.ThirdPartyResource, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
versions := make([]string, len(rsrc.Versions))
|
||||
for ix := range rsrc.Versions {
|
||||
version := &rsrc.Versions[ix]
|
||||
@@ -1343,7 +1343,7 @@ func printThirdPartyResource(rsrc *experimental.ThirdPartyResource, w io.Writer,
|
||||
return nil
|
||||
}
|
||||
|
||||
func printThirdPartyResourceList(list *experimental.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printThirdPartyResourceList(list *extensions.ThirdPartyResourceList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
for _, item := range list.Items {
|
||||
if err := printThirdPartyResource(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||
return err
|
||||
@@ -1353,7 +1353,7 @@ func printThirdPartyResourceList(list *experimental.ThirdPartyResourceList, w io
|
||||
return nil
|
||||
}
|
||||
|
||||
func printDeployment(deployment *experimental.Deployment, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printDeployment(deployment *extensions.Deployment, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
if withNamespace {
|
||||
if _, err := fmt.Fprintf(w, "%s\t", deployment.Namespace); err != nil {
|
||||
return err
|
||||
@@ -1369,7 +1369,7 @@ func printDeployment(deployment *experimental.Deployment, w io.Writer, withNames
|
||||
return err
|
||||
}
|
||||
|
||||
func printDeploymentList(list *experimental.DeploymentList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printDeploymentList(list *extensions.DeploymentList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
for _, item := range list.Items {
|
||||
if err := printDeployment(&item, w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||
return err
|
||||
@@ -1378,7 +1378,7 @@ func printDeploymentList(list *experimental.DeploymentList, w io.Writer, withNam
|
||||
return nil
|
||||
}
|
||||
|
||||
func printHorizontalPodAutoscaler(hpa *experimental.HorizontalPodAutoscaler, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printHorizontalPodAutoscaler(hpa *extensions.HorizontalPodAutoscaler, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
namespace := hpa.Namespace
|
||||
name := hpa.Name
|
||||
reference := fmt.Sprintf("%s/%s/%s/%s",
|
||||
@@ -1415,7 +1415,7 @@ func printHorizontalPodAutoscaler(hpa *experimental.HorizontalPodAutoscaler, w i
|
||||
return err
|
||||
}
|
||||
|
||||
func printHorizontalPodAutoscalerList(list *experimental.HorizontalPodAutoscalerList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
func printHorizontalPodAutoscalerList(list *extensions.HorizontalPodAutoscalerList, w io.Writer, withNamespace bool, wide bool, showAll bool, columnLabels []string) error {
|
||||
for i := range list.Items {
|
||||
if err := printHorizontalPodAutoscaler(&list.Items[i], w, withNamespace, wide, showAll, columnLabels); err != nil {
|
||||
return err
|
||||
|
||||
@@ -1236,22 +1236,22 @@ func TestTranslateTimestamp(t *testing.T) {
|
||||
|
||||
func TestPrintDeployment(t *testing.T) {
|
||||
tests := []struct {
|
||||
deployment experimental.Deployment
|
||||
deployment extensions.Deployment
|
||||
expect string
|
||||
}{
|
||||
{
|
||||
experimental.Deployment{
|
||||
extensions.Deployment{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: "test1",
|
||||
CreationTimestamp: unversioned.Time{Time: time.Now().Add(1.9e9)},
|
||||
},
|
||||
Spec: experimental.DeploymentSpec{
|
||||
Spec: extensions.DeploymentSpec{
|
||||
Replicas: 5,
|
||||
Template: &api.PodTemplateSpec{
|
||||
Spec: api.PodSpec{Containers: make([]api.Container, 2)},
|
||||
},
|
||||
},
|
||||
Status: experimental.DeploymentStatus{
|
||||
Status: extensions.DeploymentStatus{
|
||||
Replicas: 10,
|
||||
UpdatedReplicas: 2,
|
||||
},
|
||||
|
||||
@@ -83,7 +83,7 @@ func (precondition *ScalePrecondition) ValidateReplicationController(controller
|
||||
}
|
||||
|
||||
// ValidateJob ensures that the preconditions match. Returns nil if they are valid, an error otherwise
|
||||
func (precondition *ScalePrecondition) ValidateJob(job *experimental.Job) error {
|
||||
func (precondition *ScalePrecondition) ValidateJob(job *extensions.Job) error {
|
||||
if precondition.Size != -1 && job.Spec.Parallelism == nil {
|
||||
return PreconditionError{"parallelism", strconv.Itoa(precondition.Size), "nil"}
|
||||
}
|
||||
|
||||
@@ -53,17 +53,17 @@ type ErrorJobs struct {
|
||||
invalid bool
|
||||
}
|
||||
|
||||
func (c *ErrorJobs) Update(job *experimental.Job) (*experimental.Job, error) {
|
||||
func (c *ErrorJobs) Update(job *extensions.Job) (*extensions.Job, error) {
|
||||
if c.invalid {
|
||||
return nil, kerrors.NewInvalid(job.Kind, job.Name, nil)
|
||||
}
|
||||
return nil, errors.New("Job update failure")
|
||||
}
|
||||
|
||||
func (c *ErrorJobs) Get(name string) (*experimental.Job, error) {
|
||||
func (c *ErrorJobs) Get(name string) (*extensions.Job, error) {
|
||||
zero := 0
|
||||
return &experimental.Job{
|
||||
Spec: experimental.JobSpec{
|
||||
return &extensions.Job{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &zero,
|
||||
},
|
||||
}, nil
|
||||
@@ -325,7 +325,7 @@ func TestJobScale(t *testing.T) {
|
||||
if action, ok := actions[0].(testclient.GetAction); !ok || action.GetResource() != "jobs" || action.GetName() != name {
|
||||
t.Errorf("unexpected action: %v, expected get-replicationController %s", actions[0], name)
|
||||
}
|
||||
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "jobs" || *action.GetObject().(*experimental.Job).Spec.Parallelism != int(count) {
|
||||
if action, ok := actions[1].(testclient.UpdateAction); !ok || action.GetResource() != "jobs" || *action.GetObject().(*extensions.Job).Spec.Parallelism != int(count) {
|
||||
t.Errorf("unexpected action %v, expected update-job with parallelism = %d", actions[1], count)
|
||||
}
|
||||
}
|
||||
@@ -351,8 +351,8 @@ func TestJobScaleInvalid(t *testing.T) {
|
||||
|
||||
func TestJobScaleFailsPreconditions(t *testing.T) {
|
||||
ten := 10
|
||||
fake := testclient.NewSimpleFake(&experimental.Job{
|
||||
Spec: experimental.JobSpec{
|
||||
fake := testclient.NewSimpleFake(&extensions.Job{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &ten,
|
||||
},
|
||||
})
|
||||
@@ -375,7 +375,7 @@ func TestValidateJob(t *testing.T) {
|
||||
zero, ten, twenty := 0, 10, 20
|
||||
tests := []struct {
|
||||
preconditions ScalePrecondition
|
||||
job experimental.Job
|
||||
job extensions.Job
|
||||
expectError bool
|
||||
test string
|
||||
}{
|
||||
@@ -386,11 +386,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{-1, ""},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "foo",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &ten,
|
||||
},
|
||||
},
|
||||
@@ -399,11 +399,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{0, ""},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "foo",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &zero,
|
||||
},
|
||||
},
|
||||
@@ -412,11 +412,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{-1, "foo"},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "foo",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &ten,
|
||||
},
|
||||
},
|
||||
@@ -425,11 +425,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{10, "foo"},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "foo",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &ten,
|
||||
},
|
||||
},
|
||||
@@ -438,11 +438,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{10, "foo"},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "foo",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &twenty,
|
||||
},
|
||||
},
|
||||
@@ -451,7 +451,7 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{10, "foo"},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "foo",
|
||||
},
|
||||
@@ -461,11 +461,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{10, "foo"},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "bar",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &ten,
|
||||
},
|
||||
},
|
||||
@@ -474,11 +474,11 @@ func TestValidateJob(t *testing.T) {
|
||||
},
|
||||
{
|
||||
preconditions: ScalePrecondition{10, "foo"},
|
||||
job: experimental.Job{
|
||||
job: extensions.Job{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ResourceVersion: "bar",
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &twenty,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -286,23 +286,23 @@ func TestJobStop(t *testing.T) {
|
||||
{
|
||||
Name: "OnlyOneJob",
|
||||
Objs: []runtime.Object{
|
||||
&experimental.Job{ // GET
|
||||
&extensions.Job{ // GET
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: ns,
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &zero,
|
||||
Selector: map[string]string{"k1": "v1"}},
|
||||
},
|
||||
&experimental.JobList{ // LIST
|
||||
Items: []experimental.Job{
|
||||
&extensions.JobList{ // LIST
|
||||
Items: []extensions.Job{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: ns,
|
||||
},
|
||||
Spec: experimental.JobSpec{
|
||||
Spec: extensions.JobSpec{
|
||||
Parallelism: &zero,
|
||||
Selector: map[string]string{"k1": "v1"}},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user