-
Notifications
You must be signed in to change notification settings - Fork 68
Implement STATUS #121
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
base: main
Are you sure you want to change the base?
Implement STATUS #121
Changes from all commits
a45b44a
7afa42f
a7839ab
1d06125
b110ac0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -315,6 +315,7 @@ func TestLibCNIType120(t *testing.T) { | |
| Args: [][2]string(nil), | ||
| CapabilityArgs: map[string]interface{}{}, | ||
| } | ||
| mockCNI.On("GetStatusNetworkList", l.networks[0].config).Return(nil) | ||
| mockCNI.On("AddNetworkList", l.networks[0].config, expectedRT).Return(&types100.Result{ | ||
| CNIVersion: "1.1.0", | ||
| Interfaces: []*types100.Interface{ | ||
|
|
@@ -342,6 +343,7 @@ func TestLibCNIType120(t *testing.T) { | |
| Args: [][2]string(nil), | ||
| CapabilityArgs: map[string]interface{}{}, | ||
| } | ||
| mockCNI.On("GetStatusNetworkList", l.networks[1].config).Return(nil) | ||
| mockCNI.On("AddNetworkList", l.networks[1].config, expectedRT).Return(&types100.Result{ | ||
| CNIVersion: "1.1.0", | ||
| Interfaces: []*types100.Interface{ | ||
|
|
@@ -374,6 +376,12 @@ func TestLibCNIType120(t *testing.T) { | |
|
|
||
| err = l.Remove(ctx, "container-id1", "/proc/12345/ns/net") | ||
| assert.NoError(t, err) | ||
|
|
||
| statuses, err := l.StatusDetail(ctx) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fake configuration that is being generated, is that 1.1.0? Can you verify that I don't think the Status verb is actually being executed.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MikeZappa87 Thanks for the comment, just want to make sure I understand everything -- In the approach currently taken by this PR, StatusDetail isn't called anywhere yet (the proposal was to have containerd call it), so you're right that the Status verb isn't executed unless we explicitly call StatusDetail. Since we do call StatusDetail in the test here, I think this line https://github.com/containerd/go-cni/pull/121/files#diff-6cdf85f441267859d068399676e5f0ad8946811bd7e951b4e80db98d9fd2489cR318 asserts that the (mocked) status verb is being executed. I don't see 1.1.0 specified anywhere in the fake config, but I think that doesn't affect the test because the version check happens inside cni.GetStatusNetworkList, and this function is mocked out. Is that right? |
||
| assert.NoError(t, err) | ||
| assert.Len(t, statuses, 2) | ||
| assert.Nil(t, statuses[0].Status) | ||
| assert.Nil(t, statuses[1].Status) | ||
| } | ||
|
|
||
| type MockCNI struct { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,3 +60,8 @@ type DNS struct { | |||||||||||
| // List of DNS options. | ||||||||||||
| Options []string | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| type NetworkStatus struct { | ||||||||||||
| Network *Network | ||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to expose anything else here? Right now all the fields of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it enough to make Lines 26 to 30 in a45b44a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a consumer of the Status API does making this private or public help? Exposing ifName might be useful especially if we ever begin to support multiple interfaces upstream.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MikeZappa87 The first use case that came to mind was just the error message, like if the kubelet sees that one of the entries of What about type NetworkConfigList struct {
Name string
CNIVersion string
DisableCheck bool
DisableGC bool
LoadOnlyInlinedPlugins bool
Plugins []*PluginConfig
Bytes []byte
} |
||||||||||||
| Status error | ||||||||||||
| } | ||||||||||||
Uh oh!
There was an error while loading. Please reload this page.