add node-agent concurrency doc

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
This commit is contained in:
Lyndon-Li
2023-11-29 14:33:51 +08:00
parent 402a61481d
commit 8968ae5ec4
8 changed files with 100 additions and 32 deletions
+5 -6
View File
@@ -34,16 +34,15 @@ import (
const (
// daemonSet is the name of the Velero node agent daemonset.
daemonSet = "node-agent"
configName = "node-agent-configs"
dataPathConConfigName = "data-path-concurrency"
daemonSet = "node-agent"
configName = "node-agent-configs"
)
var (
ErrDaemonSetNotFound = errors.New("daemonset not found")
)
type DataPathConcurrency struct {
type LoadConcurrency struct {
// GlobalConfig specifies the concurrency number to all nodes for which per-node config is not specified
GlobalConfig int `json:"globalConfig,omitempty"`
@@ -60,8 +59,8 @@ type RuledConfigs struct {
}
type Configs struct {
// DataPathConcurrency is the config for data path concurrency per node.
DataPathConcurrency *DataPathConcurrency `json:"dataPathConcurrency,omitempty"`
// LoadConcurrency is the config for data path load concurrency per node.
LoadConcurrency *LoadConcurrency `json:"loadConcurrency,omitempty"`
}
// IsRunning checks if the node agent daemonset is running properly. If not, return the error found
+5 -5
View File
@@ -244,7 +244,7 @@ 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", "{\"dataPathConcurrency\":{\"globalConfig\": 5}}").Result()
cmWithValidData := builder.ForConfigMap("fake-ns", "node-agent-configs").Data("fake-key", "{\"loadConcurrency\":{\"globalConfig\": 5}}").Result()
tests := []struct {
name string
@@ -303,7 +303,7 @@ func TestGetConfigs(t *testing.T) {
cmWithValidData,
},
expectResult: &Configs{
DataPathConcurrency: &DataPathConcurrency{
LoadConcurrency: &LoadConcurrency{
GlobalConfig: 5,
},
},
@@ -324,10 +324,10 @@ func TestGetConfigs(t *testing.T) {
if test.expectResult == nil {
assert.Nil(t, result)
} else if test.expectResult.DataPathConcurrency == nil {
assert.Nil(t, result.DataPathConcurrency)
} else if test.expectResult.LoadConcurrency == nil {
assert.Nil(t, result.LoadConcurrency)
} else {
assert.Equal(t, *test.expectResult.DataPathConcurrency, *result.DataPathConcurrency)
assert.Equal(t, *test.expectResult.LoadConcurrency, *result.LoadConcurrency)
}
} else {
assert.EqualError(t, err, test.expectErr)