Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions manifests/supervisorcluster/1.29/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ spec:
value: "30"
- name: VOLUME_HEALTH_INTERVAL_MINUTES
value: "5"
- name: WORKER_THREADS_NODEVM_ATTACH
value: "20"
- name: WORKER_THREADS_NODEVM_BATCH_ATTACH
value: "20"
- name: POD_POLL_INTERVAL_SECONDS
value: "2"
- name: POD_LISTENER_SERVICE_PORT
Expand Down
4 changes: 4 additions & 0 deletions manifests/supervisorcluster/1.30/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ spec:
value: "30"
- name: VOLUME_HEALTH_INTERVAL_MINUTES
value: "5"
- name: WORKER_THREADS_NODEVM_ATTACH
value: "20"
- name: WORKER_THREADS_NODEVM_BATCH_ATTACH
value: "20"
- name: POD_POLL_INTERVAL_SECONDS
value: "2"
- name: POD_LISTENER_SERVICE_PORT
Expand Down
4 changes: 4 additions & 0 deletions manifests/supervisorcluster/1.31/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ spec:
value: "30"
- name: VOLUME_HEALTH_INTERVAL_MINUTES
value: "5"
- name: WORKER_THREADS_NODEVM_ATTACH
value: "20"
- name: WORKER_THREADS_NODEVM_BATCH_ATTACH
value: "20"
- name: POD_POLL_INTERVAL_SECONDS
value: "2"
- name: POD_LISTENER_SERVICE_PORT
Expand Down
4 changes: 4 additions & 0 deletions manifests/supervisorcluster/1.32/cns-csi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ spec:
value: "30"
- name: VOLUME_HEALTH_INTERVAL_MINUTES
value: "5"
- name: WORKER_THREADS_NODEVM_ATTACH
value: "20"
- name: WORKER_THREADS_NODEVM_BATCH_ATTACH
value: "20"
- name: POD_POLL_INTERVAL_SECONDS
value: "2"
- name: POD_LISTENER_SERVICE_PORT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import (

const (
workerThreadsEnvVar = "WORKER_THREADS_NODEVM_ATTACH"
defaultMaxWorkerThreads = 10
defaultMaxWorkerThreads = 20
)

// backOffDuration is a map of cnsnodevmattachment name's to the time after
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var (

const (
workerThreadsEnvVar = "WORKER_THREADS_NODEVM_BATCH_ATTACH"
defaultMaxWorkerThreads = 10
defaultMaxWorkerThreads = 20
)

var newClientFunc = func(ctx context.Context) (kubernetes.Interface, error) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/syncer/cnsoperator/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,7 @@ func GetDatacenterObjectList(ctx context.Context,
// spawned by a controller to reconciler instances of a CRD. It reads the
// value from an environment variable identified by 'key'. If the environment
// variable is not set or has an invalid value, it returns the 'defaultVal'.
// The value of the environment variable should be a positive integer less
// than or equal to 'defaultVal'.
// The value of the environment variable should be a positive integer
func GetMaxWorkerThreads(ctx context.Context, key string, defaultVal int) int {
log := logger.GetLogger(ctx).With("field", key)
workerThreads := defaultVal
Expand All @@ -388,7 +387,7 @@ func GetMaxWorkerThreads(ctx context.Context, key string, defaultVal int) int {
}

switch {
case val <= 0 || val > defaultVal:
case val <= 0:
log.Warnf("Value %d for environment variable is invalid. Using default value %d",
val, defaultVal)
default:
Expand Down
16 changes: 0 additions & 16 deletions pkg/syncer/cnsoperator/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,20 +185,4 @@ func TestGetMaxWorkerThreads(t *testing.T) {
// Assert
assert.Equal(t, expVal, val)
})

t.Run("WhenEnvValid", func(t *testing.T) {
// Setup
err := os.Setenv(envVar, "10")
if err != nil {
t.Fatalf("Failed to set env var: %v", err)
}

defVal, expVal := 50, 10

// Execute
val := GetMaxWorkerThreads(context.Background(), envVar, defVal)

// Assert
assert.Equal(t, expVal, val)
})
}