From 58ead55fd1400ff708387c850c4d04bb88e18c82 Mon Sep 17 00:00:00 2001 From: Lyndon-Li Date: Wed, 3 Jan 2024 14:12:30 +0800 Subject: [PATCH] change node-agent-config name Signed-off-by: Lyndon-Li --- design/Implemented/node-agent-concurrency.md | 10 +++++----- pkg/nodeagent/node_agent.go | 2 +- pkg/nodeagent/node_agent_test.go | 14 +++++++------- site/content/docs/main/node-agent-concurrency.md | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/design/Implemented/node-agent-concurrency.md b/design/Implemented/node-agent-concurrency.md index 359c6a2b6..3efd8bd36 100644 --- a/design/Implemented/node-agent-concurrency.md +++ b/design/Implemented/node-agent-concurrency.md @@ -26,11 +26,11 @@ Therefore, in order to gain the optimized performance with the limited resources ## Solution -We introduce a configMap named ```node-agent-configs``` for users to specify the node-agent related configurations. This configMap is not created by Velero, users should create it manually on demand. The configMap should be in the same namespace where Velero is installed. If multiple Velero instances are installed in different namespaces, there should be one configMap in each namespace which applies to node-agent in that namespace only. +We introduce a configMap named ```node-agent-config``` for users to specify the node-agent related configurations. This configMap is not created by Velero, users should create it manually on demand. The configMap should be in the same namespace where Velero is installed. If multiple Velero instances are installed in different namespaces, there should be one configMap in each namespace which applies to node-agent in that namespace only. Node-agent server checks these configurations at startup time and use it to initiate the related VGDP modules. Therefore, users could edit this configMap any time, but in order to make the changes effective, node-agent server needs to be restarted. -The ```node-agent-configs``` configMap may be used for other purpose of configuring node-agent in future, at present, there is only one kind of configuration as the data in the configMap, the name is ```loadConcurrency```. +The ```node-agent-config``` configMap may be used for other purpose of configuring node-agent in future, at present, there is only one kind of configuration as the data in the configMap, the name is ```loadConcurrency```. -The data structure for ```node-agent-configs``` is as below: +The data structure for ```node-agent-config``` is as below: ```go type Configs struct { // LoadConcurrency is the config for load concurrency per node. @@ -82,7 +82,7 @@ At least one node is expected to have a label with the specified ```RuledConfigs If one node falls into more than one rules, e.g., if node1 also has the label ```beta.kubernetes.io/instance-type=Standard_B4ms```, the smallest number (3) will be used. ### Sample -A sample of the ```node-agent-configs``` configMap is as below: +A sample of the ```node-agent-config``` configMap is as below: ```json { "loadConcurrency": { @@ -110,7 +110,7 @@ A sample of the ```node-agent-configs``` configMap is as below: ``` To create the configMap, users need to save something like the above sample to a json file and then run below command: ``` -kubectl create cm node-agent-configs -n velero --from-file= +kubectl create cm node-agent-config -n velero --from-file= ``` ### Global data path manager diff --git a/pkg/nodeagent/node_agent.go b/pkg/nodeagent/node_agent.go index 4320baf3b..67dbac17b 100644 --- a/pkg/nodeagent/node_agent.go +++ b/pkg/nodeagent/node_agent.go @@ -35,7 +35,7 @@ import ( const ( // daemonSet is the name of the Velero node agent daemonset. daemonSet = "node-agent" - configName = "node-agent-configs" + configName = "node-agent-config" ) var ( diff --git a/pkg/nodeagent/node_agent_test.go b/pkg/nodeagent/node_agent_test.go index a482a5a3e..0a7a2d431 100644 --- a/pkg/nodeagent/node_agent_test.go +++ b/pkg/nodeagent/node_agent_test.go @@ -241,10 +241,10 @@ func TestGetPodSpec(t *testing.T) { } func TestGetConfigs(t *testing.T) { - cm := builder.ForConfigMap("fake-ns", "node-agent-configs").Result() - cmWithInvalidDataFormat := builder.ForConfigMap("fake-ns", "node-agent-configs").Data("fake-key", "wrong").Result() - cmWithoutCocurrentData := builder.ForConfigMap("fake-ns", "node-agent-configs").Data("fake-key", "{\"someothers\":{\"someother\": 10}}").Result() - cmWithValidData := builder.ForConfigMap("fake-ns", "node-agent-configs").Data("fake-key", "{\"loadConcurrency\":{\"globalConfig\": 5}}").Result() + cm := builder.ForConfigMap("fake-ns", "node-agent-config").Result() + cmWithInvalidDataFormat := builder.ForConfigMap("fake-ns", "node-agent-config").Data("fake-key", "wrong").Result() + cmWithoutCocurrentData := builder.ForConfigMap("fake-ns", "node-agent-config").Data("fake-key", "{\"someothers\":{\"someother\": 10}}").Result() + cmWithValidData := builder.ForConfigMap("fake-ns", "node-agent-config").Data("fake-key", "{\"loadConcurrency\":{\"globalConfig\": 5}}").Result() tests := []struct { name string @@ -270,7 +270,7 @@ func TestGetConfigs(t *testing.T) { }, }, }, - expectErr: "error to get node agent configs node-agent-configs: fake-get-error", + expectErr: "error to get node agent configs node-agent-config: fake-get-error", }, { name: "cm's data is nil", @@ -278,7 +278,7 @@ func TestGetConfigs(t *testing.T) { kubeClientObj: []runtime.Object{ cm, }, - expectErr: "data is not available in config map node-agent-configs", + expectErr: "data is not available in config map node-agent-config", }, { name: "cm's data is with invalid format", @@ -286,7 +286,7 @@ func TestGetConfigs(t *testing.T) { kubeClientObj: []runtime.Object{ cmWithInvalidDataFormat, }, - expectErr: "error to unmarshall configs from node-agent-configs: invalid character 'w' looking for beginning of value", + expectErr: "error to unmarshall configs from node-agent-config: invalid character 'w' looking for beginning of value", }, { name: "concurrency configs are not found", diff --git a/site/content/docs/main/node-agent-concurrency.md b/site/content/docs/main/node-agent-concurrency.md index 20564eac5..9a7e1b255 100644 --- a/site/content/docs/main/node-agent-concurrency.md +++ b/site/content/docs/main/node-agent-concurrency.md @@ -8,7 +8,7 @@ Varying from the data size, data complexity, resource availability, the tasks ma Node-agent concurrency configurations allow you to configure the concurrent number of node-agent loads per node. When the resources are sufficient in nodes, you can set a large concurrent number, so as to reduce the backup/restore time; otherwise, the concurrency should be reduced, otherwise, the backup/restore may encounter problems, i.e., time lagging, hang or OOM kill. -To set Node-agent concurrency configurations, a configMap named ```node-agent-configs``` should be created manually. The configMap should be in the same namespace where Velero is installed. If multiple Velero instances are installed in different namespaces, there should be one configMap in each namespace which applies to node-agent in that namespace only. +To set Node-agent concurrency configurations, a configMap named ```node-agent-config``` should be created manually. The configMap should be in the same namespace where Velero is installed. If multiple Velero instances are installed in different namespaces, there should be one configMap in each namespace which applies to node-agent in that namespace only. Node-agent server checks these configurations at startup time. Therefore, you could edit this configMap any time, but in order to make the changes effective, node-agent server needs to be restarted. ### Global concurrent number @@ -32,7 +32,7 @@ At least one node is expected to have a label with the specified ```RuledConfigs If one node falls into more than one rules, e.g., if node1 also has the label ```beta.kubernetes.io/instance-type=Standard_B4ms```, the smallest number (3) will be used. ### Sample -A sample of the complete ```node-agent-configs``` configMap is as below: +A sample of the complete ```node-agent-config``` configMap is as below: ```json { "loadConcurrency": { @@ -60,7 +60,7 @@ A sample of the complete ```node-agent-configs``` configMap is as below: ``` To create the configMap, save something like the above sample to a json file and then run below command: ``` -kubectl create cm node-agent-configs -n velero --from-file= +kubectl create cm node-agent-config -n velero --from-file= ```