Skip to content

Add namespace flag#78

Merged
stefanprodan merged 1 commit intofluxcd:masterfrom
huydinhle:namespace-watcher
Mar 6, 2019
Merged

Add namespace flag#78
stefanprodan merged 1 commit intofluxcd:masterfrom
huydinhle:namespace-watcher

Conversation

@huydinhle
Copy link
Copy Markdown
Contributor

@huydinhle huydinhle commented Mar 5, 2019

  • introduce the namespace flag for flagger to watch a single namespace for Canary Objects

Fix: #38

@stefanprodan

flaggerInformerFactory := informers.NewSharedInformerFactory(flaggerClient, time.Second*30)
var flaggerInformerFactory informers.SharedInformerFactory
logger.Infof("Flagger Canary 's Watcher is on namespace %s", namespace)
if namespace == "all" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the namespace is string empty then NewSharedInformerFactoryWithOptions will create an informer for all namespaces. Please replace the default all with "" and you can delete the if condition.

See https://github.com/kubernetes/client-go/blob/master/informers/factory.go#L110 and https://github.com/kubernetes/apimachinery/blob/master/pkg/apis/meta/v1/types.go#L294

metricsServer: "http://prometheus.istio-system.svc.cluster.local:9090"

# Namespace that flagger will watch for Canary objects
# namespace: default
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be namespace: ""

@stefanprodan stefanprodan changed the title Added Namespace Flag for Flagger Add namespace flag Mar 5, 2019
@huydinhle huydinhle force-pushed the namespace-watcher branch 2 times, most recently from 893a146 to d8cb8f1 Compare March 6, 2019 04:56
@huydinhle
Copy link
Copy Markdown
Contributor Author

@stefanprodan addressed the comments

- introduce the namespace flag for flagger to watch a single namespace
for Canary Objects
Copy link
Copy Markdown
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks @huydinhle

@stefanprodan stefanprodan merged commit a5d4382 into fluxcd:master Mar 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants