Skip to content
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
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ SCHEDULER_PLUGINS_VERSION?=$(shell go list -m -f "{{.Version}}" sigs.k8s.io/sche
VOLCANO_SCHEDULER_VERSION?=$(shell go list -m -f "{{.Version}}" volcano.sh/apis)
GOTOOLS_VERSION?=$(shell go list -m -f "{{.Version}}" golang.org/x/tools)
KIND_VERSION?=$(shell go list -m -f "{{.Version}}" sigs.k8s.io/kind)
GOLANGCI_LINT_VERSION?=$(shell go list -m -f "{{.Version}}" github.com/golangci/golangci-lint/v2)

CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true"

Expand Down Expand Up @@ -151,7 +152,7 @@ bin:
GOLANGCI_LINT = $(shell pwd)/bin/golangci-lint
.PHONY: bin/golangci-lint
bin/golangci-lint: bin
@GOBIN=$(PROJECT_DIR)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
@GOBIN=$(PROJECT_DIR)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest
Expand Down
221 changes: 203 additions & 18 deletions go.mod

Large diffs are not rendered by default.

554 changes: 514 additions & 40 deletions go.sum

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions hack/python-sdk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ func main() {
}

func swaggify(name string) string {
name = strings.Replace(name, "github.com/kubeflow/mpi-operator/pkg/apis/kubeflow/", "", -1)
name = strings.Replace(name, "github.com/kubernetes-sigs/kube-batch/pkg/client/clientset/", "", -1)
name = strings.Replace(name, "k8s.io/api/core/", "", -1)
name = strings.Replace(name, "k8s.io/apimachinery/pkg/apis/meta/", "", -1)
name = strings.Replace(name, "k8s.io/apimachinery/pkg/runtime/", "", -1)
name = strings.Replace(name, "k8s.io/apimachinery/pkg/api/", "", -1)
name = strings.Replace(name, "k8s.io/kubernetes/pkg/controller/", "", -1)
name = strings.Replace(name, "k8s.io/client-go/listers/core/", "", -1)
name = strings.Replace(name, "k8s.io/client-go/util/workqueue", "", -1)
name = strings.Replace(name, "/", ".", -1)
name = strings.ReplaceAll(name, "github.com/kubeflow/mpi-operator/pkg/apis/kubeflow/", "")
name = strings.ReplaceAll(name, "github.com/kubernetes-sigs/kube-batch/pkg/client/clientset/", "")
name = strings.ReplaceAll(name, "k8s.io/api/core/", "")
name = strings.ReplaceAll(name, "k8s.io/apimachinery/pkg/apis/meta/", "")
name = strings.ReplaceAll(name, "k8s.io/apimachinery/pkg/runtime/", "")
name = strings.ReplaceAll(name, "k8s.io/apimachinery/pkg/api/", "")
name = strings.ReplaceAll(name, "k8s.io/kubernetes/pkg/controller/", "")
name = strings.ReplaceAll(name, "k8s.io/client-go/listers/core/", "")
name = strings.ReplaceAll(name, "k8s.io/client-go/util/workqueue", "")
name = strings.ReplaceAll(name, "/", ".")
return name
}
1 change: 1 addition & 0 deletions hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package tools

import (
_ "github.com/golangci/golangci-lint/v2/cmd/golangci-lint"
_ "golang.org/x/tools/cmd/goimports"
_ "k8s.io/code-generator/cmd/client-gen"
_ "k8s.io/code-generator/cmd/deepcopy-gen"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/kubeflow/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func validateMPIJobName(job *kubeflow.MPIJob) field.ErrorList {
}
maximumPodHostname := fmt.Sprintf("%s-worker-%d", job.Name, replicas-1)
if errs := apimachineryvalidation.IsDNS1035Label(maximumPodHostname); len(errs) > 0 {
allErrs = append(allErrs, field.Invalid(field.NewPath("metadata").Child("name"), job.ObjectMeta.Name, fmt.Sprintf("will not able to create pod and service with invalid DNS label %q: %s", maximumPodHostname, strings.Join(errs, ", "))))
allErrs = append(allErrs, field.Invalid(field.NewPath("metadata").Child("name"), job.Name, fmt.Sprintf("will not able to create pod and service with invalid DNS label %q: %s", maximumPodHostname, strings.Join(errs, ", "))))
}
return allErrs
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/mpi_job_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ func (f *fixture) runController(ctx context.Context, mpiJobName string, startInf
// checkAction verifies that expected and actual actions are equal and both have
// same attached resources
func checkAction(expected, actual core.Action, t *testing.T) {
if !(expected.Matches(actual.GetVerb(), actual.GetResource().Resource) && actual.GetSubresource() == expected.GetSubresource()) {
if !expected.Matches(actual.GetVerb(), actual.GetResource().Resource) || actual.GetSubresource() != expected.GetSubresource() {
t.Errorf("Expected\n\t%#v\ngot\n\t%#v", expected, actual)
return
}
Expand Down
31 changes: 20 additions & 11 deletions test/e2e/mpi_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,10 @@ func waitForCompletion(ctx context.Context, mpiJob *kubeflow.MPIJob) *kubeflow.M
return mpiJob.Status.CompletionTime != nil, nil
})
if err != nil {
err := debugJob(ctx, mpiJob)
err = debugJob(ctx, mpiJob)
if err != nil {
fmt.Fprintf(ginkgo.GinkgoWriter, "Failed to debug job: %v\n", err)
_, err = fmt.Fprintf(ginkgo.GinkgoWriter, "Failed to debug job: %v\n", err)
gomega.Expect(err).ToNot(gomega.HaveOccurred())
}
}
gomega.Expect(err).ToNot(gomega.HaveOccurred())
Expand Down Expand Up @@ -650,20 +651,28 @@ func debugJob(ctx context.Context, mpiJob *kubeflow.MPIJob) error {
return nil
}

func podLogs(ctx context.Context, p *corev1.Pod) error {
func podLogs(ctx context.Context, p *corev1.Pod) (err error) {
req := k8sClient.CoreV1().Pods(p.Namespace).GetLogs(p.Name, &corev1.PodLogOptions{})
stream, err := req.Stream(ctx)
if err != nil {
return fmt.Errorf("reading logs: %v", err)
stream, streamErr := req.Stream(ctx)
if streamErr != nil {
err = fmt.Errorf("reading logs: %v", streamErr)
return
}
defer func() {
err = stream.Close()
}()
if _, err = fmt.Fprintf(ginkgo.GinkgoWriter, "== BEGIN %s pod logs ==\n", p.Name); err != nil {
return
}
defer stream.Close()
fmt.Fprintf(ginkgo.GinkgoWriter, "== BEGIN %s pod logs ==\n", p.Name)
_, err = io.Copy(ginkgo.GinkgoWriter, stream)
if err != nil {
return fmt.Errorf("writing logs: %v", err)
err = fmt.Errorf("writing logs: %v", err)
return
}
fmt.Fprintf(ginkgo.GinkgoWriter, "\n== END %s pod logs ==\n", p.Name)
return nil
if _, err = fmt.Fprintf(ginkgo.GinkgoWriter, "\n== END %s pod logs ==\n", p.Name); err != nil {
return
}
return
}

func expectConditionToBeTrue(mpiJob *kubeflow.MPIJob, condType kubeflow.JobConditionType) {
Expand Down
Loading