Skip to content

Commit

Permalink
Merge pull request #351 from danielqsj/master
Browse files Browse the repository at this point in the history
Enable custom election id for status sync.
  • Loading branch information
aledbf authored Feb 27, 2017
2 parents 376519e + 2d526b2 commit fb8e2d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/pkg/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ type Configuration struct {
Backend ingress.Controller

UpdateStatus bool
ElectionID string
}

// newIngressController creates an Ingress controller
Expand Down Expand Up @@ -303,6 +304,7 @@ func newIngressController(config *Configuration) *GenericController {
Client: config.Client,
PublishService: ic.cfg.PublishService,
IngressLister: ic.ingLister,
ElectionID: config.ElectionID,
})
} else {
glog.Warning("Update of ingress status is disabled (flag --update-status=false was specified)")
Expand Down
3 changes: 3 additions & 0 deletions core/pkg/ingress/controller/launch.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ func NewIngressController(backend ingress.Controller) *GenericController {

updateStatus = flags.Bool("update-status", true, `Indicates if the
ingress controller should update the Ingress status IP/hostname. Default is true`)

electionID = flags.String("election-id", "ingress-controller-leader", `Election id to use for status update.`)
)

backend.OverrideFlags(flags)
Expand Down Expand Up @@ -137,6 +139,7 @@ func NewIngressController(backend ingress.Controller) *GenericController {

config := &Configuration{
UpdateStatus: *updateStatus,
ElectionID: *electionID,
Client: kubeClient,
ResyncPeriod: *resyncPeriod,
DefaultService: *defaultSvc,
Expand Down
3 changes: 2 additions & 1 deletion core/pkg/ingress/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type Config struct {
Client clientset.Interface
PublishService string
IngressLister cache_store.StoreToIngressLister
ElectionID string
}

// statusSync keeps the status IP in each Ingress rule updated executing a periodic check
Expand Down Expand Up @@ -171,7 +172,7 @@ func NewStatusSyncer(config Config) Sync {
}
st.syncQueue = task.NewCustomTaskQueue(st.sync, st.keyfunc)

le, err := NewElection("ingress-controller-leader",
le, err := NewElection(config.ElectionID,
pod.Name, pod.Namespace, 30*time.Second,
st.callback, config.Client)
if err != nil {
Expand Down

0 comments on commit fb8e2d7

Please sign in to comment.