Skip to content

Commit

Permalink
Move deprecated collector config
Browse files Browse the repository at this point in the history
  • Loading branch information
DebakelOrakel committed Feb 28, 2024
1 parent a79ee05 commit 3da50ae
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 16 deletions.
4 changes: 1 addition & 3 deletions class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ parameters:
nodeSelector:
node-role.kubernetes.io/infra: ''
collection:
logs:
type: fluentd
fluentd: {}
type: fluentd

clusterLogForwarding:
enabled: false
Expand Down
22 changes: 21 additions & 1 deletion component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ local namespace_groups = (
{}
) + params.clusterLogForwarding.namespace_groups;

// --- Patch deprecated logging resource
local legacyCollectionConfig = std.get(params.clusterLogging.collection, 'logs', {});
local legacyCollectionPatch = if std.length(legacyCollectionConfig) > 0 then std.trace(
'Parameter `clusterLogging.collector.logs` is deprecated. Please update your config to use `clusterLogging.collector`',
{
local type = std.get(legacyCollectionConfig, 'type', ''),
local fluentd = std.get(legacyCollectionConfig, 'fluentd', {}),
collection+: {
[if type != '' then 'type']: type,
} + if std.length(fluentd) > 0 then fluentd,
}
) else {};
local clusterLogging = params.clusterLogging {
collection: {
[it]: params.clusterLogging.collection[it]
for it in std.objectFields(params.clusterLogging.collection)
if it != 'logs'
},
} + legacyCollectionPatch;
// --- End patch

{
'00_namespace': kube.Namespace(params.namespace) {
Expand Down Expand Up @@ -95,7 +115,7 @@ local namespace_groups = (
'argocd.argoproj.io/sync-options': 'SkipDryRunOnMissingResource=true',
},
},
spec: params.clusterLogging,
spec: clusterLogging,
}, {
// Patch to remove certain keys, as the ClusterLogging operator would just
// deploy elasticsearch or kibana if they are configured
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ metadata:
namespace: openshift-logging
spec:
collection:
logs:
fluentd: {}
type: fluentd
type: fluentd
logStore:
elasticsearch:
nodeCount: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ metadata:
namespace: openshift-logging
spec:
collection:
logs:
fluentd: {}
type: fluentd
type: fluentd
logStore:
lokistack:
name: loki
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ metadata:
namespace: openshift-logging
spec:
collection:
logs:
fluentd: {}
type: fluentd
type: fluentd
logStore:
elasticsearch:
nodeCount: 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ metadata:
namespace: openshift-logging
spec:
collection:
logs:
fluentd: {}
type: fluentd
type: fluentd
logStore:
elasticsearch:
nodeCount: 3
Expand Down

0 comments on commit 3da50ae

Please sign in to comment.