Skip to content

Commit 58b8442

Browse files
committed
Remove web hamdler. (Breaking change)
This change removes the support for HTTP Callbacs. This mechanism is deprecated and will be removed in futre Marathon releases. Breaking changes: * Remove `sse-enabled` and `web-enabled` flags Fixes: #253
1 parent b1c1ec5 commit 58b8442

10 files changed

+12
-334
lines changed

README.md

+8-14
Original file line numberDiff line numberDiff line change
@@ -98,23 +98,15 @@ your cert store might be different depending on your system.
9898
docker run '/etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt' -P allegro/marathon-consul
9999
```
100100

101-
## Setting up `marathon-consul` after installation
102-
103-
The Marathon [event bus](https://mesosphere.github.io/marathon/docs/event-bus.html) should point to [`/events`](#endpoints). You can set up the event subscription with a call similar to this one:
104-
```
105-
curl -X POST 'http://marathon.service.consul:8080/v2/eventSubscriptions?callbackUrl=http://marathon-consul.service.consul:4000/events'
106-
```
107-
The event subscription should be set to `localhost` to reduce network traffic.
108-
109101
## Usage
110102

111103
### Marathon masters
112104

113105
- marathon-consul should be installed on all Marathon masters
114106

115-
### Mesos slaves
107+
### Mesos agents
116108

117-
- Consul Agents should be available on every Mesos slave.
109+
- Consul Agents should be available on every Mesos agent.
118110
- Tasks will be registered at the Mesos slave they run on.
119111

120112
### Tagging tasks
@@ -236,15 +228,12 @@ sync-enabled | `true` | Enable Marathon-consul scheduled
236228
sync-force | `false` | Force leadership-independent Marathon-consul sync (run always)
237229
sync-interval | `15m0s` | Marathon-consul sync interval
238230
workers-pool-size | `10` | Number of concurrent workers processing events
239-
sse-enabled | `false` | Enable marathon-consul SSE on this node
240-
web-enabled | `true` | Enable marathon-consul Web callbacks on this node
241231

242232
### Endpoints
243233

244234
Endpoint | Description
245235
----------|------------------------------------------------------------------------------------
246236
`/health` | healthcheck - returns `OK`
247-
`/events` | event sink - returns `OK` if all keys are set in an event, error message otherwise
248237

249238
## Advanced usage
250239

@@ -322,14 +311,19 @@ reregister all healthy services managed by marathon-consul to the new format. Un
322311

323312
## SSE Support
324313

325-
In future callback interface between marathon and marathon-consul will be replaced by SSE.
326314
While using SSE please consider:
327315
- SSE is using Web module config for queues, event sizes, in the future will be moved to sse module,
328316
- SSE is using marathon-leader config for determining current leader, when this value match leader returned by marathon (/v2/leader endpoint)
329317
then SSE is started on this instance,
330318
- when enabled SSE is spawning its own own set of workers and separated dispatcher,
331319
- be advised to disable marathon callback subscription when enabling SSE, otherwise it might result in doubling registers and deregisers.
332320

321+
## HTTP callbacks support
322+
323+
Marathon-Consul does not support HTTP callbacks.
324+
Marathon [deprecated support for HTTP callbacks in 1.4](https://github.com/mesosphere/marathon/blob/master/changelog.md#deprecate-event-callback-subscriptions).
325+
This mechanism is no longer available starting from [Marathon 1.5](https://github.com/mesosphere/marathon/blob/master/changelog.md#event-subscribers-has-been-removed).
326+
333327
## Known limitations
334328

335329
The following section describes known limitations in `marathon-consul`.

config/config.go

-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ func (config *Config) parseFlags() {
8585
flag.IntVar(&config.Web.QueueSize, "events-queue-size", 1000, "Size of events queue")
8686
flag.IntVar(&config.Web.WorkersCount, "workers-pool-size", 10, "Number of concurrent workers processing events")
8787
flag.Int64Var(&config.Web.MaxEventSize, "event-max-size", 4096, "Maximum size of event to process (bytes)")
88-
flag.BoolVar(&config.Web.Enabled, "web-enabled", true, "Enable web events (callbacks).")
8988

9089
// SSE
91-
flag.BoolVar(&config.SSE.Enabled, "sse-enabled", false, "Enable sse event stream.")
9290

9391
// Sync
9492
flag.BoolVar(&config.Sync.Enabled, "sync-enabled", true, "Enable Marathon-consul scheduled sync")

config/config_test.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,8 @@ func TestConfig_ShouldBeMergedWithFileDefaultsAndFlags(t *testing.T) {
111111
QueueSize: 1000,
112112
WorkersCount: 10,
113113
MaxEventSize: 4096,
114-
Enabled: true,
115-
},
116-
SSE: sse.Config{
117-
Enabled: false,
118114
},
115+
SSE: sse.Config{},
119116
Sync: sync.Config{
120117
Interval: timeutil.Interval{Duration: 15 * time.Minute},
121118
Enabled: true,

debian/config.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
"Listen": ":4000",
2525
"QueueSize": 1000,
2626
"WorkersCount": 10,
27-
"MaxEventSize": 4096,
28-
"Enabled": true
27+
"MaxEventSize": 4096
2928
},
3029
"SSE": {
31-
"Enabled": false
3230
},
3331
"Sync": {
3432
"Enabled": true,

main.go

+2-8
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,13 @@ func main() {
4343

4444
sync.New(config.Sync, remote, consulInstance, consulInstance.AddAgentsFromApps).StartSyncServicesJob()
4545

46-
if config.SSE.Enabled {
46+
go func() {
4747
stopSSE, err := sse.NewHandler(config.SSE, config.Web, remote, consulInstance)
4848
if err != nil {
4949
log.WithError(err).Fatal("Cannot instantiate SSE handler")
5050
}
5151
defer stopSSE()
52-
}
53-
54-
if config.Web.Enabled {
55-
handler, stop := web.NewHandler(config.Web, remote, consulInstance)
56-
defer stop()
57-
http.HandleFunc("/events", handler)
58-
}
52+
}()
5953

6054
http.HandleFunc("/health", web.HealthHandler)
6155

sse/config.go

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package sse
22

33
type Config struct {
4-
Enabled bool
54
Retries int
65
RetryBackoff int
76
}

web/config.go

-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ type Config struct {
55
QueueSize int
66
WorkersCount int
77
MaxEventSize int64
8-
Enabled bool
98
}

web/web.go

-31
This file was deleted.

web/web_handler.go

-82
This file was deleted.

0 commit comments

Comments
 (0)