Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Job operators to v1 #635

Merged
merged 2 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ required = [

[[constraint]]
name = "github.com/kubeflow/tf-operator"
version = "0.4.0"
version = "0.5.3"

[[constraint]]
name = "github.com/kubeflow/pytorch-operator"
version = "0.5.0-rc.1"
version = "0.5.1"

[[constraint]]
name = "github.com/awalterschulze/gographviz"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ Spec:
Value: 0
Worker Spec:
Go Template:
Raw Template: apiVersion: "kubeflow.org/v1beta1"
Raw Template: apiVersion: "kubeflow.org/v1"
kind: PyTorchJob
metadata:
name: {{.WorkerID}}
Expand Down
2 changes: 1 addition & 1 deletion examples/v1alpha1/pytorchjob-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
retain: true
goTemplate:
rawTemplate: |-
apiVersion: "kubeflow.org/v1beta1"
apiVersion: "kubeflow.org/v1"
kind: PyTorchJob
metadata:
name: {{.WorkerID}}
Expand Down
2 changes: 1 addition & 1 deletion examples/v1alpha1/tfjob-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
workerSpec:
goTemplate:
rawTemplate: |-
apiVersion: "kubeflow.org/v1beta1"
apiVersion: "kubeflow.org/v1"
kind: TFJob
metadata:
name: {{.WorkerID}}
Expand Down
2 changes: 1 addition & 1 deletion examples/v1alpha2/pytorchjob-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
retain: true
goTemplate:
rawTemplate: |-
apiVersion: "kubeflow.org/v1beta2"
apiVersion: "kubeflow.org/v1"
kind: PyTorchJob
metadata:
name: {{.Trial}}
Expand Down
2 changes: 1 addition & 1 deletion examples/v1alpha2/tfjob-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
retain: true
goTemplate:
rawTemplate: |-
apiVersion: "kubeflow.org/v1beta2"
apiVersion: "kubeflow.org/v1"
kind: TFJob
metadata:
name: {{.Trial}}
Expand Down
2 changes: 1 addition & 1 deletion manifests/v1alpha1/studyjobcontroller/pytorchjobsCrd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: pytorchjobs.kubeflow.org
spec:
group: kubeflow.org
version: v1beta1
version: v1
scope: Namespaced
names:
kind: PyTorchJob
Expand Down
2 changes: 1 addition & 1 deletion manifests/v1alpha1/studyjobcontroller/tfjobsCrd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: tfjobs.kubeflow.org
spec:
group: kubeflow.org
version: v1beta1
version: v1
scope: Namespaced
names:
kind: TFJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ limitations under the License.
package apis

import (
"github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1beta1"
"github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, v1beta1.SchemeBuilder.AddToScheme)
AddToSchemes = append(AddToSchemes, v1.SchemeBuilder.AddToScheme)
}
22 changes: 0 additions & 22 deletions pkg/api/operators/apis/addtoscheme_pytorchjob_v1beta1.go

This file was deleted.

22 changes: 0 additions & 22 deletions pkg/api/operators/apis/addtoscheme_pytorchjob_v1beta2.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ limitations under the License.
package apis

import (
"github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1beta2"
"github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1"
)

func init() {
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back
AddToSchemes = append(AddToSchemes, v1beta2.SchemeBuilder.AddToScheme)
AddToSchemes = append(AddToSchemes, v1.SchemeBuilder.AddToScheme)
}
4 changes: 2 additions & 2 deletions pkg/common/v1alpha2/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ func GetSupportedJobList() []schema.GroupVersionKind {
},
{
Group: "kubeflow.org",
Version: "v1beta2",
Version: "v1",
Kind: "TFJob",
},
{
Group: "kubeflow.org",
Version: "v1beta2",
Version: "v1",
Kind: "PyTorchJob",
},
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/controller/v1alpha1/studyjob/studyjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
katibv1alpha1 "github.com/kubeflow/katib/pkg/api/operators/apis/studyjob/v1alpha1"
katibapi "github.com/kubeflow/katib/pkg/api/v1alpha1"
common "github.com/kubeflow/katib/pkg/common/v1alpha1"
pytorchjobv1beta1 "github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1beta1"
commonv1beta1 "github.com/kubeflow/tf-operator/pkg/apis/common/v1beta1"
tfjobv1beta1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1beta1"
pytorchjobv1 "github.com/kubeflow/pytorch-operator/pkg/apis/pytorch/v1"
commonv1 "github.com/kubeflow/tf-operator/pkg/apis/common/v1"
tfjobv1 "github.com/kubeflow/tf-operator/pkg/apis/tensorflow/v1"

"google.golang.org/grpc"
"google.golang.org/grpc/codes"
Expand Down Expand Up @@ -116,7 +116,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
}

err = c.Watch(
&source.Kind{Type: &tfjobv1beta1.TFJob{}},
&source.Kind{Type: &tfjobv1.TFJob{}},
&handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &katibv1alpha1.StudyJob{},
Expand All @@ -125,7 +125,7 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
return err
}
err = c.Watch(
&source.Kind{Type: &pytorchjobv1beta1.PyTorchJob{}},
&source.Kind{Type: &pytorchjobv1.PyTorchJob{}},
&handler.EnqueueRequestForOwner{
IsController: true,
OwnerType: &katibv1alpha1.StudyJob{},
Expand Down Expand Up @@ -446,17 +446,17 @@ func (r *ReconcileStudyJobController) getJobWorkerStatus(ns string, wid string,

if ok {
statusMap := status.(map[string]interface{})
jobStatus := commonv1beta1.JobStatus{}
jobStatus := commonv1.JobStatus{}
err := runtime.DefaultUnstructuredConverter.FromUnstructured(statusMap, &jobStatus)
if err != nil {
klog.Errorf("Error in converting unstructured to status: %v ", err)
return WorkerStatus{}
}
if len(jobStatus.Conditions) > 0 {
lc := jobStatus.Conditions[len(jobStatus.Conditions)-1]
if lc.Type == commonv1beta1.JobSucceeded {
if lc.Type == commonv1.JobSucceeded {
state = katibapi.State_COMPLETED
} else if lc.Type == commonv1beta1.JobFailed {
} else if lc.Type == commonv1.JobFailed {
state = katibapi.State_ERROR
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func TestReconcileExperiment(t *testing.T) {
defer mockCtrl3.Finish()
generator := manifestmock.NewMockGenerator(mockCtrl)
generator.EXPECT().GetRunSpecWithHyperParameters(gomock.Any(), gomock.Any(),
gomock.Any(), gomock.Any(), gomock.Any()).Return(`apiVersion: "kubeflow.org/v1beta2"
gomock.Any(), gomock.Any(), gomock.Any()).Return(`apiVersion: "kubeflow.org/v1"
kind: "TFJob"
metadata:
name: "test"
Expand Down Expand Up @@ -287,7 +287,7 @@ func newFakeInstance() *experimentsv1alpha2.Experiment {
},
TrialTemplate: &experimentsv1alpha2.TrialTemplate{
GoTemplate: &experimentsv1alpha2.GoTemplate{
RawTemplate: `apiVersion: "kubeflow.org/v1beta2"
RawTemplate: `apiVersion: "kubeflow.org/v1"
kind: TFJob
metadata:
name: {{.Trial}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func init() {
}

func TestValidateTFJobTrialTemplate(t *testing.T) {
trialTFJobTemplate := `apiVersion: "kubeflow.org/v1beta1"
trialTFJobTemplate := `apiVersion: "kubeflow.org/v1"
kind: "TFJob"
metadata:
name: "dist-mnist-for-e2e-test"
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/v1alpha2/trial/trial_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ spec:
- "-mn"
- "test"
restartPolicy: Never`,
RunSpec: `apiVersion: "kubeflow.org/v1beta2"
RunSpec: `apiVersion: "kubeflow.org/v1"
kind: "TFJob"
metadata:
name: "test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: pytorchjobs.kubeflow.org
spec:
group: kubeflow.org
version: v1beta2
version: v1
scope: Namespaced
names:
kind: PyTorchJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: tfjobs.kubeflow.org
spec:
group: kubeflow.org
version: v1beta2
version: v1
scope: Namespaced
names:
kind: TFJob
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading