Add dependency to ECS agent service #215
Open
+33
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #, if available:
n/a
Description of changes:
If ECS starts before credentials-fetcher, the agent fails to connect to the credentials-fetcher socket. So, when installing
credentials-fetcher.service, add a drop-in configuration forecs.service, so thatcredentials-fetcher.serviceeffectively becomes a component ofecs.service.With this change, if
ecs.serviceis started, stopped, or restarted,credentials-fetcher.servicewill also do the same, andecs.servicewill wait for the socket file to be created when startingcredentials-fetcher.service.Since
ecs.servicebecomes so tightly coupled withcredentials-fetcher.service, we don't have to explicitly enable it for it to start on systems where the ECS agent is installed. Instead,ecs.servicetriggers the service to start with it as a dependency.If this is installed on a system where ECS agent is not installed, there are no side effects. Although there would be a drop-in file for
ecs.service, without the underlying unit file also present (provided by ECS agent), the drop-in will be ignored by systemd. Similarly, this approach does not clobber any of the files provided by ECS agent directly, and simply leverages existing systemd functionality to enforce our intent and requirement.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.