Skip to content

Commit

Permalink
Support multiple instances
Browse files Browse the repository at this point in the history
  • Loading branch information
DebakelOrakel committed Aug 9, 2024
1 parent 8f57847 commit 3283b2b
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 14 deletions.
6 changes: 5 additions & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
parameters:
fluentbit:
=_metadata:
multi_instance: true

namespace: syn-fluentbit
createNamespace: true

charts:
fluent-bit:
Expand All @@ -16,7 +20,7 @@ parameters:
annotations:
fluentbit.io/exclude: "true"

configMapName: syn-fluentbit-config
configMapName: fluentbit-${_instance}
config:
# fluent-bit service config
service:
Expand Down
13 changes: 6 additions & 7 deletions class/fluentbit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parameters:
kapitan:
dependencies:
- type: helm
output_path: dependencies/fluentbit/helmcharts/fluent-bit-${fluentbit:charts:fluent-bit:version}
output_path: dependencies/${_instance}/helmcharts/fluent-bit-${fluentbit:charts:fluent-bit:version}
source: ${fluentbit:charts:fluent-bit:source}
version: ${fluentbit:charts:fluent-bit:version}
chart_name: fluent-bit
Expand All @@ -14,12 +14,11 @@ parameters:
- input_paths:
- fluentbit/component/main.jsonnet
input_type: jsonnet
output_path: fluentbit/
- output_path: fluentbit/01_fluentbit_helmchart
output_path: fluentbit/${_instance}/
- input_paths:
- dependencies/${_instance}/helmcharts/fluent-bit-${fluentbit:charts:fluent-bit:version}
input_type: helm
output_type: yaml
input_paths:
- fluentbit/helmcharts/fluent-bit-${fluentbit:charts:fluent-bit:version}
output_path: fluentbit/${_instance}/01_fluentbit_helmchart
helm_values: ${fluentbit:helm_values}
helm_params:
namespace: ${fluentbit:namespace}
Expand All @@ -28,5 +27,5 @@ parameters:
postprocess:
filters:
- type: jsonnet
path: fluentbit/01_fluentbit_helmchart/fluent-bit/templates
path: fluentbit/${_instance}/01_fluentbit_helmchart/fluent-bit/templates
filter: postprocess/patch_helm_output.jsonnet
4 changes: 2 additions & 2 deletions component/app.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ local inv = kap.inventory();
local params = inv.parameters.fluentbit;
local argocd = import 'lib/argocd.libjsonnet';

local app = argocd.App('fluentbit', params.namespace);
local app = argocd.App(inv.parameters._instance, params.namespace);

{
fluentbit: app,
[inv.parameters._instance]: app,
}
2 changes: 1 addition & 1 deletion component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ local configmap = kube.ConfigMap(params.configMapName) {
};

{
'00_namespace': kube.Namespace(params.namespace),
[if params.createNamespace then '00_namespace']: kube.Namespace(params.namespace),
'10_custom_config': configmap,
[if params.monitoring.enabled then '20_service_monitor']:
kube._Object('monitoring.coreos.com/v1', 'ServiceMonitor', 'fluent-bit') {
Expand Down
16 changes: 16 additions & 0 deletions docs/modules/ROOT/pages/references/parameters.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ default:: `syn-fluentbit`

The namespace in which to deploy this component.

== `createNamespace`

[horizontal]
type:: bool
default:: true

Wether to create the configured namespace or not.

== `configMapName`

[horizontal]
type:: string
default:: `fluentbit-${_instance}`

The name of the generated ConfigMap.

== `config`

[horizontal]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ spec:
serviceAccountName: fluent-bit
volumes:
- configMap:
name: syn-fluentbit-config
name: fluentbit-fluentbit
name: config
- hostPath:
path: /var/log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ metadata:
app.kubernetes.io/managed-by: commodore
app.kubernetes.io/name: fluent-bit
app.kubernetes.io/version: 3.1.4
name: syn-fluentbit-config
name: syn-fluentbit-config
name: fluentbit-fluentbit
name: fluentbit-fluentbit
namespace: syn-fluentbit

0 comments on commit 3283b2b

Please sign in to comment.