MCPcopy Create free account
hub / github.com/apache/mesos / agentRegistration

Method agentRegistration

src/master/authorization.cpp:80–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79
80vector<ActionObject> ActionObject::agentRegistration(
81 const SlaveInfo& slaveInfo)
82{
83 vector<ActionObject> result;
84
85 if (!Resources(slaveInfo.resources()).reserved().empty()) {
86 // If static reservations exist, we also need to authorize them.
87 //
88 // NOTE: We don't look at dynamic reservations in checkpointed
89 // resources because they should have gone through authorization
90 // against the framework / operator's principal when they were
91 // created. In constrast, static reservations are initiated by the
92 // agent's principal and authorizing them helps prevent agents from
93 // advertising reserved resources of arbitrary roles.
94 Offer::Operation::Reserve reserve;
95 *reserve.mutable_resources() = slaveInfo.resources();
96 result = ActionObject::reserve(reserve);
97 }
98
99 result.push_back(ActionObject(authorization::REGISTER_AGENT, None()));
100 return result;
101}
102
103
104// Returns effective reservation role of resource for the purpose

Callers

nothing calls this directly

Calls 6

ActionObjectClass · 0.85
NoneClass · 0.85
ResourcesClass · 0.50
emptyMethod · 0.45
reservedMethod · 0.45
resourcesMethod · 0.45

Tested by

no test coverage detected