Merge pull request #51913 from crassirostris/sd-logging-e2e-system-logs-filter

Automatic merge from submit-queue

Fix Stackdriver Logging tests for large clusters

Fixes https://github.com/kubernetes/kubernetes/issues/51700

Due to the limit on the length of the filter, filtering out all nodes in the cluster is not possible. Removing the filter shouldn't affect the tests, since the checks are made based on the nodeIds in the cluster that are unique anyway
This commit is contained in:
Kubernetes Submit Queue 2017-09-04 15:14:17 -07:00 committed by GitHub
commit cb3bb111c1

View File

@ -20,7 +20,6 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"fmt" "fmt"
"strings"
"time" "time"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -210,13 +209,8 @@ func (p *sdLogProvider) buildFilter() (string, error) {
return fmt.Sprintf("resource.type=\"gke_cluster\" AND jsonPayload.metadata.namespace=\"%s\"", return fmt.Sprintf("resource.type=\"gke_cluster\" AND jsonPayload.metadata.namespace=\"%s\"",
p.framework.Namespace.Name), nil p.framework.Namespace.Name), nil
case systemScope: case systemScope:
nodeFilters := []string{} // TODO(instrumentation): Filter logs from the current project only.
for _, nodeID := range utils.GetNodeIds(p.framework.ClientSet) { return "resource.type=\"gce_instance\"", nil
nodeFilter := fmt.Sprintf("resource.labels.instance_id=%s", nodeID)
nodeFilters = append(nodeFilters, nodeFilter)
}
return fmt.Sprintf("resource.type=\"gce_instance\" AND (%s)",
strings.Join(nodeFilters, " OR ")), nil
} }
return "", fmt.Errorf("Unknown log provider scope: %v", p.scope) return "", fmt.Errorf("Unknown log provider scope: %v", p.scope)
} }