Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to specify informers namespace in persistence agent #901

Merged
merged 3 commits into from
May 6, 2019
Merged
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
14 changes: 12 additions & 2 deletions backend/src/agent/persistence/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ var (
mlPipelineAPIServerBasePath string
mlPipelineServiceHttpPort string
mlPipelineServiceGRPCPort string
namespace string
)

const (
Expand All @@ -51,6 +52,7 @@ const (
mlPipelineAPIServerNameFlagName = "mlPipelineAPIServerName"
mlPipelineAPIServerHttpPortFlagName = "mlPipelineServiceHttpPort"
mlPipelineAPIServerGRPCPortFlagName = "mlPipelineServiceGRPCPort"
namespaceFlagName = "namespace"
)

func main() {
Expand All @@ -74,8 +76,15 @@ func main() {
log.Fatalf("Error building workflow clientset: %s", err.Error())
}

swfInformerFactory := swfinformers.NewSharedInformerFactory(swfClient, time.Second*30)
workflowInformerFactory := workflowinformers.NewSharedInformerFactory(workflowClient, time.Second*30)
var swfInformerFactory swfinformers.SharedInformerFactory
var workflowInformerFactory workflowinformers.SharedInformerFactory
if namespace == "" {
swfInformerFactory = swfinformers.NewSharedInformerFactory(swfClient, time.Second*30)
workflowInformerFactory = workflowinformers.NewSharedInformerFactory(workflowClient, time.Second*30)
} else {
swfInformerFactory = swfinformers.NewFilteredSharedInformerFactory(swfClient, time.Second*30, namespace, nil)
workflowInformerFactory = workflowinformers.NewFilteredSharedInformerFactory(workflowClient, time.Second*30, namespace, nil)
}

pipelineClient, err := client.NewPipelineClient(
initializeTimeout,
Expand Down Expand Up @@ -112,4 +121,5 @@ func init() {
flag.StringVar(&mlPipelineServiceGRPCPort, mlPipelineAPIServerGRPCPortFlagName, "8887", "GRPC Port of the ML pipeline API server.")
flag.StringVar(&mlPipelineAPIServerBasePath, mlPipelineAPIServerBasePathFlagName,
"/apis/v1beta1", "The base path for the ML pipeline API server.")
flag.StringVar(&namespace, namespaceFlagName, "", "The namespace name used for Kubernetes informers to obtain the listers.")
}