Skip to content

Commit

Permalink
Allow more flexible way to config the api server addr in persistence …
Browse files Browse the repository at this point in the history
…agent (#867)

* Allow more flexible way to config the api server addr

* Remove namespace config from persistent-agent
  • Loading branch information
ywskycn authored and k8s-ci-robot committed Apr 24, 2019
1 parent f40a22a commit 982d94a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
7 changes: 3 additions & 4 deletions backend/src/agent/persistence/client/pipeline_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
)

const (
addressTemp = "%s.%s.svc.cluster.local:%s"
addressTemp = "%s:%s"
)

type PipelineClientInterface interface {
Expand All @@ -48,15 +48,14 @@ type PipelineClient struct {
}

func NewPipelineClient(
namespace string,
initializeTimeout time.Duration,
timeout time.Duration,
basePath string,
mlPipelineServiceName string,
mlPipelineServiceHttpPort string,
mlPipelineServiceGRPCPort string) (*PipelineClient, error) {
httpAddress := fmt.Sprintf(addressTemp, mlPipelineServiceName, namespace, mlPipelineServiceHttpPort)
grpcAddress := fmt.Sprintf(addressTemp, mlPipelineServiceName, namespace, mlPipelineServiceGRPCPort)
httpAddress := fmt.Sprintf(addressTemp, mlPipelineServiceName, mlPipelineServiceHttpPort)
grpcAddress := fmt.Sprintf(addressTemp, mlPipelineServiceName, mlPipelineServiceGRPCPort)
err := util.WaitForAPIAvailable(initializeTimeout, basePath, httpAddress)
if err != nil {
return nil, errors.Wrapf(err,
Expand Down
5 changes: 0 additions & 5 deletions backend/src/agent/persistence/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package main

import (
"flag"
"os"
"time"

workflowclientSet "github.com/argoproj/argo/pkg/client/clientset/versioned"
Expand All @@ -34,7 +33,6 @@ import (
var (
masterURL string
kubeconfig string
namespace string
initializeTimeout time.Duration
timeout time.Duration
mlPipelineAPIServerName string
Expand All @@ -47,7 +45,6 @@ var (
const (
kubeconfigFlagName = "kubeconfig"
masterFlagName = "master"
namespaceFlagName = "namespace"
initializationTimeoutFlagName = "initializeTimeout"
timeoutFlagName = "timeout"
mlPipelineAPIServerBasePathFlagName = "mlPipelineAPIServerBasePath"
Expand Down Expand Up @@ -81,7 +78,6 @@ func main() {
workflowInformerFactory := workflowinformers.NewSharedInformerFactory(workflowClient, time.Second*30)

pipelineClient, err := client.NewPipelineClient(
namespace,
initializeTimeout,
timeout,
mlPipelineAPIServerBasePath,
Expand Down Expand Up @@ -109,7 +105,6 @@ func main() {
func init() {
flag.StringVar(&kubeconfig, kubeconfigFlagName, "", "Path to a kubeconfig. Only required if out-of-cluster.")
flag.StringVar(&masterURL, masterFlagName, "", "The address of the Kubernetes API server. Overrides any value in kubeconfig. Only required if out-of-cluster.")
flag.StringVar(&namespace, namespaceFlagName, os.Getenv("POD_NAMESPACE"), "The namespace the ML pipeline API server is deployed to")
flag.DurationVar(&initializeTimeout, initializationTimeoutFlagName, 2*time.Minute, "Duration to wait for initialization of the ML pipeline API server.")
flag.DurationVar(&timeout, timeoutFlagName, 1*time.Minute, "Duration to wait for calls to complete.")
flag.StringVar(&mlPipelineAPIServerName, mlPipelineAPIServerNameFlagName, "ml-pipeline", "Name of the ML pipeline API server.")
Expand Down

0 comments on commit 982d94a

Please sign in to comment.