kubeflow / common

Common APIs and libraries shared by other Kubeflow operator repositories.
Apache License 2.0
51 stars 73 forks source link

Kubeflow common for operators

Build Status Go Report Card

This repo contains the libraries for writing a custom job operators such as tf-operator and pytorch-operator. To write a custom operator, user need to do following steps

import (
    commonv1 "github.com/kubeflow/common/pkg/apis/common/v1"
)

// reuse commonv1 api in your type.go
RunPolicy *commonv1.RunPolicy                              `json:"runPolicy,omitempty"`
TestReplicaSpecs map[TestReplicaType]*commonv1.ReplicaSpec `json:"testReplicaSpecs"`

jobController := common.JobController { Controller: testJobController, Config: v1.JobControllerConfiguration{EnableGangScheduling: false}, Recorder: recorder, }

- Within you main reconcile loop, call the [JobController.ReconcileJobs](pkg/controller.v1/common/job.go) method.
```go
    reconcile(...) {
        // Your main reconcile loop.
        ...
        jobController.ReconcileJobs(...)
        ...
    }

Note that this repo is still under construction, API compatibility is not guaranteed at this point.

API Reference

Please refer to the API documentation.

The API files are located under pkg/apis/common/v1: