Skip to content

Commit

Permalink
Add support for monitoring all node pools
Browse files Browse the repository at this point in the history
A new variable AllNodePools was introduced. Defaults to False. Once set
to true all node pools in the cluster will be monitored  and will get an
available static ip from the pool
Fixes #52
  • Loading branch information
avivl committed May 30, 2019
1 parent cfa5485 commit 8edd004
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions deploy/kubeip-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ data:
KUBEIP_FORCEASSIGNMENT: "true"
KUBEIP_ADDITIONALNODEPOOLS: ""
KUBEIP_TICKER: "5"
KUBEIP_ALLNODEPOOLS: "false"
kind: ConfigMap
metadata:
labels:
Expand Down
6 changes: 6 additions & 0 deletions deploy/kubeip-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ spec:
configMapKeyRef:
key: "KUBEIP_TICKER"
name: "kubeip-config"
- name: "KUBEIP_ALLNODEPOOLS"
valueFrom:
configMapKeyRef:
key: "KUBEIP_ALLNODEPOOLS"
name: "kubeip-config"



- name: GOOGLE_APPLICATION_CREDENTIALS
Expand Down
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Config struct {
ForceAssignment bool
AdditionalNodePools[] string
Ticker time.Duration
AllNodePools bool
}

func setConfigDefaults() {
Expand All @@ -44,6 +45,7 @@ func setConfigDefaults() {
viper.SetDefault("ForceAssignment", true)
viper.SetDefault("AdditionalNodePools", "")
viper.SetDefault("Ticker", 5)
viper.SetDefault("AllNodePools", false)
}

func NewConfig() (*Config, error) {
Expand All @@ -63,6 +65,7 @@ func NewConfig() (*Config, error) {
ForceAssignment: viper.GetBool("forceassignment"),
AdditionalNodePools: AdditionalNodePools,
Ticker: viper.GetDuration("ticker"),
AllNodePools: viper.GetBool("allnodepools"),
}
return &c, nil
}
3 changes: 3 additions & 0 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ func (c *Controller) processNextItem() bool {
}

func (c *Controller) isNodePollMonitored(pool string) bool {
if c.config.AllNodePools == true {
return true
}
if strings.ToLower(pool) == strings.ToLower(c.config.NodePool) {
return true
}
Expand Down

0 comments on commit 8edd004

Please sign in to comment.