Skip to content

Commit 910aa67

Browse files
Merge pull request #2 from AVENTER-UG/dev
add: suppress offers if every service are running.
2 parents 76fd3f7 + d4517f7 commit 910aa67

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Add mesos-cli plugin
3030
- Mesos-CLI: Show all running M3s frameworks
3131
- Mesos-CLI: Get kubeconfig from a selected running m3s
32+
- Add supress offers if every services are running
3233

3334
## v0.0.4
3435

mesos/mesos.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func Subscribe() error {
112112
case mesosproto.Event_HEARTBEAT:
113113
// K3S API Server Heatbeat
114114
K3SHeartbeat()
115+
suppressFramework()
115116
case mesosproto.Event_OFFERS:
116117
restartFailedContainer()
117118
logrus.Debug("Offer Got: ", event.Offers.Offers[0].GetID())
@@ -221,6 +222,20 @@ func restartFailedContainer() {
221222
}
222223
}
223224

225+
// if all Tasks are running, suppress framework offers
226+
func suppressFramework() {
227+
if config.ETCDCount == config.ETCDMax &&
228+
config.K3SServerCount == config.K3SServerMax &&
229+
config.K3SAgentCount == config.K3SAgentMax {
230+
231+
logrus.Info("Framework Suppress")
232+
suppress := &mesosproto.Call{
233+
Type: mesosproto.Call_SUPPRESS,
234+
}
235+
Call(suppress)
236+
}
237+
}
238+
224239
/*
225240
default:
226241
// tell mesos he dont have to offer again until we ask

0 commit comments

Comments
 (0)