-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1584 from OverOrion/extract-fluentd-crd
Standalone FluentdConfig resource
- Loading branch information
Showing
40 changed files
with
7,370 additions
and
500 deletions.
There are no files selected for viewing
2,918 changes: 2,918 additions & 0 deletions
2,918
charts/logging-operator/crds/logging.banzaicloud.io_fluentdconfigs.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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
2,918 changes: 2,918 additions & 0 deletions
2,918
config/crd/bases/logging.banzaicloud.io_fluentdconfigs.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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,120 @@ | ||
## Standalone Fluentd config | ||
|
||
The standalone `FluentdConfig` is a namespaced resource that allows the configuration of the Fluentd / SyslogNG | ||
aggregator component in the control namespace separately from the Logging resource. | ||
|
||
The primary benefit of this behaviour is that it enables a multi-tenant model, where tenant owners are responsible | ||
for operating their own aggregator, while the Logging resource is in control of the central operations team. | ||
For more information about the multi-tenancy model where the collector is capable of routing logs based on namespaces | ||
to individual aggregators and where aggregators are fully isolated, please see [Multi-tenancy](multi-tenancy.md) | ||
|
||
Traditional configuration of fluentd within the logging resource: | ||
``` | ||
apiVersion: logging.banzaicloud.io/v1beta1 | ||
kind: Logging | ||
metadata: | ||
name: example | ||
spec: | ||
controlNamespace: logging | ||
fluentd: | ||
scaling: | ||
replicas: 2 | ||
``` | ||
|
||
The alternative configuration is as follows: | ||
``` | ||
apiVersion: logging.banzaicloud.io/v1beta1 | ||
kind: Logging | ||
metadata: | ||
name: example | ||
spec: | ||
controlNamespace: logging | ||
--- | ||
apiVersion: logging.banzaicloud.io/v1beta1 | ||
kind: FluentdConfig | ||
metadata: | ||
name: example | ||
namespace: logging | ||
spec: | ||
scaling: | ||
replicas: 2 | ||
``` | ||
|
||
### Schema and migration | ||
|
||
The schema for `FluentdConfig.spec` is the same as it was withing `Logging.spec.fluentd`, so the migration should be a trivial lift and shift | ||
exercise. | ||
|
||
### Restrictions and status | ||
|
||
There can only be one active `FluentdConfig` for a single `Logging` resource at a time. The controller will make | ||
sure to register the active `FluentdConfig` resource into the `Logging` resource's status under `fluentdConfigName`, | ||
while registering the `Logging` resource name under `logging` in the `FluentdConfig` resource's status. | ||
|
||
``` | ||
kubectl get logging example -o jsonpath='{.status}' | jq . | ||
{ | ||
"configCheckResults": { | ||
"ac2d4553": true | ||
}, | ||
"fluentdConfigName": "example" | ||
} | ||
``` | ||
|
||
``` | ||
kubectl get fluentdconfig example -o jsonpath='{.status}' | jq . | ||
{ | ||
"active": true, | ||
"logging": "example" | ||
} | ||
``` | ||
|
||
If there is a conflict, then the controller will add a problem to both resources so that both operations and tenant users can be aware of it. | ||
For example add another `FluentdConfig` resource on top of the existing one: | ||
|
||
``` | ||
apiVersion: logging.banzaicloud.io/v1beta1 | ||
kind: FluentdConfig | ||
metadata: | ||
name: example2 | ||
namespace: logging | ||
spec: {} | ||
``` | ||
|
||
The first `FluentdConfig` should be left intact, while the second one should have the following status: | ||
``` | ||
kubectl get fluentdconfig example2 -o jsonpath='{.status}' | jq . | ||
{ | ||
"active": false, | ||
"problems": [ | ||
"logging already has a detached fluentd configuration, remove excess configuration objects" | ||
], | ||
"problemsCount": 1 | ||
} | ||
``` | ||
|
||
The `Logging` resource will also highlight the issue | ||
``` | ||
kubectl get logging example -o jsonpath='{.status}' | jq . | ||
{ | ||
"configCheckResults": { | ||
"ac2d4553": true | ||
}, | ||
"fluentdConfigName": "example", | ||
"problems": [ | ||
"multiple fluentd configurations found, couldn't associate it with logging" | ||
], | ||
"problemsCount": 1 | ||
} | ||
``` | ||
|
||
Once the extra `FluentdConfig` resource is removed the `Logging` resource status should return back to normal: | ||
``` | ||
kubectl get logging example -o jsonpath='{.status}' | jq . | ||
{ | ||
"configCheckResults": { | ||
"ac2d4553": true | ||
}, | ||
"fluentdConfigName": "example" | ||
} | ||
``` |
Oops, something went wrong.