Skip to content

Commit

Permalink
Merge pull request #33 from bpineau/reduce_resync_interval
Browse files Browse the repository at this point in the history
Increase resync interval
  • Loading branch information
bpineau committed Apr 19, 2018
2 parents 4afbd65 + ee12452 commit 0db2752
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func init() {
RootCmd.PersistentFlags().IntVarP(&healthP, "healthcheck-port", "p", 0, "Port for answering healthchecks on /health url")
bindPFlag("healthcheck-port", "healthcheck-port")

RootCmd.PersistentFlags().IntVarP(&resync, "resync-interval", "i", 300, "Resync interval in seconds (0 to disable)")
RootCmd.PersistentFlags().IntVarP(&resync, "resync-interval", "i", 900, "Full resync interval in seconds (0 to disable)")
bindPFlag("resync-interval", "resync-interval")
}

Expand Down
14 changes: 7 additions & 7 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import (

var (
maxProcessRetry = 6
canaryKey = "$katafygio-canary"
canaryKey = "$katafygio canary$"
unexported = []string{"selfLink", "uid", "resourceVersion", "generation"}
)

// Interface describe a standard kubernetes controller
Expand Down Expand Up @@ -67,7 +68,7 @@ func New(client cache.ListerWatcher, notifier event.Notifier, name string, confi
informer := cache.NewSharedIndexInformer(
lw,
&unstructured.Unstructured{},
config.ResyncIntv,
config.ResyncIntv*time.Second,
cache.Indexers{},
)

Expand Down Expand Up @@ -193,12 +194,11 @@ func (c *Controller) processItem(key string) error {

// clear irrelevant attributes
uc := obj.UnstructuredContent()
md := uc["metadata"].(map[string]interface{})
delete(uc, "status")
delete(md, "selfLink")
delete(md, "uid")
delete(md, "resourceVersion")
delete(md, "generation")
md := uc["metadata"].(map[string]interface{})
for _, attr := range unexported {
delete(md, attr)
}

c.config.Logger.Debugf("Found %s/%s [%s]", obj.GetAPIVersion(), obj.GetKind(), key)

Expand Down

0 comments on commit 0db2752

Please sign in to comment.