This is an automated email from the ASF dual-hosted git repository.
houston pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git
The following commit(s) were added to refs/heads/main by this push:
new ff3b832 Add ability to specify ZK Config values. (#311)
ff3b832 is described below
commit ff3b832175b1215cc867776c793fb75166806903
Author: Houston Putman <[email protected]>
AuthorDate: Mon Aug 30 16:12:07 2021 -0400
Add ability to specify ZK Config values. (#311)
---
api/v1beta1/solrcloud_types.go | 5 +++
api/v1beta1/zz_generated.deepcopy.go | 1 +
config/crd/bases/solr.apache.org_solrclouds.yaml | 55 ++++++++++++++++++++++++
controllers/controller_utils_test.go | 9 ++++
controllers/solrcloud_controller_zk_test.go | 10 +++++
controllers/util/zk_util.go | 7 +++
helm/solr-operator/Chart.yaml | 7 +++
helm/solr-operator/crds/crds.yaml | 55 ++++++++++++++++++++++++
helm/solr/README.md | 1 +
helm/solr/templates/solrcloud.yaml | 4 ++
helm/solr/values.yaml | 3 ++
11 files changed, 157 insertions(+)
diff --git a/api/v1beta1/solrcloud_types.go b/api/v1beta1/solrcloud_types.go
index a0db972..00b715e 100644
--- a/api/v1beta1/solrcloud_types.go
+++ b/api/v1beta1/solrcloud_types.go
@@ -636,6 +636,11 @@ type ZookeeperSpec struct {
// This ACL should have READ permission in the given chRoot.
// +optional
ReadOnlyACL *ZookeeperACL `json:"readOnlyAcl,omitempty"`
+
+ // ZooKeeper ACL to use when connecting with ZK for reading operations.
+ // This ACL should have READ permission in the given chRoot.
+ // +optional
+ Config zk.ZookeeperConfig `json:"config,omitempty"`
}
func (z *ZookeeperSpec) WithDefaults() (changed bool) {
diff --git a/api/v1beta1/zz_generated.deepcopy.go
b/api/v1beta1/zz_generated.deepcopy.go
index 0d7ee77..46f3c02 100644
--- a/api/v1beta1/zz_generated.deepcopy.go
+++ b/api/v1beta1/zz_generated.deepcopy.go
@@ -1393,6 +1393,7 @@ func (in *ZookeeperSpec) DeepCopyInto(out *ZookeeperSpec)
{
*out = new(ZookeeperACL)
**out = **in
}
+ in.Config.DeepCopyInto(&out.Config)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver,
creating a new ZookeeperSpec.
diff --git a/config/crd/bases/solr.apache.org_solrclouds.yaml
b/config/crd/bases/solr.apache.org_solrclouds.yaml
index b191c42..68ad373 100644
--- a/config/crd/bases/solr.apache.org_solrclouds.yaml
+++ b/config/crd/bases/solr.apache.org_solrclouds.yaml
@@ -4769,6 +4769,61 @@ spec:
chroot:
description: The ChRoot to connect solr at
type: string
+ config:
+ description: ZooKeeper ACL to use when connecting with
ZK for reading operations. This ACL should have READ permission in the given
chRoot.
+ properties:
+ additionalConfig:
+ additionalProperties:
+ type: string
+ description: key-value map of additional zookeeper
configuration parameters
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ autoPurgePurgeInterval:
+ description: "The time interval in hours for which
the purge task has to be triggered \n Disabled by default"
+ type: integer
+ autoPurgeSnapRetainCount:
+ description: "Retain the snapshots according to
retain count \n The default value is 3"
+ type: integer
+ commitLogCount:
+ description: "Zookeeper maintains an in-memory
list of last committed requests for fast synchronization with followers \n The
default value is 500"
+ type: integer
+ globalOutstandingLimit:
+ description: "Clients can submit requests faster
than ZooKeeper can process them, especially if there are a lot of clients.
Zookeeper will throttle Clients so that requests won't exceed global
outstanding limit. \n The default value is 1000"
+ type: integer
+ initLimit:
+ description: "InitLimit is the amount of time, in
ticks, to allow followers to connect and sync to a leader. \n Default value is
10."
+ type: integer
+ maxClientCnxns:
+ description: "Limits the number of concurrent
connections that a single client, identified by IP address, may make to a
single member of the ZooKeeper ensemble. \n The default value is 60"
+ type: integer
+ maxCnxns:
+ description: "Limits the total number of
concurrent connections that can be made to a zookeeper server \n The defult
value is 0, indicating no limit"
+ type: integer
+ maxSessionTimeout:
+ description: "The maximum session timeout in
milliseconds that the server will allow the client to negotiate. \n The default
value is 40000"
+ type: integer
+ minSessionTimeout:
+ description: "The minimum session timeout in
milliseconds that the server will allow the client to negotiate \n The default
value is 4000"
+ type: integer
+ preAllocSize:
+ description: "To avoid seeks ZooKeeper allocates
space in the transaction log file in blocks of preAllocSize kilobytes \n The
default value is 64M"
+ type: integer
+ quorumListenOnAllIPs:
+ description: "QuorumListenOnAllIPs when set to
true the ZooKeeper server will listen for connections from its peers on all
available IP addresses, and not only the address configured in the server list
of the configuration file. It affects the connections handling the ZAB protocol
and the Fast Leader Election protocol. \n The default value is false."
+ type: boolean
+ snapCount:
+ description: "ZooKeeper records its transactions
using snapshots and a transaction log The number of transactions recorded in
the transaction log before a snapshot can be taken is determined by snapCount
\n The default value is 100,000"
+ type: integer
+ snapSizeLimitInKb:
+ description: "Snapshot size limit in Kb \n The
defult value is 4GB"
+ type: integer
+ syncLimit:
+ description: "SyncLimit is the amount of time, in
ticks, to allow followers to sync with Zookeeper. \n The default value is 2."
+ type: integer
+ tickTime:
+ description: "TickTime is the length of a single
tick, which is the basic time unit used by Zookeeper, as measured in
milliseconds \n The default value is 2000."
+ type: integer
+ type: object
ephemeral:
description: Ephemeral is the configuration which
helps create ephemeral storage At anypoint only one of Persistence or Ephemeral
should be present in the manifest
properties:
diff --git a/controllers/controller_utils_test.go
b/controllers/controller_utils_test.go
index 8a85aa5..42c5296 100644
--- a/controllers/controller_utils_test.go
+++ b/controllers/controller_utils_test.go
@@ -835,4 +835,13 @@ var (
},
}
testServiceAccountName = "test-service-account"
+ zkConf = zkv1beta1.ZookeeperConfig{
+ InitLimit: 1,
+ SyncLimit: 5,
+ PreAllocSize: 2,
+ CommitLogCount: 10,
+ MaxCnxns: 4,
+ MinSessionTimeout: 6,
+ QuorumListenOnAllIPs: true,
+ }
)
diff --git a/controllers/solrcloud_controller_zk_test.go
b/controllers/solrcloud_controller_zk_test.go
index 7041f4e..03aab7e 100644
--- a/controllers/solrcloud_controller_zk_test.go
+++ b/controllers/solrcloud_controller_zk_test.go
@@ -80,6 +80,7 @@ func TestCloudWithProvidedEphemeralZookeeperReconcile(t
*testing.T) {
Resources: resources,
ServiceAccountName:
testServiceAccountName,
},
+ Config: zkConf,
ChRoot: "a-ch/root",
},
},
@@ -171,6 +172,15 @@ func TestCloudWithProvidedEphemeralZookeeperReconcile(t
*testing.T) {
assert.EqualValues(t, resources, zkCluster.Spec.Pod.Resources,
"Incorrect zkCluster resources")
assert.EqualValues(t, extraVars, zkCluster.Spec.Pod.Env, "Incorrect
zkCluster env vars")
assert.EqualValues(t, testServiceAccountName,
zkCluster.Spec.Pod.ServiceAccountName, "Incorrect zkCluster serviceAccountName")
+
+ // Check ZK Config Options
+ assert.EqualValues(t, zkConf.InitLimit, zkCluster.Spec.Conf.InitLimit,
"Incorrect zkCluster Config InitLimit")
+ assert.EqualValues(t, zkConf.SyncLimit, zkCluster.Spec.Conf.SyncLimit,
"Incorrect zkCluster Config SyncLimit")
+ assert.EqualValues(t, zkConf.PreAllocSize,
zkCluster.Spec.Conf.PreAllocSize, "Incorrect zkCluster Config PreAllocSize")
+ assert.EqualValues(t, zkConf.CommitLogCount,
zkCluster.Spec.Conf.CommitLogCount, "Incorrect zkCluster Config CommitLogCount")
+ assert.EqualValues(t, zkConf.MaxCnxns, zkCluster.Spec.Conf.MaxCnxns,
"Incorrect zkCluster Config MaxCnxns")
+ assert.EqualValues(t, zkConf.MinSessionTimeout,
zkCluster.Spec.Conf.MinSessionTimeout, "Incorrect zkCluster Config
MinSessionTimeout")
+ assert.EqualValues(t, zkConf.QuorumListenOnAllIPs,
zkCluster.Spec.Conf.QuorumListenOnAllIPs, "Incorrect zkCluster Config
QuorumListenOnAllIPs")
}
func TestCloudWithProvidedPersistentZookeeperReconcile(t *testing.T) {
diff --git a/controllers/util/zk_util.go b/controllers/util/zk_util.go
index 169165f..85dc1c3 100644
--- a/controllers/util/zk_util.go
+++ b/controllers/util/zk_util.go
@@ -64,6 +64,7 @@ func GenerateZookeeperCluster(solrCloud *solr.SolrCloud,
zkSpec *solr.ZookeeperS
ContainerPort: 3888,
},
},
+ Conf: zkSpec.Config,
},
}
@@ -299,6 +300,12 @@ func CopyZookeeperClusterFields(from, to
*zk.ZookeeperCluster, logger logr.Logge
to.Spec.Probes = from.Spec.Probes
}
+ if !DeepEqualWithNils(to.Spec.Conf, from.Spec.Conf) {
+ logger.Info("Update required because field changed", "field",
"Spec.Conf", "from", to.Spec.Conf, "to", from.Spec.Conf)
+ requireUpdate = true
+ to.Spec.Conf = from.Spec.Conf
+ }
+
return requireUpdate
}
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index 78525ff..860dc5d 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -149,6 +149,13 @@ annotations:
url: https://github.com/apache/solr-operator/issues/310
- name: Github PR
url: https://github.com/apache/solr-operator/pull/313
+ - kind: added
+ description: Ability to specify ZK Config properties for provided
Zookeeper Clusters.
+ links:
+ - name: Github Issue
+ url: https://github.com/apache/solr-operator/issues/290
+ - name: Github PR
+ url: https://github.com/apache/solr-operator/pull/311
artifacthub.io/images: |
- name: solr-operator
image: apache/solr-operator:v0.4.0-prerelease
diff --git a/helm/solr-operator/crds/crds.yaml
b/helm/solr-operator/crds/crds.yaml
index ae4cc91..f6cbd32 100644
--- a/helm/solr-operator/crds/crds.yaml
+++ b/helm/solr-operator/crds/crds.yaml
@@ -5896,6 +5896,61 @@ spec:
chroot:
description: The ChRoot to connect solr at
type: string
+ config:
+ description: ZooKeeper ACL to use when connecting with
ZK for reading operations. This ACL should have READ permission in the given
chRoot.
+ properties:
+ additionalConfig:
+ additionalProperties:
+ type: string
+ description: key-value map of additional zookeeper
configuration parameters
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ autoPurgePurgeInterval:
+ description: "The time interval in hours for which
the purge task has to be triggered \n Disabled by default"
+ type: integer
+ autoPurgeSnapRetainCount:
+ description: "Retain the snapshots according to
retain count \n The default value is 3"
+ type: integer
+ commitLogCount:
+ description: "Zookeeper maintains an in-memory
list of last committed requests for fast synchronization with followers \n The
default value is 500"
+ type: integer
+ globalOutstandingLimit:
+ description: "Clients can submit requests faster
than ZooKeeper can process them, especially if there are a lot of clients.
Zookeeper will throttle Clients so that requests won't exceed global
outstanding limit. \n The default value is 1000"
+ type: integer
+ initLimit:
+ description: "InitLimit is the amount of time, in
ticks, to allow followers to connect and sync to a leader. \n Default value is
10."
+ type: integer
+ maxClientCnxns:
+ description: "Limits the number of concurrent
connections that a single client, identified by IP address, may make to a
single member of the ZooKeeper ensemble. \n The default value is 60"
+ type: integer
+ maxCnxns:
+ description: "Limits the total number of
concurrent connections that can be made to a zookeeper server \n The defult
value is 0, indicating no limit"
+ type: integer
+ maxSessionTimeout:
+ description: "The maximum session timeout in
milliseconds that the server will allow the client to negotiate. \n The default
value is 40000"
+ type: integer
+ minSessionTimeout:
+ description: "The minimum session timeout in
milliseconds that the server will allow the client to negotiate \n The default
value is 4000"
+ type: integer
+ preAllocSize:
+ description: "To avoid seeks ZooKeeper allocates
space in the transaction log file in blocks of preAllocSize kilobytes \n The
default value is 64M"
+ type: integer
+ quorumListenOnAllIPs:
+ description: "QuorumListenOnAllIPs when set to
true the ZooKeeper server will listen for connections from its peers on all
available IP addresses, and not only the address configured in the server list
of the configuration file. It affects the connections handling the ZAB protocol
and the Fast Leader Election protocol. \n The default value is false."
+ type: boolean
+ snapCount:
+ description: "ZooKeeper records its transactions
using snapshots and a transaction log The number of transactions recorded in
the transaction log before a snapshot can be taken is determined by snapCount
\n The default value is 100,000"
+ type: integer
+ snapSizeLimitInKb:
+ description: "Snapshot size limit in Kb \n The
defult value is 4GB"
+ type: integer
+ syncLimit:
+ description: "SyncLimit is the amount of time, in
ticks, to allow followers to sync with Zookeeper. \n The default value is 2."
+ type: integer
+ tickTime:
+ description: "TickTime is the length of a single
tick, which is the basic time unit used by Zookeeper, as measured in
milliseconds \n The default value is 2000."
+ type: integer
+ type: object
ephemeral:
description: Ephemeral is the configuration which
helps create ephemeral storage At anypoint only one of Persistence or Ephemeral
should be present in the manifest
properties:
diff --git a/helm/solr/README.md b/helm/solr/README.md
index 3530567..98841fe 100644
--- a/helm/solr/README.md
+++ b/helm/solr/README.md
@@ -163,6 +163,7 @@ Currently the Zookeeper Operator does not support ACLs, so
do not use the provid
| zk.provided.persistence.spec | object | | A PVC Spec for the ZooKeeper
PVC(s) |
| zk.provided.persistence.annotations | object | | Annotations to use for the
ZooKeeper PVC(s) |
| zk.provided.ephemeral.emptydirvolumesource | object | | An emptyDir volume
source for the ZooKeeper Storage on each pod. |
+| zk.provided.config | object | | Zookeeper Config Options to set for the
provided cluster. For all possible options, run: `kubectl explain
solrcloud.spec.zookeeperRef.provided.config` |
| zk.provided.zookeeperPodPolicy.serviceAccountName | string | | Optional
serviceAccount to run the ZK Pod under |
| zk.provided.zookeeperPodPolicy.affinity | string | | PullSecret for the
ZooKeeper image |
| zk.provided.zookeeperPodPolicy.resources.limits | map[string]string | |
Provide Resource limits for the ZooKeeper containers |
diff --git a/helm/solr/templates/solrcloud.yaml
b/helm/solr/templates/solrcloud.yaml
index 00fb079..2cfde80 100644
--- a/helm/solr/templates/solrcloud.yaml
+++ b/helm/solr/templates/solrcloud.yaml
@@ -186,6 +186,10 @@ spec:
image:
{{- toYaml .Values.zk.provided.image | nindent 8 }}
{{- end }}
+ {{- if .Values.zk.provided.config }}
+ config:
+ {{- toYaml .Values.zk.provided.config | nindent 8 }}
+ {{- end }}
{{- if (or .Values.zk.provided.persistence (lower
.Values.zk.provided.storageType | hasPrefix "persist")) }}
persistence:
{{- toYaml .Values.zk.provided.persistence | nindent 8 }}
diff --git a/helm/solr/values.yaml b/helm/solr/values.yaml
index 3cd5392..a7679b7 100644
--- a/helm/solr/values.yaml
+++ b/helm/solr/values.yaml
@@ -169,6 +169,9 @@ zk:
ephemeral: {}
# emptydirvolumesource: {}
+ # Zookeeper Config Options to set for the provided cluster
+ config: {}
+
# Use this section to inject ACL information for your zookeeper from a Kube
secret in the same namespace as your SolrCloud
acl: {}
# secret: zk-acls