diff --git a/executor/api/client/seldondeployment_client.go b/executor/api/client/seldondeployment_client.go deleted file mode 100644 index 6670f4458e..0000000000 --- a/executor/api/client/seldondeployment_client.go +++ /dev/null @@ -1,68 +0,0 @@ -package client - -import ( - "fmt" - "path/filepath" - - "github.com/go-logr/logr" - v1 "github.com/seldonio/seldon-core/operator/apis/machinelearning.seldon.io/v1" - clientset "github.com/seldonio/seldon-core/operator/client/machinelearning.seldon.io/v1/clientset/versioned/typed/machinelearning.seldon.io/v1" - v1meta "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/rest" - "k8s.io/client-go/tools/clientcmd" - "k8s.io/client-go/util/homedir" - logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" -) - -type SeldonDeploymentClient struct { - client *clientset.MachinelearningV1Client - Log logr.Logger -} - -func NewSeldonDeploymentClient(path *string) *SeldonDeploymentClient { - - var config *rest.Config - var err error - - if path != nil && *path != "" { - config, err = clientcmd.BuildConfigFromFlags("", *path) - if err != nil { - panic(err.Error()) - } - } else { - config, err = rest.InClusterConfig() - if err != nil { - if home := homedir.HomeDir(); home != "" { - homepath := filepath.Join(home, ".kube", "config") - config, err = clientcmd.BuildConfigFromFlags("", homepath) - if err != nil { - panic(err.Error()) - } - } - } - } - - kubeClientset, err := clientset.NewForConfig(config) - if err != nil { - panic(err.Error()) - } - - return &SeldonDeploymentClient{ - kubeClientset, - logf.Log.WithName("SeldonRestApi"), - } -} - -func (sd *SeldonDeploymentClient) GetPredictor(sdepName string, namespace string, predictorName string) (*v1.PredictorSpec, error) { - sdep, err := sd.client.SeldonDeployments(namespace).Get(sdepName, v1meta.GetOptions{}) - if err != nil { - return nil, err - } - for _, predictor := range sdep.Spec.Predictors { - if predictor.Name == predictorName { - return &predictor, nil - } - } - - return nil, fmt.Errorf("Failed to find predictor with name %s", predictorName) -} diff --git a/executor/go.mod b/executor/go.mod index 207047e2b4..755e792a8d 100644 --- a/executor/go.mod +++ b/executor/go.mod @@ -25,7 +25,6 @@ require ( gotest.tools v2.2.0+incompatible k8s.io/api v0.17.2 k8s.io/apimachinery v0.17.2 - k8s.io/client-go v0.17.2 sigs.k8s.io/controller-runtime v0.5.0 ) diff --git a/executor/main.go b/executor/main.go index 36ea50bb83..e3000d53c4 100644 --- a/executor/main.go +++ b/executor/main.go @@ -190,14 +190,6 @@ func main() { if err != nil { logger.Error(err, "Failed to get predictor from Env") panic(err) - } else if predictor == nil { - logger.Info("Trying to get predictor from API") - seldonDeploymentClient := seldonclient.NewSeldonDeploymentClient(configPath) - predictor, err = seldonDeploymentClient.GetPredictor(*sdepName, *namespace, *predictorName) - if err != nil { - logger.Error(err, "Failed to find predictor", "name", predictor) - panic(err) - } } }