-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
GCE: install containerized mounter on COS #3482
GCE: install containerized mounter on COS #3482
Conversation
@justinsb PR needs rebase |
4341335
to
c84beba
Compare
c84beba
to
e1e728c
Compare
@justinsb we need bazel files updated please :) |
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.
Lot of questions for yah. Looks good. Please rebase and bazelize ... aka update the bazel files.
@@ -105,6 +105,10 @@ func (b *KubeletBuilder) Build(c *fi.ModelBuilderContext) error { | |||
return err | |||
} | |||
|
|||
if err := b.addContainerizedMounter(c); err != nil { | |||
return err |
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.
should we fmt?
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'd say no: it's one of our functions, we have nothing to add really.
nodeup/pkg/model/kubelet.go
Outdated
Options: []string{"ro"}, | ||
}) | ||
|
||
// cp "${KUBE_HOME}/kube-manifests/kubernetes/gci-trusty/gci-mounter" "${CONTAINERIZED_MOUNTER_HOME}/mounter" |
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.
remove comments or add to func docs?
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.
Done!
upup/pkg/fi/cloudup/apply_cluster.go
Outdated
// needsKubernetesManifests checks if we need kubernetes manifests | ||
// This is only needed currently on ContainerOS i.e. GCE, but we don't have a nice way to detect it yet | ||
func needsKubernetesManifests(c *kops.Cluster, instanceGroups []*kops.InstanceGroup) bool { | ||
// TODO: Do real detection of ContainerOS (but this has to work with AMI names, and maybe even forked AMIs) |
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.
AMI? Don't think gce has AMIs :)
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.
Changed to "image"
) | ||
|
||
// Archive task downloads and extracts a tar file | ||
type Archive struct { |
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 going to use this for the CNI tarball 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.
We use assets today. Assets let us pluck individual files out of a tarball. mounter.tar is a big tar file that is expanded in its entirety into a directory, which is a little different - we would have to list every file in the tar.
I think we want to keep the fine-grained control over CNI. This tar is really a container image, and we just want to expand whatever is in there.
I would like to tie this into Assets though, but this is an odd one - it's really more similar to other system docker images, like kube-apiserver, than it is to CNI.
} | ||
|
||
if stateBytes == nil { | ||
return nil, nil |
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.
nil, nil? What is going on here? Logging? err?
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 at least make a code comment it is not obvious to me why we are not returning err.
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 Find function on a Task doesn't find an existing item, it returns nil, nil.
return fmt.Errorf("error creating directories %q: %v", targetDir, err) | ||
} | ||
|
||
args := []string{"tar", "xf", localFile, "-C", targetDir} |
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.
Does RHEL support not using the tick with tar now? https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security-Enhanced_Linux/sect-Security-Enhanced_Linux-Maintaining_SELinux_Labels_-Archiving_Files_with_tar.html they are still using -
with there args. But I would need to login to a client system and check for certain.
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, I think RHEL tar is standard GNU tar. Let's fix if we find it isn't. Hopefully we can get kops under e2e on RHEL
} | ||
|
||
args := []string{"tar", "xf", localFile, "-C", targetDir} | ||
glog.Infof("running command %s", args) |
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.
shoud we glog.V(3).Infof("running command %s", args)
?
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.
It looks like in nodeup we glog.Infof when we're making changes and glog.V(2).Infof when we're just looking for stuff. So I think glog.Infof here
package nodetasks | ||
|
||
import ( | ||
"fmt" |
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.
Should we start formatting our imports? We have such differences across the project :( I know nit pick :P
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.
My votes is for goimports
style. Not sure what k/k uses.
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.
Will fix the new files in this PR, but let's discuss that in another PR (I think we have discussion of it already in another issue - the shortcoming is that goimports doesn't remove blocks that have been added, IIRC. If there's a better tool available that would be great...)
} | ||
|
||
// MockExecutor is a mock implementation of Executor | ||
type MockExecutor struct { |
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 should start a mock under /pkg :) We should be using this in other places.
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.
RIght, I was going to move it when the second use arose :-)
return fmt.Sprintf("MountDisk: %s %s->%s", s.Name, s.Device, s.Mountpoint) | ||
} | ||
|
||
var _ CreatesDir = &MountDiskTask{} |
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 are doing this in protokube as well. Should we file an issue to refactor this into pkg and have both protokube and nodeup use this code?
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.
It's a nice idea - we could start to use tasks in protokube. But send a PR instead of opening an issue :-)
The containerized mounter is a little tricky to install, with lots of bind mounts. This code path is only hit on GCE though.
e1e728c
to
af6a7ef
Compare
Rebased, regenerated bazel and made the requested fixes. PTAL @chrislovecnm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrislovecnm The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. |
The containerized mounter is a little tricky to install, with lots of
bind mounts. This code path is only hit on GCE though.