Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

global units: do some agent-level validation #811

Merged
merged 1 commit into from
Sep 2, 2014

Conversation

jonboulle
Copy link
Contributor

When launching global units, the agent should perform a minimal amount of validation to ensure it can actually run the unit. This should probably be nothing more than checking for metadata requirements. Specifically, any other kind of scheduling requirements (like Peers or Conflicts) are NOT supported.

Related: #659

@jonboulle
Copy link
Contributor Author

Also related: #494

@bcwaldon bcwaldon added this to the v0.8.0 milestone Aug 25, 2014
@jonboulle jonboulle self-assigned this Aug 28, 2014
@jonboulle jonboulle force-pushed the 811_agent_global_validation branch 3 times, most recently from e0fa603 to ebd69fa Compare September 2, 2014 19:43
@@ -126,6 +127,11 @@ func desiredAgentState(a *Agent, reg registry.Registry) (*AgentState, error) {

for _, u := range units {
u := u
md := u.RequiredTargetMetadata()
if u.IsGlobal() && !machine.HasMetadata(&ms, md) {
log.Infof("Agent unable to run global unit %s: missing required metadata %v", u.Name, md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md in the output is actually going to be a potentially cumbersome map. If you want to log this, we should first be able to identify what specific key caused the mismatch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and this probably should not be logged at Infof. How about V(1).Infof?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just going to omit it because HasMetadata already does its own verbose logging.

@jonboulle jonboulle force-pushed the 811_agent_global_validation branch from 14ac320 to ca6464e Compare September 2, 2014 21:57
@jonboulle
Copy link
Contributor Author

Updated

}

func TestDesiredAgentState(t *testing.T) {
testCases := []struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gorgeous test cases.

@bcwaldon
Copy link
Contributor

bcwaldon commented Sep 2, 2014

LGTM

jonboulle added a commit that referenced this pull request Sep 2, 2014
global units: do some agent-level validation
@jonboulle jonboulle merged commit ff8b7f6 into coreos:master Sep 2, 2014
@jonboulle jonboulle deleted the 811_agent_global_validation branch September 2, 2014 22:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants