From b9075c2a121699133b3df63312c70ac23198a97c Mon Sep 17 00:00:00 2001 From: Andrey Velichkevich Date: Fri, 13 Nov 2020 14:54:24 +0000 Subject: [PATCH] Remove new Trial kind doc (#1388) --- docs/developer-guide.md | 5 --- docs/new-trial-kind.md | 83 ----------------------------------------- 2 files changed, 88 deletions(-) delete mode 100644 docs/new-trial-kind.md diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 73e8740d2d8..4fc2857fa98 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -7,7 +7,6 @@ - [Modify controller APIs](#modify-controller-apis) - [Workflow design](#workflow-design) - [Implement a new algorithm and use it in Katib](#implement-a-new-algorithm-and-use-it-in-katib) - - [Create a new Trial kind](#create-a-new-trial-kind) - [Algorithm settings documentation](#algorithm-settings-documentation) - [Katib UI documentation](#katib-ui-documentation) - [Design proposals](#design-proposals) @@ -70,10 +69,6 @@ Please see [workflow-design.md](./workflow-design.md). Please see [new-algorithm-service.md](./new-algorithm-service.md). -## Create a new Trial kind - -Please see [new-trial-kind.md](./new-trial-kind.md). - ## Algorithm settings documentation Please see [algorithm-settings.md](./algorithm-settings.md). diff --git a/docs/new-trial-kind.md b/docs/new-trial-kind.md deleted file mode 100644 index 656c306360e..00000000000 --- a/docs/new-trial-kind.md +++ /dev/null @@ -1,83 +0,0 @@ -# Document about how to support a new Kubernetes resource in Katib trial - -TODO (andreyvelich): Needs to be updated for v1beta1. - -## Update the supported list - -First, `GetSupportedJobList` in [common.go](../pkg/common/v1alpha3/common.go) needs to be updated. - -```go -func GetSupportedJobList() []schema.GroupVersionKind { - supportedJobList := []schema.GroupVersionKind{ - { - Group: "batch", - Version: "v1", - Kind: "Job", - }, - { - Group: "kubeflow.org", - Version: "v1", - Kind: "TFJob", - }, - { - Group: "kubeflow.org", - Version: "v1", - Kind: "PyTorchJob", - }, - } - return supportedJobList -} -``` - -In this function, we define the Kubernetes `GroupVersionKind` that are supported in Katib. If you want to add a new kind, please append the `supportedJobList`. - -## Update logic about status update - -`GetDeployedJobStatus` in [trial_controller_util.go](../pkg/controller.v1alpha3/trial/trial_controller_util.go) needs to be updated. - -It is used to determine if the trial is completed (Succeeded or Failed). - -## Update logic about pod injection webhook - -### Add logic to support mutating container - -`isWorkerContainer` in [inject_webhook.go](../pkg/webhook/v1alpha3/pod/inject_webhook.go) needs to be updated. - -```go -func isWorkerContainer(jobKind string, index int, c v1.Container) bool { - switch jobKind { - case BatchJob: - if index == 0 { - // for Job worker, the first container will be taken as worker container, - // katib document should note it - return true - } - case TFJob: - if c.Name == TFJobWorkerContainerName { - return true - } - case PyTorchJob: - if c.Name == PyTorchJobWorkerContainerName { - return true - } - default: - log.Info("Invalid Katib worker kind", "JobKind", jobKind) - return false - } - return false -} -``` - -The function is used to determine which container in the job is the actual main container. - -### Add logic about how to determine the master pod - -In Katib, we only inject metrics collector sidecar into the master pod (See [metrics-collector.md](./proposals/metrics-collector.md) for more details). Thus we need to update the `JobRoleMap` in [const.go](../pkg/webhook/v1alpha3/pod/const.go). - -```go -var JobRoleMap = map[string][]string{ - "TFJob": {JobRoleLabel, TFJobRoleLabel}, - "PyTorchJob": {JobRoleLabel, PyTorchJobRoleLabel}, - "Job": {}, -} -``` \ No newline at end of file