Skip to content

Commit

Permalink
Merge pull request #2 from AVENTER-UG/dev
Browse files Browse the repository at this point in the history
add: suppress offers if every service are running.
  • Loading branch information
andreaspeters authored Aug 23, 2021
2 parents 76fd3f7 + d4517f7 commit 910aa67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Add mesos-cli plugin
- Mesos-CLI: Show all running M3s frameworks
- Mesos-CLI: Get kubeconfig from a selected running m3s
- Add supress offers if every services are running

## v0.0.4

Expand Down
15 changes: 15 additions & 0 deletions mesos/mesos.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func Subscribe() error {
case mesosproto.Event_HEARTBEAT:
// K3S API Server Heatbeat
K3SHeartbeat()
suppressFramework()
case mesosproto.Event_OFFERS:
restartFailedContainer()
logrus.Debug("Offer Got: ", event.Offers.Offers[0].GetID())
Expand Down Expand Up @@ -221,6 +222,20 @@ func restartFailedContainer() {
}
}

// if all Tasks are running, suppress framework offers
func suppressFramework() {
if config.ETCDCount == config.ETCDMax &&
config.K3SServerCount == config.K3SServerMax &&
config.K3SAgentCount == config.K3SAgentMax {

logrus.Info("Framework Suppress")
suppress := &mesosproto.Call{
Type: mesosproto.Call_SUPPRESS,
}
Call(suppress)
}
}

/*
default:
// tell mesos he dont have to offer again until we ask
Expand Down

0 comments on commit 910aa67

Please sign in to comment.