-
Notifications
You must be signed in to change notification settings - Fork 166
WIP LOG-2014:Support user defined application inputs #1359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2b1c02d
LOG-2014:Support user defined application inputs
ajaygupta978 7a20bec
LOG-2014:Support user defined application inputs
ajaygupta978 2f64086
LOG-2014:Support user defined application inputs
ajaygupta978 e1308ea
LOG-2014:Support user defined application inputs
ajaygupta978 6f7a419
LOG-2014:Support user defined application inputs
ajaygupta978 adde524
LOG-2014:Support user defined application inputs
ajaygupta978 5771831
LOG-2014:Support user defined application inputs
ajaygupta978 b2e6bf4
LOG-2014:Support user defined application inputs
ajaygupta978 209a736
LOG-2014:Support user defined application inputs
ajaygupta978 f7a753c
LOG-2014:Support user defined application inputs
ajaygupta978 4c94f0f
LOG-2014:Support user defined application inputs
ajaygupta978 961258b
LOG-2014:Support user defined application inputs
ajaygupta978 00af46b
LOG-2014:Support user defined application inputs
ajaygupta978 ce61494
LOG-2014:Support user defined application inputs
ajaygupta978 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package collection | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestCollector(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "ClusterLogging E2E Suite - Collectors") | ||
} |
2 changes: 1 addition & 1 deletion
2
...ection/fluentd/container_security_test.go → ...e2e/collection/container_security_test.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package fluentd | ||
package collection | ||
|
||
import ( | ||
"fmt" | ||
|
This file was deleted.
Oops, something went wrong.
124 changes: 0 additions & 124 deletions
124
test/e2e/collection/fluentd/namespace_filtering_test.go
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
package collection | ||
ajaygupta978 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"path/filepath" | ||
"runtime" | ||
|
||
"github.com/openshift/cluster-logging-operator/internal/constants" | ||
|
||
framework "github.com/openshift/cluster-logging-operator/test/framework/e2e" | ||
|
||
"github.com/ViaQ/logerr/log" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/ginkgo/extensions/table" | ||
. "github.com/onsi/gomega" | ||
logging "github.com/openshift/cluster-logging-operator/apis/logging/v1" | ||
"github.com/openshift/cluster-logging-operator/test/client" | ||
"github.com/openshift/cluster-logging-operator/test/helpers" | ||
elasticsearch "github.com/openshift/elasticsearch-operator/apis/logging/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
var _ = Describe("[Collection] Namespace filtering", func() { | ||
_, filename, _, _ := runtime.Caller(0) | ||
log.Info("Running ", "filename", filename) | ||
var ( | ||
err error | ||
pipelineSecret *corev1.Secret | ||
elasticsearch *elasticsearch.Elasticsearch | ||
e2e = framework.NewE2ETestFramework() | ||
rootDir string | ||
) | ||
var appclient1 *client.Test | ||
var appclient2 *client.Test | ||
|
||
BeforeEach(func() { | ||
appclient1 = client.NewTest() | ||
appclient2 = client.NewTest() | ||
}) | ||
BeforeEach(func() { | ||
if err := e2e.DeployLogGeneratorWithNamespace(appclient1.NS.Name); err != nil { | ||
Fail(fmt.Sprintf("Timed out waiting for the log generator 1 to deploy: %v", err)) | ||
} | ||
if err := e2e.DeployLogGeneratorWithNamespace(appclient2.NS.Name); err != nil { | ||
Fail(fmt.Sprintf("Timed out waiting for the log generator 2 to deploy: %v", err)) | ||
} | ||
rootDir = filepath.Join(filepath.Dir(filename), "..", "..", "..", "/") | ||
if elasticsearch, pipelineSecret, err = e2e.DeployAnElasticsearchCluster(rootDir); err != nil { | ||
Fail(fmt.Sprintf("Unable to deploy an elastic instance: %v", err)) | ||
} | ||
|
||
forwarder := &logging.ClusterLogForwarder{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: logging.ClusterLogForwarderKind, | ||
APIVersion: logging.GroupVersion.String(), | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: "instance", | ||
}, | ||
Spec: logging.ClusterLogForwarderSpec{ | ||
Inputs: []logging.InputSpec{ | ||
{ | ||
Name: "application-logs", | ||
Application: &logging.Application{ | ||
Namespaces: []string{appclient1.NS.Name}, | ||
}, | ||
}, | ||
}, | ||
Outputs: []logging.OutputSpec{ | ||
{ | ||
Name: elasticsearch.Name, | ||
Secret: &logging.OutputSecretSpec{ | ||
Name: pipelineSecret.ObjectMeta.Name, | ||
}, | ||
Type: logging.OutputTypeElasticsearch, | ||
URL: fmt.Sprintf("https://%s.%s.svc:9200", elasticsearch.Name, elasticsearch.Namespace), | ||
}, | ||
}, | ||
Pipelines: []logging.PipelineSpec{ | ||
{ | ||
Name: "test-app", | ||
OutputRefs: []string{elasticsearch.Name}, | ||
InputRefs: []string{"application-logs"}, | ||
}, | ||
}, | ||
}, | ||
} | ||
if err := e2e.CreateClusterLogForwarder(forwarder); err != nil { | ||
Fail(fmt.Sprintf("Unable to create an instance of clusterlogforwarder: %v", err)) | ||
} | ||
}) | ||
|
||
GetNamespaces := func() ([]string, error) { | ||
logs, err := e2e.LogStores[elasticsearch.GetName()].ApplicationLogs(framework.DefaultWaitForLogsTimeout) | ||
if err != nil { | ||
return nil, errors.New("Getting error in application logs") | ||
} | ||
val := len(logs) | ||
namespaceMap := make(map[string]bool) | ||
var namespaceList []string | ||
// Parse each document and extract namespace value | ||
if val > 0 { | ||
for _, document := range logs { | ||
namespace_value := document.Kubernetes.NamespaceName | ||
if _, found := namespaceMap[namespace_value]; !found { | ||
namespaceMap[namespace_value] = true | ||
namespaceList = append(namespaceList, namespace_value) | ||
} | ||
} | ||
} | ||
return namespaceList, nil | ||
} | ||
|
||
DescribeTable("Running collector tests", | ||
func(collectorType helpers.LogComponentType) { | ||
cr := helpers.NewClusterLogging(collectorType) | ||
if err := e2e.CreateClusterLogging(cr); err != nil { | ||
Fail(fmt.Sprintf("Unable to create an instance of cluster logging: %v", err)) | ||
} | ||
if err := e2e.WaitFor(collectorType); err != nil { | ||
Fail(fmt.Sprintf("Failed waiting for component %s to be ready: %v", collectorType, err)) | ||
} | ||
Expect(e2e.LogStores[elasticsearch.GetName()].HasApplicationLogs(framework.DefaultWaitForLogsTimeout)).To(BeTrue(), "Expected to find stored application logs") | ||
|
||
namespaceList, err := GetNamespaces() | ||
Expect(err).To(BeNil(), fmt.Sprintf("Error fetching logs: %v", err)) | ||
Expect(namespaceList).NotTo(BeNil()) | ||
Expect(len(namespaceList)).To(Equal(1)) | ||
Expect(namespaceList[0]).To(Equal(appclient1.NS.Name)) | ||
}, | ||
Entry("for fluentd collector", helpers.ComponentTypeCollectorFluentd), | ||
Entry("for vector collector", helpers.ComponentTypeCollectorVector), | ||
) | ||
|
||
AfterEach(func() { | ||
appclient1.Close() | ||
appclient2.Close() | ||
e2e.Cleanup() | ||
e2e.WaitForCleanupCompletion(constants.OpenshiftNS, []string{constants.CollectorName, "elasticsearch"}) | ||
}, framework.DefaultCleanUpTimeout) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.