Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
99d86cf
Initial Commit of ECK for Logstash
robbavey Feb 10, 2023
11f0f79
Comment out certs for HTTPS for now
robbavey Feb 10, 2023
7414098
Fix up linter issus
robbavey Feb 10, 2023
2304fa3
Generate API docs
robbavey Feb 10, 2023
9459a70
First set of unit tests
robbavey Feb 13, 2023
285c7bf
Fix goimports
robbavey Feb 13, 2023
d6e7ef2
Add version check
robbavey Feb 13, 2023
8016b7b
Add e2e tests
robbavey Feb 14, 2023
6eabf4c
Temporarily take out probes
robbavey Feb 14, 2023
d4908b7
Revert "Temporarily take out probes"
robbavey Feb 15, 2023
b5c775e
Revert "Add e2e tests"
robbavey Feb 15, 2023
33371ad
Fix linter
robbavey Feb 15, 2023
8e6e707
Add logstash config details
robbavey Feb 15, 2023
4afe0de
Fix up typos
robbavey Feb 15, 2023
5f9040f
Revert "Revert "Add e2e tests""
robbavey Feb 15, 2023
803b9ab
Revert "Revert "Temporarily take out probes""
robbavey Feb 15, 2023
0d79bc9
Tidying up
robbavey Feb 16, 2023
4e73a41
Add Logstash to sample and stack tests
robbavey Feb 16, 2023
5713bb4
Added basic logstash verification
robbavey Feb 16, 2023
e66b380
Fix readiness probe
robbavey Feb 16, 2023
9fb1e20
Tidy up
robbavey Feb 16, 2023
34c2aca
add stack monitoring
kaisecheng Feb 16, 2023
131f17c
update test
kaisecheng Feb 21, 2023
b553970
fix sidecar ES ref namespace
kaisecheng Feb 21, 2023
d9f8f90
allow podTemplate update
kaisecheng Feb 21, 2023
f31ba83
fix stack monitoring e2e
kaisecheng Feb 21, 2023
7ff0f46
doc and lint
kaisecheng Feb 22, 2023
9cf60b1
lint
kaisecheng Feb 22, 2023
d7a587e
fix doc gen
kaisecheng Feb 22, 2023
0b41a42
bring back lint
kaisecheng Feb 22, 2023
d96098f
add sample resources for stack monitoring
kaisecheng Feb 23, 2023
8eb21a2
add unit test
kaisecheng Feb 23, 2023
a524216
remove useless NamespacedName as metrics API does not take username a…
kaisecheng Feb 23, 2023
86df8fd
remove useless NamespacedName method
kaisecheng Feb 27, 2023
30aa37b
remove irrelevant es ref
kaisecheng Mar 1, 2023
044b2c9
add issues to track log monitoring
kaisecheng Mar 2, 2023
7e38109
add env LOG_STYLE for log monitoring
kaisecheng Mar 2, 2023
e0699c5
Merge remote-tracking branch 'upstream/feature/logstash' into logstas…
kaisecheng Mar 7, 2023
149a9b7
lint, doc, generate
kaisecheng Mar 7, 2023
b98a36c
update example
kaisecheng Mar 7, 2023
85decbb
add webhook
kaisecheng Mar 7, 2023
ee630d2
add todo
kaisecheng Mar 7, 2023
53aa657
Update pkg/controller/logstash/stackmon/sidecar.go
kaisecheng Mar 8, 2023
3f76e57
Update pkg/apis/logstash/v1alpha1/logstash_types.go
kaisecheng Mar 8, 2023
18609b5
Update pkg/controller/logstash/stackmon/sidecar.go
kaisecheng Mar 8, 2023
9ceef2b
ship deprecation log with filebeat
kaisecheng Mar 8, 2023
ef6437f
add comments
kaisecheng Mar 8, 2023
9c9c12e
use static log4j2.properties
kaisecheng Mar 8, 2023
e4e5d84
rename receiver
kaisecheng Mar 8, 2023
fab33db
remove duplicate container name
kaisecheng Mar 8, 2023
60736da
set minimum es version for test
kaisecheng Mar 8, 2023
0fb3299
add doc for log4j2 requirement
kaisecheng Mar 8, 2023
29c66ff
Revert "set minimum es version for test"
kaisecheng Mar 8, 2023
b5943a4
set minimum es version for test
kaisecheng Mar 9, 2023
48915cf
- refactor version validation
kaisecheng Mar 9, 2023
9c8c999
Update test/e2e/logstash/stack_monitoring_test.go
kaisecheng Mar 20, 2023
76d8756
Update test/e2e/test/logstash/builder.go
kaisecheng Mar 20, 2023
809b32a
Update test/e2e/test/logstash/builder.go
kaisecheng Mar 20, 2023
da2f36e
fix comment
kaisecheng Mar 20, 2023
94e7c75
fix lint and import
kaisecheng Mar 20, 2023
218a1e9
refactor CheckBeatSidecars
kaisecheng Mar 20, 2023
21e3c5b
fix lint
kaisecheng Mar 20, 2023
53ed2df
Update pkg/controller/logstash/driver.go
kaisecheng Mar 21, 2023
ea84d94
Update pkg/apis/logstash/v1alpha1/validations.go
kaisecheng Mar 21, 2023
14563e1
Revert "refactor CheckBeatSidecars"
kaisecheng Mar 21, 2023
62463ac
rename CheckBeatSidecars to CheckBeatSidecarsInElasticsearch
kaisecheng Mar 21, 2023
85bc3e2
lint
kaisecheng Mar 21, 2023
44c9afa
add monitoring status check
kaisecheng Mar 21, 2023
c9d059b
lint
kaisecheng Mar 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ import (
"strings"
"time"

logstashv1alpha1 "github.com/elastic/cloud-on-k8s/v2/pkg/apis/logstash/v1alpha1"
"github.com/elastic/cloud-on-k8s/v2/pkg/controller/logstash"

"github.com/go-logr/logr"
"github.com/spf13/cobra"
"github.com/spf13/viper"
Expand Down Expand Up @@ -847,6 +850,7 @@ func registerControllers(mgr manager.Manager, params operator.Parameters, access
{name: "Agent", registerFunc: agent.Add},
{name: "Maps", registerFunc: maps.Add},
{name: "StackConfigPolicy", registerFunc: stackconfigpolicy.Add},
{name: "Logstash", registerFunc: logstash.Add},
}

for _, c := range controllers {
Expand Down Expand Up @@ -875,6 +879,7 @@ func registerControllers(mgr manager.Manager, params operator.Parameters, access
{name: "ES-MONITORING", registerFunc: associationctl.AddEsMonitoring},
{name: "KB-MONITORING", registerFunc: associationctl.AddKbMonitoring},
{name: "BEAT-MONITORING", registerFunc: associationctl.AddBeatMonitoring},
{name: "LOGSTASH-MONITORING", registerFunc: associationctl.AddLogstashMonitoring},
}

for _, c := range assocControllers {
Expand Down Expand Up @@ -913,6 +918,7 @@ func garbageCollectUsers(ctx context.Context, cfg *rest.Config, managedNamespace
For(&beatv1beta1.BeatList{}, associationctl.BeatAssociationLabelNamespace, associationctl.BeatAssociationLabelName).
For(&agentv1alpha1.AgentList{}, associationctl.AgentAssociationLabelNamespace, associationctl.AgentAssociationLabelName).
For(&emsv1alpha1.ElasticMapsServerList{}, associationctl.MapsESAssociationLabelNamespace, associationctl.MapsESAssociationLabelName).
For(&logstashv1alpha1.LogstashList{}, associationctl.LogstashAssociationLabelNamespace, associationctl.LogstashAssociationLabelName).
DoGarbageCollection(ctx)
if err != nil {
return fmt.Errorf("user garbage collector failed: %w", err)
Expand All @@ -925,14 +931,15 @@ func garbageCollectSoftOwnedSecrets(ctx context.Context, k8sClient k8s.Client) {
defer span.End()

if err := reconciler.GarbageCollectAllSoftOwnedOrphanSecrets(ctx, k8sClient, map[string]client.Object{
esv1.Kind: &esv1.Elasticsearch{},
apmv1.Kind: &apmv1.ApmServer{},
kbv1.Kind: &kbv1.Kibana{},
entv1.Kind: &entv1.EnterpriseSearch{},
beatv1beta1.Kind: &beatv1beta1.Beat{},
agentv1alpha1.Kind: &agentv1alpha1.Agent{},
emsv1alpha1.Kind: &emsv1alpha1.ElasticMapsServer{},
policyv1alpha1.Kind: &policyv1alpha1.StackConfigPolicy{},
esv1.Kind: &esv1.Elasticsearch{},
apmv1.Kind: &apmv1.ApmServer{},
kbv1.Kind: &kbv1.Kibana{},
entv1.Kind: &entv1.EnterpriseSearch{},
beatv1beta1.Kind: &beatv1beta1.Beat{},
agentv1alpha1.Kind: &agentv1alpha1.Agent{},
emsv1alpha1.Kind: &emsv1alpha1.ElasticMapsServer{},
policyv1alpha1.Kind: &policyv1alpha1.StackConfigPolicy{},
logstashv1alpha1.Kind: &logstashv1alpha1.Logstash{},
}); err != nil {
log.Error(err, "Orphan secrets garbage collection failed, will be attempted again at next operator restart.")
return
Expand Down Expand Up @@ -973,6 +980,7 @@ func setupWebhook(
&kbv1.Kibana{},
&kbv1beta1.Kibana{},
&emsv1alpha1.ElasticMapsServer{},
&logstashv1alpha1.Logstash{},
}
for _, obj := range webhookObjects {
if err := commonwebhook.SetupValidatingWebhookWithConfig(&commonwebhook.Config{
Expand Down
708 changes: 708 additions & 0 deletions config/crds/v1/all-crds.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions config/crds/v1/bases/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ resources:
- agent.k8s.elastic.co_agents.yaml
- maps.k8s.elastic.co_elasticmapsservers.yaml
- stackconfigpolicy.k8s.elastic.co_stackconfigpolicies.yaml
- logstash.k8s.elastic.co_logstashes.yaml
8,115 changes: 8,115 additions & 0 deletions config/crds/v1/bases/logstash.k8s.elastic.co_logstashes.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions config/crds/v1/patches/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ patchesJson6902:
kind: CustomResourceDefinition
name: elasticmapsservers.maps.k8s.elastic.co
path: maps-patches.yaml
# custom patches for Beat
- target:
group: apiextensions.k8s.io
version: v1
kind: CustomResourceDefinition
name: logstashes.logstash.k8s.elastic.co
path: logstash-patches.yaml


7 changes: 7 additions & 0 deletions config/crds/v1/patches/logstash-patches.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Using `kubectl apply` stores the complete CRD file as an annotation,
# which may be too big for the annotations size limit.
# One way to mitigate this problem is to remove the (huge) podTemplate properties from the CRD.
# It also avoids the problem of having any k8s-version specific field in the Pod schema,
# that would maybe not match the user's k8s version.
- op: remove
path: /spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/podTemplate/properties
13 changes: 13 additions & 0 deletions config/e2e/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,19 @@ rules:
- update
- patch
- delete
- apiGroups :
- logstash.k8s.elastic.co
resources:
- logstashes
- logstashes/status
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
- apiGroups:
- storage.k8s.io
resources:
Expand Down
27 changes: 27 additions & 0 deletions config/samples/logstash/logstash.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: elasticsearch.k8s.elastic.co/v1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaisecheng should this sample include how to use monitoring? And or, add a new sample that shows how to use monitoring?

kind: Elasticsearch
metadata:
name: elasticsearch-sample
spec:
version: 8.6.1
nodeSets:
- name: default
count: 3
config:
node.store.allow_mmap: false
---
apiVersion: logstash.k8s.elastic.co/v1alpha1
kind: Logstash
metadata:
name: logstash-sample
spec:
count: 3
version: 8.6.1
config:
log.level: info
api.http.host: "0.0.0.0"
queue.type: memory
podTemplate:
spec:
containers:
- name: logstash
22 changes: 22 additions & 0 deletions config/webhook/manifests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,28 @@ webhooks:
resources:
- kibanas
sideEffects: None
- admissionReviewVersions:
- v1
- v1beta1
clientConfig:
service:
name: webhook-service
namespace: system
path: /validate-logstash-k8s-elastic-co-v1alpha1-logstash
failurePolicy: Ignore
matchPolicy: Exact
name: elastic-logstash-validation-v1alpha1.k8s.elastic.co
rules:
- apiGroups:
- logstash.k8s.elastic.co
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- logstashes
sideEffects: None
- admissionReviewVersions:
- v1alpha1
clientConfig:
Expand Down
Loading