Added the Windows DaemonManager and ManagedDaemon - #2
saurabhc123 wants to merge 6 commits into
Conversation
| return errors.New("task with FSx for Windows File Server volumes is only supported on Windows container instance") | ||
| } | ||
|
|
||
| func (task *Task) getTaskUser(container *container.Container) string { |
There was a problem hiding this comment.
This code will return empty user string for Linux when the conditions are not met.
That is not how it is in presently for Linux.
Maybe return container.user itself
There was a problem hiding this comment.
I got this verified by the Linux team. They don't care about what user it is. I also checked with them on the change of the sequence of operation too. They agreed with the change.
There was a problem hiding this comment.
Technically it is correct as the struct is declared in the method and therefore would be initialised with empty string. But think from method construction viewpoint, the name is getTaskUser and it returns empty unless specific conditions are met. It sets an incorrect precedent for the future where folks would be confused about the reason for setting it as empty and not returning the actual user.
I would strongly suggest that this be rectified.
|
|
||
| const ( | ||
| csiDriverSocketAddress = "C:\\ProgramData\\Amazon\\ECS\\ebs-csi-driver\\csi-driver.sock" | ||
| hostMountDir = "C:\\var\\lib\\kubelet" |
There was a problem hiding this comment.
CSIProxt won't allow to mount in any folder other than something under this. This needs to be investigated further for the CSIDriver work.
| logger.Fields{ | ||
| field.Image: loadedImageRef, | ||
| }) | ||
| mountPoint := dockermount.Mount{ |
There was a problem hiding this comment.
Why mounts were skipped in the common code?
There was a problem hiding this comment.
No mounts were skipped in the common code. The previous code was hardcoding the mount type to bind and we want some of our mounts to be npipe which we are passing from upstream and processing accordingly.
| fsTypeBlockName = "block" | ||
| ) | ||
|
|
||
| func DefaultSocketFilePath() string { |
| ) | ||
|
|
||
| const ( | ||
| imageTarPath = "C:\\ProgramData\\Amazon\\ECS\\data\\" |
There was a problem hiding this comment.
Why do we need a separate file with the same method.
Can we just convert the values as constants declared in platform files and then keep the method common?
| imageTarPath = "C:\\ProgramData\\Amazon\\ECS\\data\\" | ||
| imageTagDefault = "latest" | ||
| defaultAgentCommunicationPathHostRoot = "C:\\ProgramData\\Amazon\\ECS" | ||
| defaultApplicationLogPathHostRoot = "C:\\ProgramData\\Amazon\\ECS\\log" |
There was a problem hiding this comment.
Again, please do not hardcode ProgramData directly as on ECS EC2, customers can set their own path for the same.
| ) | ||
|
|
||
| const ( | ||
| imageTarPath = "C:\\ProgramData\\Amazon\\ECS\\data\\" |
There was a problem hiding this comment.
Same comments as earlier. I don't think we need to copy and fork the method.
There was a problem hiding this comment.
This is only method that needs forking. Reason being, there are different mount points for Windows and especially because of the additional ones for the CSIProxy. In addition to this, the configuration of ADMIN and the KernelCapabilities (windows doesn't need it) varies between linux and windows. There is very little common between them.
|
|
||
| // For Windows task run via the docker DaemonManager, we will run them as ContainerAdministrator | ||
| func (task *Task) getTaskUser(container *container.Container) string { | ||
| return config.ContainerAdminUser |
There was a problem hiding this comment.
Similarly, we need to check the code paths from where the docker config method is called. Setting user to containerAdministrator in all container configs can have unintended impact. Take example that a customer specifies a lower user to run the container but we set it to Admin.
Correct approach would be to not pass the user for Windows. Keep it empty and then let the container take user as defined in the image.
| // containerAdminUser is the admin username for any container on Windows. | ||
| ContainerAdminUser = "ContainerAdministrator" | ||
| // This is the path that will be used to store the local named pipe for CSI Proxy | ||
| ManagedDaemonSocketPathHostRoot = "C:\\ProgramData\\Amazon\\ECS\\ebs-csi-driver" |
There was a problem hiding this comment.
Same as comment from previous review.
Please do not hardcode ProgramData path. It can change dynamically on ECS EC2.
Correct approach is to construct it via ProgramData Env as has been done in other parts of the agent.
|
While the review is not completely ready to be shipped, there are not grave concerns except a few regarding setting of container user. Please create a formal PR in the |
ade49e1 to
c09614e
Compare
b88b1e3 to
437e051
Compare
d7ea047 to
6661a29
Compare
e8caab6 to
cb8525b
Compare
6661a29 to
7983f48
Compare
0046c02 to
67b17ce
Compare
397d052 to
ec9bde1
Compare
82fc629 to
64718fc
Compare
64718fc to
70e9fa1
Compare
67b17ce to
864edbe
Compare
864edbe to
70e9fa1
Compare
8df1c99 to
320e62a
Compare
320e62a to
a421e01
Compare
aa83d2c to
b1d7a81
Compare
Summary
This PR adds the
DaemonManagerandManagedDaemoncomponents to support EBS-TaskAttach for Windows.Implementation details
We refactored the existing
DaemonManagerandManagedDaemonmodules for linux and repurposed the high-level workflow. The platform specific details were moved to the respective windows/linux modules.Testing
We used the existing linux tests and refactored them so that all of them can be repurposed for Windows.
New tests cover the changes:
YesDescription for the changelog
Add support EBS-TaskAttach for Windows.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.