diff --git a/pkg/apis/clickhouse.altinity.com/v1/type_setting.go b/pkg/apis/clickhouse.altinity.com/v1/type_setting.go
index d175a936e..6491b93d4 100644
--- a/pkg/apis/clickhouse.altinity.com/v1/type_setting.go
+++ b/pkg/apis/clickhouse.altinity.com/v1/type_setting.go
@@ -41,6 +41,7 @@ type Setting struct {
vector []string
src *SettingSource
attributes map[string]string
+ embed bool
}
type SettingType string
@@ -283,3 +284,18 @@ func (s *Setting) parseDataSourceAddress(dataSourceAddress, defaultNamespace str
return addr, nil
}
+
+func (s *Setting) SetEmbed() *Setting {
+ if s == nil {
+ return nil
+ }
+ s.embed = true
+ return s
+}
+
+func (s *Setting) IsEmbed() bool {
+ if s == nil {
+ return false
+ }
+ return s.embed
+}
diff --git a/pkg/model/chk/config/generator.go b/pkg/model/chk/config/generator.go
index 6d39c2249..85f7eee87 100644
--- a/pkg/model/chk/config/generator.go
+++ b/pkg/model/chk/config/generator.go
@@ -94,7 +94,7 @@ func (c *Generator) getRaftConfig(selector *config.HostSelector) string {
return nil
})
- return chi.NewSettings().Set("keeper_server/raft_configuration", chi.MustNewSettingScalarFromAny(raft)).ClickHouseConfig()
+ return chi.NewSettings().Set("keeper_server/raft_configuration", chi.MustNewSettingScalarFromAny(raft).SetEmbed()).ClickHouseConfig()
}
// getHostServerId builds server id config for the host
diff --git a/pkg/xml/xml.go b/pkg/xml/xml.go
index e0f516bd0..4f58ff45f 100644
--- a/pkg/xml/xml.go
+++ b/pkg/xml/xml.go
@@ -42,6 +42,7 @@ type setting interface {
IsVector() bool
Attributes() string
VectorOfStrings() []string
+ IsEmbed() bool
}
type settings interface {
@@ -156,13 +157,13 @@ func (n *xmlNode) buildXML(w io.Writer, indent, tabSize uint8) {
case n.value.IsScalar():
// ScalarString node
- n.writeTagWithValue(w, n.value.String(), n.value.Attributes(), indent, tabSize)
+ n.writeTagWithValue(w, n.value.String(), n.value.Attributes(), indent, n.value.IsEmbed())
return
case n.value.IsVector():
// VectorOfStrings node
for _, value := range n.value.VectorOfStrings() {
- n.writeTagWithValue(w, value, n.value.Attributes(), indent, tabSize)
+ n.writeTagWithValue(w, value, n.value.Attributes(), indent, n.value.IsEmbed())
}
}
}
@@ -186,19 +187,29 @@ func (n *xmlNode) writeTagNoValue(w io.Writer, attributes string, indent, tabSiz
// value
// OR
//
-// long value NB - printed w/o indent
+// embedded value NB - printed w/o indent
//
-func (n *xmlNode) writeTagWithValue(w io.Writer, value string, attributes string, indent, tabSize uint8) {
+func (n *xmlNode) writeTagWithValue(w io.Writer, value string, attributes string, indent uint8, embedded bool) {
// TODO fix this properly
// Used in tests
if value == "_removed_" || value == "_remove_" {
attributes = " remove=\"1\""
value = ""
}
- // value
- n.writeTagOpen(w, indent, attributes, noEol)
- n.writeValue(w, value)
- n.writeTagClose(w, 0, eol)
+
+ if embedded {
+ //
+ // embedded value NB - printed w/o indent
+ //
+ n.writeTagOpen(w, indent, attributes, eol)
+ n.writeValue(w, value)
+ n.writeTagClose(w, indent, eol)
+ } else {
+ // value
+ n.writeTagOpen(w, indent, attributes, noEol)
+ n.writeValue(w, value)
+ n.writeTagClose(w, 0, eol)
+ }
}
// writeTagOpen prints open XML tag into io.Writer