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

kubelet/rkt: Add routines for converting kubelet pod to rkt pod. #7543

Merged
merged 1 commit into from
May 1, 2015

Conversation

yifan-gu
Copy link
Contributor

@vmarmol @dchen1107 @jonboulle

This creates the rkt pod manifest from k8s pod spec.

There are some places where RunContainerOptions should be used instead of reading the container's spec directly. But that requires some refactor on the RunContainerOptions (such as add volume/port names), so I leave a TODO for now.

@yifan-gu
Copy link
Contributor Author

This follows #7465

CAP_AUDIT_READ
)

var capalibityList = map[int]string{
Copy link
Contributor

Choose a reason for hiding this comment

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

capabilityList

@vmarmol
Copy link
Contributor

vmarmol commented Apr 30, 2015

Needs a rebase btw

@yifan-gu
Copy link
Contributor Author

Rebased @vmarmol

func getCapabilities(caps []api.CapabilityType) string {
var capList []string
for _, cap := range caps {
capList = append(capList, fmt.Sprintf("%q", cap))
Copy link
Contributor

Choose a reason for hiding this comment

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

Won't this just print out the integer value? I think we need to do the lookup in the map above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the api.CabapilityType, which is a string.
Actually we should have the capability list defined in kubelet. Let me TODO it :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, yes you're right.

"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)

// TODO(yifan): Export this to higher level package.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use this anywhere? It seems like we always use the string representation no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vmarmol I mean we should define those string somewhere. At least it can help us check the user input in pod spec?

@yifan-gu
Copy link
Contributor Author

@vmarmol Thanks for the review! Comments addressed. Probably need another look :)

for _, m := range c.VolumeMounts {
mountPointName, err := appctypes.NewACName(m.Name)
if err != nil {
glog.Errorf("rkt: Cannot use the volume mount's name %q as ACName: %v", m.Name, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd argue we shouldn't log here (and below) since we are returning the error. We can make a new error with more data and let higher layers log if they'd like

}
hash, err := appctypes.NewHash(imageID)
if err != nil {
glog.Errorf("rkt: Cannot create new hash from %q", imageID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah we probably should not log and return an error everywhere

@vmarmol
Copy link
Contributor

vmarmol commented Apr 30, 2015

This looks good. I am unsure about some of the detail of the rkt config setup, but we can iterate on those with future PRs. Good to merge after the nits above.

@yifan-gu
Copy link
Contributor Author

@vmarmol Thanks! You are right, I changed all the logs with returning new errors

@vmarmol
Copy link
Contributor

vmarmol commented Apr 30, 2015

LGTM, thanks @yifan-gu!

@vmarmol
Copy link
Contributor

vmarmol commented Apr 30, 2015

Will need a rebase @yifan-gu

@yifan-gu
Copy link
Contributor Author

Roger @vmarmol

@yifan-gu yifan-gu changed the title Pod manifest kubelet/rkt: Add routines for converting kubelet pod to rkt pod. Apr 30, 2015
@vmarmol
Copy link
Contributor

vmarmol commented May 1, 2015

Merging as this is green, thanks @yifan-gu!

vmarmol added a commit that referenced this pull request May 1, 2015
kubelet/rkt: Add routines for converting kubelet pod to rkt pod.
@vmarmol vmarmol merged commit 262c34e into kubernetes:master May 1, 2015
@yifan-gu yifan-gu deleted the pod_manifest branch May 7, 2015 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants