mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Update cAdvisor ContainerInfo references to v1 API.
The cAdvisor data structures were versioned recently. We use the v1 versions so this commit makes that explicit.
This commit is contained in:
		@@ -25,7 +25,7 @@ import (
 | 
				
			|||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"strconv"
 | 
						"strconv"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/google/cadvisor/info"
 | 
						info "github.com/google/cadvisor/info/v1"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type ContainerInfoGetter interface {
 | 
					type ContainerInfoGetter interface {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,8 +28,8 @@ import (
 | 
				
			|||||||
	"testing"
 | 
						"testing"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/google/cadvisor/info"
 | 
						info "github.com/google/cadvisor/info/v1"
 | 
				
			||||||
	itest "github.com/google/cadvisor/info/test"
 | 
						itest "github.com/google/cadvisor/info/v1/test"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func testHTTPContainerInfoGetter(
 | 
					func testHTTPContainerInfoGetter(
 | 
				
			||||||
@@ -62,7 +62,7 @@ func testHTTPContainerInfoGetter(
 | 
				
			|||||||
		// So changing req after Get*Info would be a race.
 | 
							// So changing req after Get*Info would be a race.
 | 
				
			||||||
		expectedReq := req
 | 
							expectedReq := req
 | 
				
			||||||
		// Fill any empty fields with default value
 | 
							// Fill any empty fields with default value
 | 
				
			||||||
		if !reflect.DeepEqual(expectedReq, &receivedReq) {
 | 
							if !expectedReq.Equals(receivedReq) {
 | 
				
			||||||
			t.Errorf("received wrong request")
 | 
								t.Errorf("received wrong request")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		err = json.NewEncoder(w).Encode(cinfo)
 | 
							err = json.NewEncoder(w).Encode(cinfo)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/kubelet/dockertools"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
 | 
				
			||||||
	cadvisor "github.com/google/cadvisor/info"
 | 
						cadvisor "github.com/google/cadvisor/info/v1"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,7 +41,7 @@ import (
 | 
				
			|||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
 | 
				
			||||||
	"github.com/fsouza/go-dockerclient"
 | 
						"github.com/fsouza/go-dockerclient"
 | 
				
			||||||
	"github.com/google/cadvisor/info"
 | 
						info "github.com/google/cadvisor/info/v1"
 | 
				
			||||||
	"github.com/stretchr/testify/mock"
 | 
						"github.com/stretchr/testify/mock"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,7 +39,7 @@ import (
 | 
				
			|||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy"
 | 
				
			||||||
	"github.com/golang/glog"
 | 
						"github.com/golang/glog"
 | 
				
			||||||
	"github.com/google/cadvisor/info"
 | 
						info "github.com/google/cadvisor/info/v1"
 | 
				
			||||||
	"github.com/prometheus/client_golang/prometheus"
 | 
						"github.com/prometheus/client_golang/prometheus"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ import (
 | 
				
			|||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
 | 
				
			||||||
	"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy"
 | 
						"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy"
 | 
				
			||||||
	"github.com/google/cadvisor/info"
 | 
						info "github.com/google/cadvisor/info/v1"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type fakeKubelet struct {
 | 
					type fakeKubelet struct {
 | 
				
			||||||
@@ -210,7 +210,7 @@ func TestContainerInfo(t *testing.T) {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("received invalid json data: %v", err)
 | 
							t.Fatalf("received invalid json data: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !reflect.DeepEqual(&receivedInfo, expectedInfo) {
 | 
						if !receivedInfo.Eq(expectedInfo) {
 | 
				
			||||||
		t.Errorf("received wrong data: %#v", receivedInfo)
 | 
							t.Errorf("received wrong data: %#v", receivedInfo)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -240,7 +240,7 @@ func TestContainerInfoWithUidNamespace(t *testing.T) {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("received invalid json data: %v", err)
 | 
							t.Fatalf("received invalid json data: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !reflect.DeepEqual(&receivedInfo, expectedInfo) {
 | 
						if !receivedInfo.Eq(expectedInfo) {
 | 
				
			||||||
		t.Errorf("received wrong data: %#v", receivedInfo)
 | 
							t.Errorf("received wrong data: %#v", receivedInfo)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -281,7 +281,7 @@ func TestRootInfo(t *testing.T) {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("received invalid json data: %v", err)
 | 
							t.Fatalf("received invalid json data: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if !reflect.DeepEqual(&receivedInfo, expectedInfo) {
 | 
						if !receivedInfo.Eq(expectedInfo) {
 | 
				
			||||||
		t.Errorf("received wrong data: %#v", receivedInfo)
 | 
							t.Errorf("received wrong data: %#v", receivedInfo)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user