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

Enable custom election id for status sync. #351

Merged
merged 1 commit into from
Feb 27, 2017
Merged
Show file tree
Hide file tree
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
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