-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CHE-2874 Let users configure the 'Z' flag when mouting a volume #2921
Conversation
Can one of the admins verify this patch? |
@snjeza - thanks for this contribution. You may not have seen it, but there was a major merge this morning where we renamed all of the che.properties so that they all start with |
bcb6efa
to
6b354f9
Compare
LGTM @garagatyi @benoitf can you please have a look at this PR that fixes #2874 |
workspaceFolderPathProvider.getPath(workspaceId), | ||
projectFolderPath); | ||
if (volumeOptions != null && !volumeOptions.isEmpty()) { |
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.
you should use guava helper isNullOrEmpty / com.google.common.base.Strings.isNullOrEmpty;
workspaceFolderPathProvider.getPath(workspaceId), | ||
projectFolderPath); | ||
if (volumeOptions != null && !volumeOptions.isEmpty()) { | ||
projectFolderVolume = projectFolderVolume + ":" + volumeOptions; |
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.
use of += to add to current ?
@@ -55,18 +61,22 @@ public String get() { | |||
return null; | |||
} | |||
|
|||
if (volumeOptions == null) { | |||
volumeOptions="ro,Z"; |
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.
IMHO default options should be in properties file or to be a constant
} catch (IOException e) { | ||
LOG.warn(e.getMessage()); | ||
throw new RuntimeException(e); | ||
} | ||
} else { | ||
return extConfDir.getAbsolutePath() + CONTAINER_TARGET; | ||
return extConfDir.getAbsolutePath() + CONTAINER_TARGET + ":" + volumeOptions; |
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.
small concern : maybe to have a getTargetOptions() helper method as there are some duplicates between unix and windows
if (SystemInfo.isWindows()) { | ||
if (volumeOptions == null) { | ||
volumeOptions="ro,Z"; |
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.
constants or directly as default properties ?
I have updated the patch. |
public static final String EXT_CHE_LOCAL_CONF_DIR = "/mnt/che/conf"; | ||
private static final String RO_Z = "ro,Z"; | ||
|
||
public static final String EXT_CHE_LOCAL_CONF_DIR = "/mnt/che/conf"; |
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.
indent is not correct
@@ -55,18 +63,27 @@ public String get() { | |||
return null; | |||
} | |||
|
|||
if (volumeOptions == null) { |
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.
as @Inject on volumeOptions is not optional, I think that we could get rid of default value from the code as it becomes a mandatory parameter
@Override | ||
public String get() { | ||
if (volumeOptions == null) { |
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.
same here, as it's a required parameter it needs to be provided so we don't have to handle this
ci-build |
The patch has been updated. |
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.
need to sync before merging this property for codenvy properties
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/866/ |
@TylerJewell can you be more explicit on the QA communications? I would like to help but I'm not sure to understand what is expected. |
Yes, sure thing. When you merge the issue that is targeted for a particular milestone, please talk to @vkuznyetsov about whether there should be any additional QA or integration tests added into the CI system that can be run regularly to test this behavior. All of the "base" che.properties are in Note that there is a new che.properties that has a new naming scheme. They are all designed to be user friendly. There is an alias file which maps the new names to the old names so that if you still use the old properties then they will still work for awhile. |
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.
Overall PR is good. Please address my comments
che.machine.docker.volumes.projects.options=Z | ||
|
||
# Adds options when mounting the /mnt/che/terminal, /mnt/che/ws-agent.tar.gz, /mnt/che/conf volume | ||
che.machine.docker.volumes.workspace.options=ro,Z |
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.
According to a comment it related to agents rather to workspace. Probably property name should be aligned with the comment.
@@ -41,6 +41,7 @@ | |||
private String pidMode; | |||
private boolean readonlyRootfs; | |||
private Ulimit[] ulimits; | |||
private String volumeOptions; |
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 don't see such field in Docker Create container API. Can you point me out where it is?
@@ -146,7 +147,8 @@ public MachineProviderImpl(DockerConnector docker, | |||
@Named("machine.docker.machine_env") Set<String> allMachinesEnvVariables, | |||
@Named("che.docker.registry_for_snapshots") boolean snapshotUseRegistry, | |||
@Named("che.docker.swap") double memorySwapMultiplier, | |||
@Named("machine.docker.networks") Set<Set<String>> additionalNetworks) | |||
@Named("machine.docker.networks") Set<Set<String>> additionalNetworks, | |||
@Nullable @Named("che.machine.docker.volumes.projects.options") String volumeOptions) |
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.
We use dots to separate categories of implementation. We use underscores to separate words of single term. Please ensure that you are following that policy
private static final Logger LOG = LoggerFactory.getLogger(DockerExtConfBindingProvider.class); | ||
|
||
@Inject | ||
@Named("che.machine.docker.volumes.workspace.options") |
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.
Please ensure that you are following properties naming policy described above
I have changed the names of the properties and added the volumeOptions field to the Docker Create container API. |
Probably we misunderstand each other. I meant that I can't find volumeOptions in Docker API documentation. So I don't understand why you added such a field in HostConfig object which is our representation of Docker API model. Can you elaborate? |
I have reviewed the che.docker.privilege property and implemented the che.docker.volumes_projects_options property in a similar way. |
che.docker.privilege property represents a flag from Docker API documentation, whereas volumeOptions is not present in HostConfig representation. |
I will try to move the volumeOptions property to another class. |
I have removed the volumeOptions property from Docker API documentation. |
M7 needs to be complete by tomorrow (Nov 8) pushing to M8 but if it's merged tomorrow it can be reassigned to M7. |
@snjeza please let me know when you have confirmed that this PR will fix the issue when running Che on CentOS 7 with RH packaged Docker. |
Sorry for delay, @snjeza. I've refactored code around container bootstrapping for simplifying code for environment SPI implementation. Please rework your PR because of that. Now volume for projects is bound in LocalCheInfrastructureProvisioner. Other changes in this PR looks good to me |
I have updated the patch. |
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.
Good job!
Signed-off-by: Snjezana Peco <[email protected]>
@l0rd, |
Thank you @snjeza 🎉 LGTM |
@benoitf - very important that we capture these changes and merge them as part of the CLI consolidation. |
What does this PR do?
It adds the following two properties:
che.machine.docker.volumes.projects.options (Z by default)
that is used when che mounts the /projects volume
che.machine.docker.volumes.workspace.options (ro,Z by default)
used when mounting the following volumes:
/mnt/che/terminal
/mnt/che/ws-agent.tar.gz
/mnt/che/conf
Notice:
che-launcher also uses the Z option. I haven't changed it.
What issues does this PR fix or reference?
#2874
Signed-off-by: Snjezana Peco [email protected]