-
Notifications
You must be signed in to change notification settings - Fork 949
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1719 from Starnop/cri-cni
refactor: Extract cni manager as the public part
- Loading branch information
Showing
8 changed files
with
104 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ocicni | ||
|
||
import "github.com/cri-o/ocicni/pkg/ocicni" | ||
|
||
// CniMgr as an interface defines all operations against CNI. | ||
type CniMgr interface { | ||
// Name returns the plugin's name. This will be used when searching | ||
// for a plugin by name, e.g. | ||
Name() string | ||
|
||
// SetUpPodNetwork is the method called after the sandbox container of the | ||
// pod has been created but before the other containers of the pod | ||
// are launched. | ||
SetUpPodNetwork(podNetwork *ocicni.PodNetwork) error | ||
|
||
// TearDownPodNetwork is the method called before a pod's sandbox container will be deleted. | ||
TearDownPodNetwork(podNetwork *ocicni.PodNetwork) error | ||
|
||
// GetPodNetworkStatus is the method called to obtain the ipv4 or ipv6 addresses of the pod sandbox. | ||
GetPodNetworkStatus(netnsPath string) (string, error) | ||
|
||
// Status returns error if the network plugin is in error state. | ||
Status() error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package ocicni | ||
|
||
import "github.com/cri-o/ocicni/pkg/ocicni" | ||
|
||
// NoopCniManager is an implementation of interface CniMgr, but makes no operation. | ||
type NoopCniManager struct { | ||
} | ||
|
||
// Name of NoopCniManager return the name of plugin as "none". | ||
func (n *NoopCniManager) Name() string { | ||
return "noop" | ||
} | ||
|
||
// SetUpPodNetwork of NoopCniManager makes no operation. | ||
func (n *NoopCniManager) SetUpPodNetwork(podNetwork *ocicni.PodNetwork) error { | ||
return nil | ||
} | ||
|
||
// TearDownPodNetwork of NoopCniManager makes no operation. | ||
func (n *NoopCniManager) TearDownPodNetwork(podNetwork *ocicni.PodNetwork) error { | ||
return nil | ||
} | ||
|
||
// GetPodNetworkStatus of NoopCniManager makes no operation. | ||
func (n *NoopCniManager) GetPodNetworkStatus(netnsPath string) (string, error) { | ||
return "", nil | ||
} | ||
|
||
// Status of NoopCniManager makes no operation. | ||
func (n *NoopCniManager) Status() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.