feat: Add cri proxy for e2e_node

add example of using CRI proxy

fix:  Invalid function call

fix:  Optimize getPodImagePullDuration

fix:  Return error if the CRI Proxy is undefined

chore:  add a document
This commit is contained in:
zhifei92
2024-09-20 14:57:07 +08:00
parent a0db55c3a6
commit 2e182e736b
8 changed files with 887 additions and 1 deletions

View File

@@ -20,6 +20,8 @@ limitations under the License.
package e2enode
import (
"fmt"
libcontainercgroups "github.com/opencontainers/runc/libcontainer/cgroups"
)
@@ -27,3 +29,21 @@ import (
func IsCgroup2UnifiedMode() bool {
return libcontainercgroups.IsCgroup2UnifiedMode()
}
// addCRIProxyInjector registers an injector function for the CRIProxy.
func addCRIProxyInjector(injector func(apiName string) error) error {
if e2eCriProxy != nil {
e2eCriProxy.AddInjector(injector)
return nil
}
return fmt.Errorf("failed to add injector because the CRI Proxy is undefined")
}
// resetCRIProxyInjector resets all injector functions for the CRIProxy.
func resetCRIProxyInjector() error {
if e2eCriProxy != nil {
e2eCriProxy.ResetInjectors()
return nil
}
return fmt.Errorf("failed to reset injector because the CRI Proxy is undefined")
}