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

Update the smb image to our own simpler version #2053

Merged
merged 1 commit into from
Jan 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 8 additions & 25 deletions client_plugin/drivers/vfile/dockerops/dockerops.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ const (
// Postfix added to names of Samba services for volumes
serviceNamePrefix = "vFileServer"
// Path where the file server image resides in plugin
fileServerPath = "/usr/lib/vmware/samba.tar"
fileServerPath = "/usr/lib/vmware/vfilesmb.tar"
// Driver for the network which Samba services will use
// for communicating to clients
networkDriver = "overlay"
// Name of the Samba server docker image
sambaImageName = "luomiao/samba-debian"
sambaImageName = "cnastorage/vfile-smb:v0.1"
// Name of the Samba share used to expose a volume
FileShareName = "share1"
FileShareName = "vfileshare"
// Path of the Samba share inside the server
FileSharePath = "/vfilepath"
// Default username for all accessing Samba server mounts
SambaUsername = "root"
SambaUsername = "vfile"
// Default password for all accessing Samba server mounts
SambaPassword = "badpass"
SambaPassword = "vfile"
// Port number inside Samba container on which
// Samba service listens
defaultSambaPort = 445
Expand Down Expand Up @@ -220,31 +222,12 @@ func (d *DockerOps) StartSMBServer(volName string) (int, string, bool) {
// The Docker image to run in this service
Copy link
Contributor

Choose a reason for hiding this comment

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

Why with this change, there is no need to pass "containerArgs"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No we don't need to create the shares or users since we have pre-defined shares inside the image already.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then when user need to create a share owned by specific user and with specific access permission, how can we set that? I don't think we can set in image in this case.

Copy link
Contributor Author

@luomiao luomiao Jan 11, 2018

Choose a reason for hiding this comment

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

That's right :)
This is a feature we don't support for now (and didn't support before the change too).
We can add it later.

Copy link
Contributor

Choose a reason for hiding this comment

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

My only concern here is in the original image, they are configurable in the code. But with this change, it seems hard coded in the image. Is there any way that make it configurable other than hard coded?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we will need to update the vfilesmb image to include customize functions for creating new users. We can add this when we support the user defined username functionality.

service.TaskTemplate.ContainerSpec.Image = sambaImageName

/* Args which will be passed to the service. These options are
* used by the Samba container, not Docker API.
* -s: Share related info: Name of the share,
Path in the Samba container that will be shared,
Browsable (yes),
Read only (no),
Guest access allowed by default (no),
Which users can access (all),
Which users are admins? (root)
Writelist: If RO, who can write on the share (root)
* -u: Username and Password
*/
containerArgs := []string{"-s",
FileShareName + ";/mount;yes;no;no;all;" +
SambaUsername + ";" + SambaUsername,
"-u",
SambaUsername + ";" + SambaPassword}
service.TaskTemplate.ContainerSpec.Args = containerArgs

// Mount a volume on service containers at mount point "/mount"
var mountInfo []swarm.Mount
mountInfo = append(mountInfo, swarm.Mount{
Type: swarm.MountType("volume"),
Source: internalVolumePrefix + volName,
Target: "/mount"})
Target: FileSharePath})
service.TaskTemplate.ContainerSpec.Mounts = mountInfo

// How many containers of this service should be running at a time?
Expand Down
4 changes: 2 additions & 2 deletions plugin_dockerbuild/Dockerfile.vfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rm -Rf etcd-v3.2.3-linux-amd64* /var/cache/apk/*
RUN mkdir -p /mnt/vfile
RUN mkdir -p /usr/lib/vmware
RUN apk add --update ca-certificates openssl tar && \
wget https://storage.googleapis.com/kubernetes-anywhere-for-vsphere-cna-storage/samba.tar && \
mv samba.tar /usr/lib/vmware
wget https://storage.googleapis.com/kubernetes-anywhere-for-vsphere-cna-storage/vfilesmb.tar && \
mv vfilesmb.tar /usr/lib/vmware
COPY vfile /usr/bin
CMD ["/usr/bin/vfile"]