-
Notifications
You must be signed in to change notification settings - Fork 145
Ingest non-cluster flows through fluentd #3954
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
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 |
---|---|---|
|
@@ -19,6 +19,7 @@ import ( | |
"fmt" | ||
"strings" | ||
|
||
"github.com/tigera/operator/pkg/dns" | ||
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/api/errors" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
|
@@ -157,6 +158,9 @@ func add(mgr manager.Manager, c ctrlruntime.Controller) error { | |
return fmt.Errorf("logcollector-controller failed to watch log-collector Tigerastatus: %w", err) | ||
} | ||
|
||
if err = c.WatchObject(&operatorv1.NonClusterHost{}, &handler.EnqueueRequestForObject{}); err != nil { | ||
return fmt.Errorf("logcollector-controller failed to watch resource: %w", err) | ||
} | ||
return nil | ||
} | ||
|
||
|
@@ -374,7 +378,8 @@ func (r *ReconcileLogCollector) Reconcile(ctx context.Context, request reconcile | |
} | ||
|
||
// fluentdKeyPair is the key pair fluentd presents to identify itself | ||
fluentdKeyPair, err := certificateManager.GetOrCreateKeyPair(r.client, render.FluentdPrometheusTLSSecretName, common.OperatorNamespace(), []string{render.FluentdPrometheusTLSSecretName}) | ||
httpInputServiceNames := dns.GetServiceDNSNames(render.FluentdInputService, render.LogCollectorNamespace, r.clusterDomain) | ||
fluentdKeyPair, err := certificateManager.GetOrCreateKeyPair(r.client, render.FluentdPrometheusTLSSecretName, common.OperatorNamespace(), append([]string{render.FluentdPrometheusTLSSecretName}, httpInputServiceNames...)) | ||
if err != nil { | ||
r.status.SetDegraded(operatorv1.ResourceCreateError, "Error creating TLS certificate", err, reqLogger) | ||
return reconcile.Result{}, err | ||
|
@@ -563,6 +568,19 @@ func (r *ReconcileLogCollector) Reconcile(ctx context.Context, request reconcile | |
return reconcile.Result{}, err | ||
} | ||
|
||
// Check if non-cluster host feature is enabled. | ||
nonclusterhost, err := utils.GetNonClusterHost(ctx, r.client) | ||
if err != nil { | ||
r.status.SetDegraded(operatorv1.ResourceReadError, "Failed to query NonClusterHost resource", err, reqLogger) | ||
return reconcile.Result{}, err | ||
} | ||
if nonclusterhost != nil { | ||
if _, _, _, err := url.ParseEndpoint(nonclusterhost.Spec.Endpoint); err != nil { | ||
r.status.SetDegraded(operatorv1.ResourceReadError, "Failed to read parse endpoint from NonClusterHost resource", err, reqLogger) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be helpful to add |
||
return reconcile.Result{}, err | ||
} | ||
} | ||
|
||
// Create a component handler to manage the rendered component. | ||
handler := utils.NewComponentHandler(log, r.client, r.scheme, instance) | ||
|
||
|
@@ -585,6 +603,7 @@ func (r *ReconcileLogCollector) Reconcile(ctx context.Context, request reconcile | |
ExternalElastic: r.externalElastic, | ||
EKSLogForwarderKeyPair: eksLogForwarderKeyPair, | ||
PacketCapture: packetcaptureapi, | ||
NonClusterHost: nonclusterhost, | ||
} | ||
// Render the fluentd component for Linux | ||
comp := render.Fluentd(fluentdCfg) | ||
|
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Today, the only situation where we want to omit part of the data is nch vs standard, but in the future we may have other such scenarios. For this reason it may be better to think of a different field name with string type enum values that describe the modes that we want to support.