diff --git a/CHANGELOG.md b/CHANGELOG.md
index d89a264959..f7b7e8deba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@
- [PR #349](https://github.com/konpyutaika/nifikop/pull/349) - **[Operator/NifiRegistryClient]** Set FlowRegistry type in RegistryClient creation.
- [PR #350](https://github.com/konpyutaika/nifikop/pull/350) - **[Operator]** Remove optimistic lock on `Patch`.
- [PR #352](https://github.com/konpyutaika/nifikop/pull/352) - **[Operator]** Changed default LogLevel of NiFi from `DEBUG` to `INFO`.
+- [PR #353](https://github.com/konpyutaika/nifikop/pull/353) - **[Operator/NifiCluster]** Removed `logback.xml` template.
- [PR #354](https://github.com/konpyutaika/nifikop/pull/354) - **[Operator/NifiCluster]** Updated `login_identity_providers.xml` template for 2.0.0-M1.
### Fixed Bugs
diff --git a/api/v1/nificluster_types.go b/api/v1/nificluster_types.go
index 60e916eede..f29c898309 100644
--- a/api/v1/nificluster_types.go
+++ b/api/v1/nificluster_types.go
@@ -292,9 +292,9 @@ type BootstrapProperties struct {
// Logback configuration that will be applied to the node.
type LogbackConfig struct {
- // logback.xml configuration that will replace the one produced based on template
+ // logback.xml configuration that will replace the one provided by NiFi
ReplaceConfigMap *ConfigmapReference `json:"replaceConfigMap,omitempty"`
- // logback.xml configuration that will replace the one produced based on template and overrideConfigMap
+ // logback.xml configuration that will replace the one provided by NiFi and overrideConfigMap
ReplaceSecretConfig *SecretConfigReference `json:"replaceSecretConfig,omitempty"`
}
diff --git a/config/samples/nifi_v1_nificluster.yaml b/config/samples/nifi_v1_nificluster.yaml
index 67c396edef..71e2a6c217 100644
--- a/config/samples/nifi_v1_nificluster.yaml
+++ b/config/samples/nifi_v1_nificluster.yaml
@@ -59,7 +59,7 @@ spec:
maximumTimerDrivenThreadCount: 30
# Logback configuration that will be applied to the node
logbackConfig:
- # logback.xml configuration that will replace the one produced based on template
+ # logback.xml configuration that will replace the one provided by NiFi
replaceConfigMap:
# The key of the value,in data content, that we want use.
data: logback.xml
@@ -67,7 +67,7 @@ spec:
name: raw
# Namespace where is located the secret that we want to refer.
namespace: nifikop
- # logback.xml configuration that will replace the one produced based on template and overrideConfigMap
+ # logback.xml configuration that will replace the one provided by NiFi and overrideConfigMap
replaceSecretConfig:
# The key of the value,in data content, that we want use.
data: logback.xml
diff --git a/helm/nifi-cluster/config/logback.xml b/helm/nifi-cluster/config/logback.xml
index 0fe78cf6a6..9852c27836 100644
--- a/helm/nifi-cluster/config/logback.xml
+++ b/helm/nifi-cluster/config/logback.xml
@@ -15,6 +15,8 @@
-->
+
+
true
@@ -29,9 +31,14 @@
To ZIP rolled files, replace '.log' with '.log.zip'.
-->
${org.apache.nifi.bootstrap.config.log.dir}/nifi-app_%d{yyyy-MM-dd_HH}.%i.log
- 5MB
- 2
- 15MB
+
+ 100MB
+
+ 30
+
+ 3GB
+
+ true
true
@@ -41,43 +48,112 @@
${org.apache.nifi.bootstrap.config.log.dir}/nifi-user.log
-
+
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-user_%d{yyyy-MM-dd_HH}.%i.log
- 2
- 5MB
- 15MB
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-user_%d.log
+
+ 30
+
+ 3GB
+
+ true
%date %level [%thread] %logger{40} %msg%n
+
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-request.log
+
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-request_%d.log
+
+ 30
+
+ 3GB
+
+ true
+
+
+ %msg%n
+
+
+
${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap.log
-
+
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap_%d{yyyy-MM-dd_HH}.%i.log
-
- 2
- 5MB
- 15MB
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap_%d.log
+
+ 30
+
+ 3GB
+
+ true
%date %level [%thread] %logger{40} %msg%n
+
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-deprecation.log
+
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-deprecation_%d.%i.log
+
+ 10MB
+
+ 10
+
+ 100MB
+
+ true
+
+
+ %date %level [%thread] %logger %msg%n
+
+
+
+
+
+
+
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-app-${logFileSuffix}.log
+
+
+ ${org.apache.nifi.bootstrap.config.log.dir}/nifi-app-${logFileSuffix}_%d{yyyy-MM-dd_HH}.%i.log
+
+ 100MB
+
+ 30
+
+ 3GB
+
+ true
+
+ true
+
+ %date %level [%thread] %logger{40} %msg%n
+
+
+
+
+
%date %level [%thread] %logger{40} %msg%n
@@ -86,12 +162,17 @@
+
+
+
+
+
-
+
@@ -100,8 +181,7 @@
-
-
+
@@ -119,6 +199,7 @@
+
@@ -134,11 +215,14 @@
-
+
+
+
+
@@ -162,19 +246,18 @@
-
-
-
-
-
-
+
+
+
+
+
@@ -182,6 +265,7 @@
+
@@ -202,4 +286,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/pkg/nificlient/config/common/common.go b/pkg/nificlient/config/common/common.go
index 1926776b8b..82e1b2d1c5 100644
--- a/pkg/nificlient/config/common/common.go
+++ b/pkg/nificlient/config/common/common.go
@@ -8,7 +8,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
- "github.com/konpyutaika/nifikop/api/v1"
+ v1 "github.com/konpyutaika/nifikop/api/v1"
"github.com/konpyutaika/nifikop/pkg/pki"
"github.com/konpyutaika/nifikop/pkg/pki/certmanagerpki"
"github.com/konpyutaika/nifikop/pkg/util"
diff --git a/pkg/resources/nifi/secretconfig.go b/pkg/resources/nifi/secretconfig.go
index 53fcb4fdc0..bb7ea14e47 100644
--- a/pkg/resources/nifi/secretconfig.go
+++ b/pkg/resources/nifi/secretconfig.go
@@ -43,7 +43,6 @@ func (r *Reconciler) secretConfig(id int32, nodeConfig *v1.NodeConfig, serverPas
"zookeeper.properties": []byte(r.generateZookeeperPropertiesNodeConfig(id, nodeConfig, log)),
"state-management.xml": []byte(r.getStateManagementConfigString(nodeConfig, id, log)),
"login-identity-providers.xml": []byte(r.getLoginIdentityProvidersConfigString(nodeConfig, id, log)),
- "logback.xml": []byte(r.getLogbackConfigString(nodeConfig, id, log)),
"bootstrap.conf": []byte(r.generateBootstrapPropertiesNodeConfig(id, nodeConfig, log)),
"bootstrap-notification-services.xml": []byte(r.getBootstrapNotificationServicesConfigString(nodeConfig, id, log)),
},
@@ -52,6 +51,11 @@ func (r *Reconciler) secretConfig(id int32, nodeConfig *v1.NodeConfig, serverPas
if configcommon.UseSSL(r.NifiCluster) {
secret.Data["authorizers.xml"] = []byte(r.getAuthorizersConfigString(nodeConfig, id, log))
}
+
+ if logbackConfigString := r.getLogbackConfigString(nodeConfig, id, log); logbackConfigString != nil {
+ secret.Data["logback.xml"] = []byte(*logbackConfigString)
+ }
+
return secret
}
@@ -310,13 +314,13 @@ func (r *Reconciler) getLoginIdentityProvidersConfigString(nConfig *v1.NodeConfi
// Logback configuration //
////////////////////////////
-func (r *Reconciler) getLogbackConfigString(nConfig *v1.NodeConfig, id int32, log zap.Logger) string {
+func (r *Reconciler) getLogbackConfigString(nConfig *v1.NodeConfig, id int32, log zap.Logger) *string {
for _, node := range r.NifiCluster.Spec.Nodes {
if node.Id == id && node.ReadOnlyConfig != nil && &node.ReadOnlyConfig.LogbackConfig != (&v1.LogbackConfig{}) {
if node.ReadOnlyConfig.LogbackConfig.ReplaceSecretConfig != nil {
conf, err := r.getSecrectConfig(context.TODO(), *node.ReadOnlyConfig.LogbackConfig.ReplaceSecretConfig)
if err == nil {
- return conf
+ return &conf
}
log.Error("error occurred during getting readonly secret config",
zap.String("clusterName", r.NifiCluster.Name),
@@ -327,7 +331,7 @@ func (r *Reconciler) getLogbackConfigString(nConfig *v1.NodeConfig, id int32, lo
if node.ReadOnlyConfig.LogbackConfig.ReplaceConfigMap != nil {
conf, err := r.getConfigMap(context.TODO(), *node.ReadOnlyConfig.LogbackConfig.ReplaceConfigMap)
if err == nil {
- return conf
+ return &conf
}
log.Error("error occurred during getting readonly configmap",
zap.String("clusterName", r.NifiCluster.Name),
@@ -341,7 +345,7 @@ func (r *Reconciler) getLogbackConfigString(nConfig *v1.NodeConfig, id int32, lo
if r.NifiCluster.Spec.ReadOnlyConfig.LogbackConfig.ReplaceSecretConfig != nil {
conf, err := r.getSecrectConfig(context.TODO(), *r.NifiCluster.Spec.ReadOnlyConfig.LogbackConfig.ReplaceSecretConfig)
if err == nil {
- return conf
+ return &conf
}
log.Error("error occurred during getting readonly secret config",
zap.String("clusterName", r.NifiCluster.Name),
@@ -352,7 +356,7 @@ func (r *Reconciler) getLogbackConfigString(nConfig *v1.NodeConfig, id int32, lo
if r.NifiCluster.Spec.ReadOnlyConfig.LogbackConfig.ReplaceConfigMap != nil {
conf, err := r.getConfigMap(context.TODO(), *r.NifiCluster.Spec.ReadOnlyConfig.LogbackConfig.ReplaceConfigMap)
if err == nil {
- return conf
+ return &conf
}
log.Error("error occurred during getting readonly configmap",
zap.String("clusterName", r.NifiCluster.Name),
@@ -360,18 +364,7 @@ func (r *Reconciler) getLogbackConfigString(nConfig *v1.NodeConfig, id int32, lo
zap.Error(err))
}
- var out bytes.Buffer
- t := template.Must(template.New("nConfig-config").Parse(config.LogbackTemplate))
- if err := t.Execute(&out, map[string]interface{}{
- "NifiCluster": r.NifiCluster,
- "Id": id,
- }); err != nil {
- log.Error("error occurred during parsing the config template",
- zap.String("clusterName", r.NifiCluster.Name),
- zap.Int32("nodeId", id),
- zap.Error(err))
- }
- return out.String()
+ return nil
}
///////////////////////////////////////////////////
diff --git a/pkg/resources/templates/config/logback.xml.go b/pkg/resources/templates/config/logback.xml.go
deleted file mode 100644
index 08f0cd059e..0000000000
--- a/pkg/resources/templates/config/logback.xml.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package config
-
-var LogbackTemplate = `
-
-
-
- true
-
-
-
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-app.log
-
-
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-app_%d{yyyy-MM-dd_HH}.%i.log
- 100MB
-
- 30
-
- true
-
- %date %level [%thread] %logger{40} %msg%n
-
-
-
-
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-user.log
-
-
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-user_%d.log
-
- 30
-
-
- %date %level [%thread] %logger{40} %msg%n
-
-
-
-
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap.log
-
-
- ${org.apache.nifi.bootstrap.config.log.dir}/nifi-bootstrap_%d.log
-
- 5
-
-
- %date %level [%thread] %logger{40} %msg%n
-
-
-
-
-
- %date %level [%thread] %logger{40} %msg%n
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-`
diff --git a/site/docs/5_references/1_nifi_cluster/2_read_only_config.md b/site/docs/5_references/1_nifi_cluster/2_read_only_config.md
index 7b59018a2e..7be691e148 100644
--- a/site/docs/5_references/1_nifi_cluster/2_read_only_config.md
+++ b/site/docs/5_references/1_nifi_cluster/2_read_only_config.md
@@ -14,7 +14,7 @@ readOnlyConfig:
maximumEventDrivenThreadCount: 10
# Logback configuration that will be applied to the node
logbackConfig:
- # logback.xml configuration that will replace the one produced based on template
+ # logback.xml configuration that will replace the one provided by NiFi
replaceConfigMap:
# The key of the value,in data content, that we want use.
data: logback.xml
@@ -22,7 +22,7 @@ readOnlyConfig:
name: raw
# Namespace where is located the secret that we want to refer.
namespace: nifikop
- # logback.xml configuration that will replace the one produced based on template and overrideConfigMap
+ # logback.xml configuration that will replace the one provided by NiFi and overrideConfigMap
replaceSecretConfig:
# The key of the value,in data content, that we want use.
data: logback.xml
@@ -188,8 +188,8 @@ readOnlyConfig:
|Field|Type|Description|Required|Default|
|-----|----|-----------|--------|--------|
-|replaceConfigMap|[ConfigmapReference](#configmapreference)|logback.xml configuration that will replace the one produced based on template.|No|nil|
-|replaceSecretConfig|[SecretConfigReference](#secretconfigreference)|logback.xml configuration that will replace the one produced based on template and overrideConfigMap.|No|nil|
+|replaceConfigMap|[ConfigmapReference](#configmapreference)|logback.xml configuration that will replace the one provided by NiFi.|No|nil|
+|replaceSecretConfig|[SecretConfigReference](#secretconfigreference)|logback.xml configuration that will replace the one provided by NiFi and overrideConfigMap.|No|nil|
## AuthorizerConfig