mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-26 19:35:10 +00:00
Move pv_util.go into framework package so that it can be used in tests
not in the e2e package.
This commit is contained in:
@@ -4590,6 +4590,14 @@ func getPodLogsInternal(c clientset.Interface, namespace, podName, containerName
|
||||
return string(logs), err
|
||||
}
|
||||
|
||||
func GetGCECloud() (*gcecloud.GCECloud, error) {
|
||||
gceCloud, ok := TestContext.CloudConfig.Provider.(*gcecloud.GCECloud)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to convert CloudConfig.Provider to GCECloud: %#v", TestContext.CloudConfig.Provider)
|
||||
}
|
||||
return gceCloud, nil
|
||||
}
|
||||
|
||||
// EnsureLoadBalancerResourcesDeleted ensures that cloud load balancer resources that were created
|
||||
// are actually cleaned up. Currently only implemented for GCE/GKE.
|
||||
func EnsureLoadBalancerResourcesDeleted(ip, portRange string) error {
|
||||
@@ -4600,9 +4608,9 @@ func EnsureLoadBalancerResourcesDeleted(ip, portRange string) error {
|
||||
}
|
||||
|
||||
func ensureGCELoadBalancerResourcesDeleted(ip, portRange string) error {
|
||||
gceCloud, ok := TestContext.CloudConfig.Provider.(*gcecloud.GCECloud)
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to convert CloudConfig.Provider to GCECloud: %#v", TestContext.CloudConfig.Provider)
|
||||
gceCloud, err := GetGCECloud()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
project := TestContext.CloudConfig.ProjectID
|
||||
region, err := gcecloud.GetGCERegion(TestContext.CloudConfig.Zone)
|
||||
@@ -5090,9 +5098,9 @@ func (p *E2ETestNodePreparer) CleanupNodes() error {
|
||||
// the given name. The name is usually the UUID of the Service prefixed with an
|
||||
// alpha-numeric character ('a') to work around cloudprovider rules.
|
||||
func CleanupGCEResources(loadBalancerName string) (retErr error) {
|
||||
gceCloud, ok := TestContext.CloudConfig.Provider.(*gcecloud.GCECloud)
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to convert CloudConfig.Provider to GCECloud: %#v", TestContext.CloudConfig.Provider)
|
||||
gceCloud, err := GetGCECloud()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := gceCloud.DeleteFirewall(loadBalancerName); err != nil &&
|
||||
!IsGoogleAPIHTTPErrorCode(err, http.StatusNotFound) {
|
||||
|
||||
Reference in New Issue
Block a user