-
Notifications
You must be signed in to change notification settings - Fork 788
Logstash pipelines #6480
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
Merged
kaisecheng
merged 164 commits into
elastic:feature/logstash
from
kaisecheng:logstash_pipelines
Apr 6, 2023
Merged
Logstash pipelines #6480
Changes from 155 commits
Commits
Show all changes
164 commits
Select commit
Hold shift + click to select a range
99d86cf
Initial Commit of ECK for Logstash
robbavey 11f0f79
Comment out certs for HTTPS for now
robbavey 7414098
Fix up linter issus
robbavey 2304fa3
Generate API docs
robbavey 9459a70
First set of unit tests
robbavey 285c7bf
Fix goimports
robbavey d6e7ef2
Add version check
robbavey 8016b7b
Add e2e tests
robbavey 6eabf4c
Temporarily take out probes
robbavey d4908b7
Revert "Temporarily take out probes"
robbavey b5c775e
Revert "Add e2e tests"
robbavey 33371ad
Fix linter
robbavey 8e6e707
Add logstash config details
robbavey 4afe0de
Fix up typos
robbavey 5f9040f
Revert "Revert "Add e2e tests""
robbavey 803b9ab
Revert "Revert "Temporarily take out probes""
robbavey 0d79bc9
Tidying up
robbavey 4e73a41
Add Logstash to sample and stack tests
robbavey 5713bb4
Added basic logstash verification
robbavey e66b380
Fix readiness probe
robbavey 9fb1e20
Tidy up
robbavey 34c2aca
add stack monitoring
kaisecheng 131f17c
update test
kaisecheng b553970
fix sidecar ES ref namespace
kaisecheng d9f8f90
allow podTemplate update
kaisecheng f31ba83
fix stack monitoring e2e
kaisecheng 7ff0f46
doc and lint
kaisecheng 9cf60b1
lint
kaisecheng d7a587e
fix doc gen
kaisecheng 0b41a42
bring back lint
kaisecheng d96098f
add sample resources for stack monitoring
kaisecheng 8eb21a2
add unit test
kaisecheng a524216
remove useless NamespacedName as metrics API does not take username a…
kaisecheng 86df8fd
remove useless NamespacedName method
kaisecheng ce56d6a
Initial Commit of ECK for Logstash
robbavey 02a5451
Comment out certs for HTTPS for now
robbavey b72182f
Fix up linter issus
robbavey 9cf0a45
Generate API docs
robbavey 4d62ab5
First set of unit tests
robbavey cf1379c
Fix goimports
robbavey e5a4621
Add version check
robbavey a74da1d
Add e2e tests
robbavey d3878a5
Temporarily take out probes
robbavey cd7f8f6
Revert "Temporarily take out probes"
robbavey 793ff28
Revert "Add e2e tests"
robbavey 1a83870
Fix linter
robbavey d3edd1e
Add logstash config details
robbavey 4e4303d
Fix up typos
robbavey 50e834e
Revert "Revert "Add e2e tests""
robbavey 2692661
Revert "Revert "Temporarily take out probes""
robbavey 865d06a
Tidying up
robbavey 84dd489
Add Logstash to sample and stack tests
robbavey 12430d9
Added basic logstash verification
robbavey d2ac277
Fix readiness probe
robbavey 214f63d
Tidy up
robbavey b9cb06a
Update config/crds/v1/patches/kustomization.yaml
kaisecheng 51f2bad
Update pkg/apis/logstash/v1alpha1/name.go
kaisecheng b52d9ee
change HTTPConfig to []LogstashService
kaisecheng 94b84b5
webhook check all rules
kaisecheng 1cfb725
remove building config from existing config in Secret
kaisecheng bb79c17
rename k8sutils EmitErrorEvent() to MaybeEmitErrorEvent()
kaisecheng 8ec1501
remove nil error in StatefulSet
kaisecheng aec57e4
remove APIError struct in test
kaisecheng b27445c
add license header
kaisecheng 746a307
lint
kaisecheng 822f0ab
reconcileConfig return error
kaisecheng 0a37afe
change the default Service to headless service
kaisecheng df96068
fix service test
kaisecheng 4c414bd
fix podTemplate and doc generation
kaisecheng 018dfbc
Fix Service tests
robbavey de1fb22
Update comments to reflect change from HTTPConfig to LogstashService
robbavey 41612f7
Update pkg/controller/logstash/service.go
robbavey a0d176a
remove duplicate err check
kaisecheng b9610da
Add support for overriding "default" service
robbavey 0c9409a
Replace 'default' service name with 'api'
robbavey 6167cb7
merge from feature/logstash
robbavey 30aa37b
remove irrelevant es ref
kaisecheng d4c5e05
Add tests and checks for services and endpoints
robbavey 044b2c9
add issues to track log monitoring
kaisecheng 7e38109
add env LOG_STYLE for log monitoring
kaisecheng 1f77430
Update pkg/apis/logstash/v1alpha1/webhook.go
robbavey b677c65
Update pkg/controller/logstash/service.go
robbavey a797940
Addressing code review comments
robbavey 315a803
add pipeline config and unit test
kaisecheng 9f6ccf1
add pipeline to sample
kaisecheng db5dd82
lint and doc
kaisecheng e94b7f3
add e2e test
kaisecheng e0699c5
Merge remote-tracking branch 'upstream/feature/logstash' into logstas…
kaisecheng 149a9b7
lint, doc, generate
kaisecheng b98a36c
update example
kaisecheng 85decbb
add webhook
kaisecheng ee630d2
add todo
kaisecheng e1a413c
Merge remote-tracking branch 'upstream/feature/logstash' into logstas…
kaisecheng 6fc77c0
lint, doc and generate
kaisecheng 6badd2e
add pipelines and pipelinesRef validation
kaisecheng 3d2f47b
rename and comment pipelines config
kaisecheng 53aa657
Update pkg/controller/logstash/stackmon/sidecar.go
kaisecheng 3f76e57
Update pkg/apis/logstash/v1alpha1/logstash_types.go
kaisecheng 18609b5
Update pkg/controller/logstash/stackmon/sidecar.go
kaisecheng 9ceef2b
ship deprecation log with filebeat
kaisecheng ef6437f
add comments
kaisecheng 9c9c12e
use static log4j2.properties
kaisecheng e4e5d84
rename receiver
kaisecheng fab33db
remove duplicate container name
kaisecheng 60736da
set minimum es version for test
kaisecheng 0fb3299
add doc for log4j2 requirement
kaisecheng 29c66ff
Revert "set minimum es version for test"
kaisecheng 461fbf7
reuse ParseConfigRef
kaisecheng 16092ca
lint
kaisecheng b5943a4
set minimum es version for test
kaisecheng 48915cf
- refactor version validation
kaisecheng 7c57920
change Pipelines to []commonv1.Config
kaisecheng 092508e
remove pipelinesref watch
kaisecheng 9c8c999
Update test/e2e/logstash/stack_monitoring_test.go
kaisecheng 76d8756
Update test/e2e/test/logstash/builder.go
kaisecheng 809b32a
Update test/e2e/test/logstash/builder.go
kaisecheng da2f36e
fix comment
kaisecheng 94e7c75
fix lint and import
kaisecheng 218a1e9
refactor CheckBeatSidecars
kaisecheng 21e3c5b
fix lint
kaisecheng 53ed2df
Update pkg/controller/logstash/driver.go
kaisecheng ea84d94
Update pkg/apis/logstash/v1alpha1/validations.go
kaisecheng 14563e1
Revert "refactor CheckBeatSidecars"
kaisecheng 62463ac
rename CheckBeatSidecars to CheckBeatSidecarsInElasticsearch
kaisecheng 85bc3e2
lint
kaisecheng 44c9afa
add monitoring status check
kaisecheng c9d059b
lint
kaisecheng 0cd242e
rename configRef to pipelinesRef
kaisecheng f7ea881
fix metrics check in test
kaisecheng 4c15694
Merge remote-tracking branch 'origin/logstash_stack_monitoring' into …
kaisecheng 80ad3e1
generate crd
kaisecheng 569b319
rename configRef to pipelinesRef
kaisecheng 4d7855d
Merge branch 'feature/logstash' into logstash_pipelines
kaisecheng 7057ed3
fix generate
kaisecheng e2a4831
Update pkg/controller/logstash/pipeline_test.go
kaisecheng 2b8056c
Update pkg/controller/logstash/pipeline_test.go
kaisecheng eba35e8
Update pkg/controller/logstash/pipeline_test.go
kaisecheng 677be46
Update pkg/controller/logstash/pipeline_test.go
kaisecheng 0a57f07
fix rename
kaisecheng 9a4af9b
change metric check to eventually
kaisecheng f012dcb
fix pipeline id in test
kaisecheng 8943822
Update pkg/controller/logstash/pipelines_config.go
kaisecheng 980a505
Update pkg/controller/logstash/pipelines_config.go
kaisecheng 124d774
Update pkg/controller/logstash/pipeline.go
kaisecheng 9089f79
Update pkg/controller/logstash/pipeline.go
kaisecheng 8cdb763
Update test/e2e/test/logstash/builder.go
kaisecheng 6ceda8c
move test func to test class
kaisecheng 9922520
Update pkg/apis/logstash/v1alpha1/logstash_types.go
kaisecheng 7a0072d
Update test/e2e/logstash/pipeline_test.go
kaisecheng 4a47fb4
Update test/e2e/logstash/pipeline_test.go
kaisecheng 754a74e
update metrics api checking
kaisecheng d8cf066
fix naming pipelines.yml
kaisecheng a976bda
delete pipeline secret at the end of test
kaisecheng b6b4ad0
fix naming pipelines.yml
kaisecheng eebc8a6
move pipelines_*.go to pipelines package
kaisecheng 8d52421
rename & comment
kaisecheng 991e636
lint
kaisecheng 7bb3f5d
Update pkg/controller/logstash/pipelines/config.go
kaisecheng 7e816da
Update pkg/controller/logstash/pipelines/config.go
kaisecheng 791e02d
Update pkg/controller/logstash/pipelines/config.go
kaisecheng 9967ca4
Update pkg/controller/logstash/pipelines/config.go
kaisecheng 203a3b4
Update test/e2e/logstash/pipeline_test.go
kaisecheng f756314
Update test/e2e/logstash/pipeline_test.go
kaisecheng 3cc5964
import grouping
kaisecheng 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
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,83 @@ | ||
| // Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| // or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
| // you may not use this file except in compliance with the Elastic License 2.0. | ||
|
|
||
| package logstash | ||
|
|
||
| import ( | ||
| "hash" | ||
|
|
||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
|
||
| logstashv1alpha1 "github.com/elastic/cloud-on-k8s/v2/pkg/apis/logstash/v1alpha1" | ||
| "github.com/elastic/cloud-on-k8s/v2/pkg/controller/common/labels" | ||
| "github.com/elastic/cloud-on-k8s/v2/pkg/controller/common/reconciler" | ||
| "github.com/elastic/cloud-on-k8s/v2/pkg/controller/common/tracing" | ||
| "github.com/elastic/cloud-on-k8s/v2/pkg/controller/logstash/pipelines" | ||
| ) | ||
|
|
||
| func reconcilePipeline(params Params, configHash hash.Hash) error { | ||
| defer tracing.Span(¶ms.Context)() | ||
|
|
||
| cfgBytes, err := buildPipeline(params) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
| expected := corev1.Secret{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Namespace: params.Logstash.Namespace, | ||
| Name: logstashv1alpha1.PipelineSecretName(params.Logstash.Name), | ||
| Labels: labels.AddCredentialsLabel(NewLabels(params.Logstash)), | ||
| }, | ||
| Data: map[string][]byte{ | ||
| PipelineFileName: cfgBytes, | ||
| }, | ||
| } | ||
|
|
||
| if _, err = reconciler.ReconcileSecret(params.Context, params.Client, expected, ¶ms.Logstash); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| _, _ = configHash.Write(cfgBytes) | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func buildPipeline(params Params) ([]byte, error) { | ||
| userProvidedCfg, err := getUserPipeline(params) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| if userProvidedCfg != nil { | ||
| return userProvidedCfg.Render() | ||
| } | ||
|
|
||
| cfg := defaultPipeline | ||
| return cfg.Render() | ||
| } | ||
|
|
||
| // getUserPipeline extracts the pipeline either from the spec `pipeline` field or from the Secret referenced by spec | ||
| // `pipelineRef` field. | ||
| func getUserPipeline(params Params) (*pipelines.Config, error) { | ||
| if params.Logstash.Spec.Pipelines != nil { | ||
| pipes := make([]map[string]interface{}, 0, len(params.Logstash.Spec.Pipelines)) | ||
| for _, p := range params.Logstash.Spec.Pipelines { | ||
| pipes = append(pipes, p.Data) | ||
| } | ||
|
|
||
| return pipelines.FromSpec(pipes) | ||
| } | ||
| return pipelines.ParseConfigRef(params, ¶ms.Logstash, params.Logstash.Spec.PipelinesRef, PipelineFileName) | ||
| } | ||
|
|
||
| var ( | ||
| defaultPipeline = pipelines.MustFromSpec([]map[string]string{ | ||
| { | ||
| "pipeline.id": "main", | ||
| "path.config": "/usr/share/logstash/pipeline", | ||
| }, | ||
| }) | ||
| ) |
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.