Skip to content
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

Merged

Conversation

justinsb
Copy link
Member

The containerized mounter is a little tricky to install, with lots of
bind mounts. This code path is only hit on GCE though.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 30, 2017
@k8s-github-robot
Copy link

@justinsb PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 1, 2017
@justinsb justinsb force-pushed the gce_containerized_mounter branch from 4341335 to c84beba Compare October 4, 2017 01:19
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 4, 2017
@justinsb justinsb force-pushed the gce_containerized_mounter branch from c84beba to e1e728c Compare October 4, 2017 01:41
@chrislovecnm
Copy link
Contributor

@justinsb we need bazel files updated please :)

Copy link
Contributor

@chrislovecnm chrislovecnm left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

should we fmt?

Copy link
Member Author

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.

Options: []string{"ro"},
})

// cp "${KUBE_HOME}/kube-manifests/kubernetes/gci-trusty/gci-mounter" "${CONTAINERIZED_MOUNTER_HOME}/mounter"
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

// 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)
Copy link
Contributor

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 :)

Copy link
Member Author

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 {
Copy link
Contributor

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?

Copy link
Member Author

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
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Member Author

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}
Copy link
Contributor

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.

Copy link
Member Author

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)
Copy link
Contributor

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)?

Copy link
Member Author

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"
Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Member Author

@justinsb justinsb Oct 8, 2017

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 {
Copy link
Contributor

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.

Copy link
Member Author

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{}
Copy link
Contributor

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?

Copy link
Member Author

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.
@justinsb justinsb force-pushed the gce_containerized_mounter branch from e1e728c to af6a7ef Compare October 8, 2017 15:41
@justinsb
Copy link
Member Author

justinsb commented Oct 8, 2017

Rebased, regenerated bazel and made the requested fixes. PTAL @chrislovecnm

@chrislovecnm
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 8, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 8, 2017
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue.

@k8s-github-robot k8s-github-robot merged commit fe7ed14 into kubernetes:master Oct 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants