This repository has been archived by the owner on May 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 231
Feature add docker/volume and volume/secret support (#58) #59
Open
JustinVenus
wants to merge
2
commits into
apache:master
Choose a base branch
from
JustinVenus:AURORA-1983/volumes_and_secrets
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ | |
import org.apache.aurora.gen.SlaPolicy; | ||
import org.apache.aurora.gen.TaskConfig; | ||
import org.apache.aurora.gen.TaskConstraint; | ||
import org.apache.aurora.gen.VolumeSource; | ||
import org.apache.aurora.gen.VolumeType; | ||
import org.apache.aurora.scheduler.TierManager; | ||
import org.apache.aurora.scheduler.base.JobKeys; | ||
import org.apache.aurora.scheduler.base.UserProvidedStrings; | ||
|
@@ -476,6 +478,18 @@ public ITaskConfig validateAndPopulate( | |
if (!settings.allowContainerVolumes && !container.getVolumes().isEmpty()) { | ||
throw new TaskDescriptionException(NO_CONTAINER_VOLUMES); | ||
} | ||
|
||
if (settings.allowContainerVolumes && !container.getVolumes().isEmpty()) { | ||
builder.setContainer(Container.mesos( | ||
container.newBuilder() | ||
.setVolumes(container.getVolumes().stream() | ||
.map(v -> v.isSetVolumeType() ? v.newBuilder() : v.newBuilder() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since in the api.thrift we set a default value on line 223 https://github.com/apache/aurora/pull/59/files#diff-03d58f7b857e5429e1668264857798e1R223 do we ever hit the case where the volume is not set? Or does thrift not assign anything if we don't explicitly set anything? Just wondering because having a value be optional and have a default value at the same time is counter intuitive. |
||
.setContainerPath(v.getContainerPath()) | ||
.setMode(v.getMode()) | ||
.setSource(VolumeSource.hostPath(v.getHostPath())) | ||
.setVolumeType(VolumeType.HOST_PATH)) | ||
.collect(Collectors.toList())))); | ||
} | ||
} | ||
|
||
validateSlaPolicy(builder, instanceCount); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think by using this as a union, we can get away without using a VolumeType therefore shrinking our Thrift footprint and we reduce the error proneness of having to set the same value twice . (e.g. VolumeType== "X", VolumeSource == "X.value")
In the code we can check isSet and use that as the "type" to choose the code path. Since Thrift won't allow more than one field in the union to be set we can safely depend on this. We use this same pattern in the SLA strategy f2acf53#diff-dc70a52021b0286021f89682c3b0841bR241