-
Notifications
You must be signed in to change notification settings - Fork 537
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
[WIP][DNM][RFC] Create a unified binary and container image #273
Conversation
cmd/cephcsi.go
Outdated
@@ -0,0 +1,113 @@ | |||
/* | |||
Copyright 2018 The Kubernetes Authors. |
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.
2019
cmd/cephcsi.go
Outdated
|
||
func getDriverName() string { | ||
// was explicitly passed a driver name | ||
if *driverName != "" { |
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.
if driver != nil && len(*drivername) != 0
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'll make these changes, but I'll like to understand why the preference of len(str) vs. direct comparision to "". Golang should optimize checking for the empty string, no?
The nil check I have no issues with.
cmd/cephcsi.go
Outdated
return *driverName | ||
} | ||
// select driver name based on volume type | ||
switch *vtype { |
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.
if vtype == nil {
return nil
}
cmd/cephcsi.go
Outdated
} | ||
|
||
func main() { | ||
if *vtype == "" { |
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.
if vtype == nil || len(*vtype) == 0
cmd/cephcsi.go
Outdated
klog.Fatalln(err) // calls exit | ||
} | ||
|
||
switch *vtype { |
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.
switch dnam
makes more sense based on the context
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.
dname can be user specified as well, hence switching on the same may not be the right thing to do.
also need to add the image to |
deploy/cephcsi/image/Dockerfile
Outdated
@@ -0,0 +1,17 @@ | |||
|
|||
FROM centos:7 |
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.
Why not using ceph/ceph
image instead? See: https://hub.docker.com/r/ceph/ceph/tags
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 would be happy to make that change if other ceph-csi experts agree. @rootfs @ShyamsundarR @gman0 ?
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.
@Lseb I like the general idea, but an unaware if the ceph/ceph image is unduly bigger than what we require in this case.
This image needs "ceph-common kmod ceph-fuse attr e2fsprogs xfsprogs rbd-nbd" as in the yum install below.
The ceph/ceph image seems to contain iSCSI, NFS Ganesha etc, which are not needed in this case.
Also, the image size is ~228MB as compared to the current ceph-csi images running at ~150MB (just pointing it out, not attempting to save bits and bytes at these sizes yet).
The ceph image is better from an operational standpoint, as ensuring it has the right dependencies is done by the image itself, hence more apt to use the same.
The above is what I notice, @leseb your thoughts on these and if they matter much?
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.
@ShyamsundarR the image size, as well as the unnecessary packages, are a valid point. However, it doesn't hurt much, I'm just trying to avoid using home-made images that could use wrong sources. The images we build on ceph/ceph
are Ceph's official image, supported and maintained by the Ceph team.
I just realized that our current image does not contain rbd-nbd
and ceph-fuse
, this can be easily fixed but I don't want to hold to PR for that. We can still fix this later.
Btw why do we need rbd-nbd
, AFAIK we don't use NBD but KRBD, can someone clarify? Thanks!
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.
@ShyamsundarR the image size, as well as the unnecessary packages, are a valid point. However, it doesn't hurt much, I'm just trying to avoid using home-made images that could use wrong sources. The images we build on
ceph/ceph
are Ceph's official image, supported and maintained by the Ceph team.
I agree, the extra size does not really bother me, also staying on the official image is the right option.
I just realized that our current image does not contain
rbd-nbd
andceph-fuse
, this can be easily fixed but I don't want to hold to PR for that. We can still fix this later.Btw why do we need
rbd-nbd
, AFAIK we don't use NBD but KRBD, can someone clarify? Thanks!
NBD can be used via a mounter
option provided, and so we support it. I am not sure about why we do and if we should carry it forward, but possibly a different discussion. As you have started the process of including it in the Ceph official image, it should be good for now.
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.
ceph/ceph-container#1337 has just recently merged, which should allow us to use ceph/ceph as a base.
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.
Not yet, we haven't built the image yet.
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.
Broadly, I am fine with the naming and changes.
You did mention that based on the binary name the appropriate mode can be selected, I wonder how we could do that when the docker file expects an ENTRYPOINT anyway, and that is going to be common. I like the idea, but am possibly missing how we would achieve the same.
cmd/cephcsi.go
Outdated
klog.Fatalln(err) // calls exit | ||
} | ||
|
||
switch *vtype { |
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.
dname can be user specified as well, hence switching on the same may not be the right thing to do.
I didn't actually implement that in this version but I'll do so to demonstrate what I mean and then I'll remove it if no-one likes that version. As for providing both... I think as long as our order of precedence is clear it shouldn't be much of an issue. |
9980d6c
to
e5904b4
Compare
I've updated the series to include switching on the name of the binary as well as most of the other suggestions made. To demonstrate, I now create symlinks within the unified container image and copy the binary to the "old" names in the split images. I didn't change the base of the image as @leseb suggested yet because I wanted to get some buy-in from others before I did that. It would be a good change IMO though. |
@phlogistonjohn @leseb IMO, we should not remove individual targets like |
@humblec , I think that would mean extra "experimental" code that could rot over time, because it will not be in the path that QE tests regularly. |
|
||
var ( | ||
// common flags | ||
vtype = flag.String("type", "", "driver type [rbd|cephfs]") |
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 we need to update the deployment templates for this one, and also the files in deploy folder for new flags
is this a breaking change? because once PR is merged new image will be pushed.
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.
Eventually yes, but I didn't plan to immediately deprecate the "split" images. Only new templates would be needed after the image was ready. I wasn't going to do that in this PR.
e5904b4
to
20fd4e3
Compare
Create a single binary that can start ceph-csi in either rbd or cephfs mode. Signed-off-by: John Mulligan <jmulligan@redhat.com>
20fd4e3
to
66a6597
Compare
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.
One last thing :), the image has the packages too now.
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.
Looks clean (other than DockerFile comments by @leseb ).
Just some queries, implementation looks fine.
cephfsplugin: | ||
if [ ! -d ./vendor ]; then dep ensure -vendor-only; fi | ||
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o _output/cephfsplugin ./cmd/cephfs | ||
image-rbdplugin: cephcsi |
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.
(query) I would assume the targets image-rbdplugin
and image-cephfsplugin
would go away eventually, as noted here
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.
Yeah.
|
||
func getType() string { | ||
if vtype == nil || len(*vtype) == 0 { | ||
a0 := path.Base(os.Args[0]) |
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.
(query) In the end the command to execute maybe set using the container:command directive in kubernetes say, would that be right?
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.
That's one way, there's also the args parameter. These changes "don't care" how the command is invoked, just that if it is invoked as the rbd or cephfs variant it uses that type as default.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Add rules and variables to the Makefile so that the unified binary and container image can be built. Signed-off-by: John Mulligan <jmulligan@redhat.com>
66a6597
to
9cf82c2
Compare
Updated version pushed to incorporate @leseb latest comment. Folks, please help me get a checklist of what's an absolute blocker for this PR and what's nice to have. Once I resolve the blockers I can move this out of RFC state and I can move forward with additional follow-up prs for the nice-to-haves. |
I have none, I am good as long as @leseb is good with the DockerFile |
Thanks @phlogistonjohn for your patience 👍 |
@leseb someone needs to pick this to master branch |
@phlogistonjohn can you please cherry-pick this into the master branch? |
Happy to do the work but not sure what needs to be done. Cherry-pick changes on top of master and then file a new PR for those? |
@phlogistonjohn yes, checkout master, checkout a new branch, cherry-pick, send a PR against master. |
Syncing latest changes from upstream devel for ceph-csi
Creating a unified binary and container image has come up a few times in conversations I've been involved with (generally in-person). I confirmed this was still something on the table with @travisn but it might be nice if you could confirm @rootfs.
Regardless, the PR is the start of a single image and binary. Currently, this only adds the new unified version and leaves the current items as-is. This is mainly to start the discussion and the final version would remove them.
Some points I'd like to discuss: