-
Notifications
You must be signed in to change notification settings - Fork 950
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
feature: extend cri apis for special needs #1617
feature: extend cri apis for special needs #1617
Conversation
df75c95
to
f4730a5
Compare
Codecov Report
@@ Coverage Diff @@
## master #1617 +/- ##
==========================================
- Coverage 41.92% 14.13% -27.8%
==========================================
Files 279 281 +2
Lines 18185 56755 +38570
==========================================
+ Hits 7624 8021 +397
- Misses 9638 47809 +38171
- Partials 923 925 +2
|
@@ -0,0 +1,1281 @@ | |||
// To regenerate api.pb.go run hack/update-generated-runtime.sh |
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.
cri/apis/cri/v1alpha1
---> cri/apis/v1alpha1
cri/apis/cri/runtime/v1alpha2
---> cri/apis/v1alpha2
make the directory structure more clear
cri/v1alpha2/cri.go
Outdated
}, | ||
HostConfig: &apitypes.HostConfig{ | ||
Binds: generateMountBindings(config.GetMounts()), | ||
Binds: generateMountBindings(config.GetMounts()), | ||
Resources: parseResourceFromAPI(resources), |
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.
rename parseResourceFromAPI
to parseResourcesFromAPI
may more consistent :)
cri/v1alpha2/cri_utils.go
Outdated
if runtimeUlimit == nil { | ||
return nil | ||
} | ||
var ulimit []*apitypes.Ulimit |
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 make sure how to use slice in golang.
46a34b4
to
bacfb54
Compare
ping @starnop |
25a2907
to
0b9f2f1
Compare
f6ec45b
to
fd9da28
Compare
cri/apis/v1alpha1/api.pb.go
Outdated
@@ -1,5 +1,5 @@ | |||
/* | |||
Copyright 2017 The Kubernetes Authors. | |||
Copyright YEAR 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.
YEAR AUTHORS?
cri/v1alpha1/cri_utils.go
Outdated
// CRI extension related tool functions. | ||
|
||
// parseResourceFromAPI parse Resources from runtime.LinuxContainerResources to apitypes.Resources | ||
func parseResourcesFromAPI(runtimeResources *runtime.LinuxContainerResources) apitypes.Resources { |
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.
s/parseResoucesFromAPI/pbLinuxContainerResourcesToAPIResouces/g WDYT?
cri/v1alpha1/cri_utils.go
Outdated
func parseVolumesFromPouch(containerVolumes map[string]interface{}) map[string]*runtime.Volume { | ||
volumes := make(map[string]*runtime.Volume) | ||
for k, v := range containerVolumes { | ||
volumes[k] = v.(*runtime.Volume) |
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.
always (*runtime.Volume)
? nil or other type?
Could we use two-values assertion to get the value? if fails, log it or return error
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. thanks for your comment.
baa10e9
to
58412d3
Compare
cri/v1alpha1/cri.go
Outdated
@@ -728,7 +734,9 @@ func (c *CriManager) ContainerStatus(ctx context.Context, r *runtime.ContainerSt | |||
Message: message, | |||
Labels: labels, | |||
Annotations: annotations, | |||
// TODO: LogPath. | |||
LogPath: container.LogPath, |
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.
The container.LogPath
is not the log path of cri container
I'll fix it in my next PR, please leave it empty now :)
a624b1d
to
ccd77d4
Compare
hack/protoc.sh
Outdated
} | ||
|
||
main(){ | ||
generateproto |
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.
API_ROOT="${DIR}/cri/apis/v1alpha1" generateproto
API_ROOT="${DIR}/cri/apis/v1alpha2" generateproto
deefe75
to
9dbcbec
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.
LGTM @YaoZengzeng
Signed-off-by: Starnop <starnop@163.com>
I've used this PR to do node-e2e test, it works fine. LGTM |
Signed-off-by: Starnop starnop@163.com
Ⅰ. Describe what this PR did
At present, the CRI interface of Kubernetes cannot meet the customized development of Kubelet. Therefore, it is necessary to provide the required functions of Kubelet by extending CRI.
Ⅱ. Does this pull request fix one issue?
Ⅲ. Describe how you did it
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews