vendor update for CSI 0.3.0

This commit is contained in:
gman
2018-07-18 16:47:22 +02:00
parent 6f484f92fc
commit 8ea659f0d5
6810 changed files with 438061 additions and 193861 deletions

View File

@ -16,7 +16,7 @@ go_library(
"//test/e2e/framework:go_default_library",
"//test/e2e/instrumentation/common:go_default_library",
"//test/e2e/instrumentation/logging/elasticsearch:go_default_library",
"//test/e2e/instrumentation/logging/stackdrvier:go_default_library",
"//test/e2e/instrumentation/logging/stackdriver:go_default_library",
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/github.com/onsi/gomega:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
@ -35,7 +35,7 @@ filegroup(
srcs = [
":package-srcs",
"//test/e2e/instrumentation/logging/elasticsearch:all-srcs",
"//test/e2e/instrumentation/logging/stackdrvier:all-srcs",
"//test/e2e/instrumentation/logging/stackdriver:all-srcs",
"//test/e2e/instrumentation/logging/utils:all-srcs",
],
tags = ["automanaged"],

View File

@ -1,8 +1,6 @@
reviewers:
- coffeepac
- crassirostris
- piosz
approvers:
- coffeepac
- crassirostris
- piosz

View File

@ -18,5 +18,5 @@ package logging
import (
_ "k8s.io/kubernetes/test/e2e/instrumentation/logging/elasticsearch"
_ "k8s.io/kubernetes/test/e2e/instrumentation/logging/stackdrvier"
_ "k8s.io/kubernetes/test/e2e/instrumentation/logging/stackdriver"
)

View File

@ -12,13 +12,12 @@ go_library(
"soak.go",
"utils.go",
],
importpath = "k8s.io/kubernetes/test/e2e/instrumentation/logging/stackdrvier",
importpath = "k8s.io/kubernetes/test/e2e/instrumentation/logging/stackdriver",
deps = [
"//test/e2e/framework:go_default_library",
"//test/e2e/instrumentation/common:go_default_library",
"//test/e2e/instrumentation/logging/utils:go_default_library",
"//vendor/github.com/onsi/ginkgo:go_default_library",
"//vendor/golang.org/x/net/context:go_default_library",
"//vendor/golang.org/x/oauth2/google:go_default_library",
"//vendor/google.golang.org/api/logging/v2beta1:go_default_library",
"//vendor/google.golang.org/api/pubsub/v1:go_default_library",

View File

@ -162,7 +162,11 @@ var _ = instrumentation.SIGDescribe("Cluster level logging implemented by Stackd
}()
ginkgo.By("Waiting for events to ingest")
c := utils.NewLogChecker(p, utils.UntilFirstEntry, utils.JustTimeout, "")
location := framework.TestContext.CloudConfig.Zone
if framework.TestContext.CloudConfig.MultiMaster {
location = framework.TestContext.CloudConfig.Region
}
c := utils.NewLogChecker(p, utils.UntilFirstEntryFromLocation(location), utils.JustTimeout, "")
err := utils.WaitForLogs(c, ingestionInterval, ingestionTimeout)
framework.ExpectNoError(err)
})

View File

@ -49,7 +49,7 @@ var _ = instrumentation.SIGDescribe("Cluster level logging implemented by Stackd
maxPodCount := 10
jobDuration := 30 * time.Minute
linesPerPodPerSecond := 100
// TODO(crassirostris): Increase to 21 hrs
// TODO(instrumentation): Increase to 21 hrs
testDuration := 3 * time.Hour
ingestionInterval := 1 * time.Minute
ingestionTimeout := testDuration + 30*time.Minute

View File

@ -17,6 +17,7 @@ limitations under the License.
package stackdriver
import (
"context"
"encoding/base64"
"encoding/json"
"fmt"
@ -27,7 +28,6 @@ import (
"k8s.io/kubernetes/test/e2e/framework"
"k8s.io/kubernetes/test/e2e/instrumentation/logging/utils"
"golang.org/x/net/context"
"golang.org/x/oauth2/google"
sd "google.golang.org/api/logging/v2beta1"
pubsub "google.golang.org/api/pubsub/v1"
@ -49,6 +49,9 @@ const (
// The parallelism level of polling logs process.
sdLoggingPollParallelism = 10
// The limit on the number of stackdriver sinks that can be created within one project.
stackdriverSinkCountLimit = 90
)
type logProviderScope int
@ -86,6 +89,10 @@ func newSdLogProvider(f *framework.Framework, scope logProviderScope) (*sdLogPro
if err != nil {
return nil, err
}
err = ensureProjectHasSinkCapacity(sdService.Projects.Sinks, framework.TestContext.CloudConfig.ProjectID)
if err != nil {
return nil, err
}
pubsubService, err := pubsub.New(hc)
if err != nil {
@ -104,6 +111,36 @@ func newSdLogProvider(f *framework.Framework, scope logProviderScope) (*sdLogPro
return provider, nil
}
func ensureProjectHasSinkCapacity(sinksService *sd.ProjectsSinksService, projectID string) error {
listResponse, err := listSinks(sinksService, projectID)
if err != nil {
return err
}
if len(listResponse.Sinks) >= stackdriverSinkCountLimit {
framework.Logf("Reached Stackdriver sink limit. Deleting all sinks")
deleteSinks(sinksService, projectID, listResponse.Sinks)
}
return nil
}
func listSinks(sinksService *sd.ProjectsSinksService, projectID string) (*sd.ListSinksResponse, error) {
projectDst := fmt.Sprintf("projects/%s", projectID)
listResponse, err := sinksService.List(projectDst).PageSize(stackdriverSinkCountLimit).Do()
if err != nil {
return nil, fmt.Errorf("failed to list Stackdriver Logging sinks: %v", err)
}
return listResponse, nil
}
func deleteSinks(sinksService *sd.ProjectsSinksService, projectID string, sinks []*sd.LogSink) {
for _, sink := range sinks {
sinkNameID := fmt.Sprintf("projects/%s/sinks/%s", projectID, sink.Name)
if _, err := sinksService.Delete(sinkNameID).Do(); err != nil {
framework.Logf("Failed to delete LogSink: %v", err)
}
}
}
func (p *sdLogProvider) Init() error {
projectID := framework.TestContext.CloudConfig.ProjectID
nsName := p.framework.Namespace.Name

View File

@ -26,7 +26,7 @@ func GetNodeIds(cs clientset.Interface) []string {
nodes := framework.GetReadySchedulableNodesOrDie(cs)
nodeIds := []string{}
for _, n := range nodes.Items {
nodeIds = append(nodeIds, n.Spec.ExternalID)
nodeIds = append(nodeIds, n.Name)
}
return nodeIds
}

View File

@ -48,9 +48,19 @@ func UntilFirstEntryFromLog(log string) IngestionPred {
return func(_ string, entries []LogEntry) (bool, error) {
for _, e := range entries {
if e.LogName == log {
if e.Location != framework.TestContext.CloudConfig.Zone {
return false, fmt.Errorf("Bad location in logs '%s' != '%d'", e.Location, framework.TestContext.CloudConfig.Zone)
}
return true, nil
}
}
return false, nil
}
}
// UntilFirstEntryFromLocation is a IngestionPred that checks that at least one
// entry from the log with a given name was ingested.
func UntilFirstEntryFromLocation(location string) IngestionPred {
return func(_ string, entries []LogEntry) (bool, error) {
for _, e := range entries {
if e.Location == location {
return true, nil
}
}