diff --git a/cmpserver/apiclient/clientset.go b/cmpserver/apiclient/clientset.go index 025625ff8092e..e624474f2d34b 100644 --- a/cmpserver/apiclient/clientset.go +++ b/cmpserver/apiclient/clientset.go @@ -2,6 +2,9 @@ package apiclient import ( "context" + "github.com/argoproj/argo-cd/v2/common" + "github.com/argoproj/argo-cd/v2/util/env" + "math" "time" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" @@ -14,9 +17,9 @@ import ( "github.com/argoproj/argo-cd/v2/util/io" ) -const ( +var ( // MaxGRPCMessageSize contains max grpc message size - MaxGRPCMessageSize = 100 * 1024 * 1024 + MaxGRPCMessageSize = env.ParseNumFromEnv(common.EnvGRPCMaxSizeMB, 100, 0, math.MaxInt32) * 1024 * 1024 ) // Clientset represents config management plugin server api clients diff --git a/common/common.go b/common/common.go index f4b176946bcbd..b825ccddef91f 100644 --- a/common/common.go +++ b/common/common.go @@ -273,6 +273,8 @@ const ( // EnvServerSideDiff defines the env var used to enable ServerSide Diff feature. // If defined, value must be "true" or "false". EnvServerSideDiff = "ARGOCD_APPLICATION_CONTROLLER_SERVER_SIDE_DIFF" + // EnvGRPCMaxSizeMB is the environment variable to look for a max GRPC message size + EnvGRPCMaxSizeMB = "ARGOCD_GRPC_MAX_SIZE_MB" ) // Config Management Plugin related constants diff --git a/manifests/base/repo-server/argocd-repo-server-deployment.yaml b/manifests/base/repo-server/argocd-repo-server-deployment.yaml index 2c30c8ad1d71b..051e66027ec11 100644 --- a/manifests/base/repo-server/argocd-repo-server-deployment.yaml +++ b/manifests/base/repo-server/argocd-repo-server-deployment.yaml @@ -198,6 +198,12 @@ spec: key: reposerver.git.request.timeout name: argocd-cmd-params-cm optional: true + - name: ARGOCD_GRPC_MAX_SIZE_MB + valueFrom: + configMapKeyRef: + key: reposerver.grpc.max.size + name: argocd-cmd-params-cm + optional: true - name: HELM_CACHE_HOME value: /helm-working-dir - name: HELM_CONFIG_HOME diff --git a/manifests/core-install.yaml b/manifests/core-install.yaml index 05f1deaad58fe..a61c832cac617 100644 --- a/manifests/core-install.yaml +++ b/manifests/core-install.yaml @@ -21508,6 +21508,12 @@ spec: key: reposerver.git.request.timeout name: argocd-cmd-params-cm optional: true + - name: ARGOCD_GRPC_MAX_SIZE_MB + valueFrom: + configMapKeyRef: + key: reposerver.grpc.max.size + name: argocd-cmd-params-cm + optional: true - name: HELM_CACHE_HOME value: /helm-working-dir - name: HELM_CONFIG_HOME diff --git a/manifests/ha/install.yaml b/manifests/ha/install.yaml index 9ce3b1cb4b824..c986714f27234 100644 --- a/manifests/ha/install.yaml +++ b/manifests/ha/install.yaml @@ -23107,6 +23107,12 @@ spec: key: reposerver.git.request.timeout name: argocd-cmd-params-cm optional: true + - name: ARGOCD_GRPC_MAX_SIZE_MB + valueFrom: + configMapKeyRef: + key: reposerver.grpc.max.size + name: argocd-cmd-params-cm + optional: true - name: HELM_CACHE_HOME value: /helm-working-dir - name: HELM_CONFIG_HOME diff --git a/manifests/ha/namespace-install.yaml b/manifests/ha/namespace-install.yaml index 73473875be715..4ef45e6750f1b 100644 --- a/manifests/ha/namespace-install.yaml +++ b/manifests/ha/namespace-install.yaml @@ -2228,6 +2228,12 @@ spec: key: reposerver.git.request.timeout name: argocd-cmd-params-cm optional: true + - name: ARGOCD_GRPC_MAX_SIZE_MB + valueFrom: + configMapKeyRef: + key: reposerver.grpc.max.size + name: argocd-cmd-params-cm + optional: true - name: HELM_CACHE_HOME value: /helm-working-dir - name: HELM_CONFIG_HOME diff --git a/manifests/install.yaml b/manifests/install.yaml index 282e6c9f66e7d..93044ae345900 100644 --- a/manifests/install.yaml +++ b/manifests/install.yaml @@ -22153,6 +22153,12 @@ spec: key: reposerver.git.request.timeout name: argocd-cmd-params-cm optional: true + - name: ARGOCD_GRPC_MAX_SIZE_MB + valueFrom: + configMapKeyRef: + key: reposerver.grpc.max.size + name: argocd-cmd-params-cm + optional: true - name: HELM_CACHE_HOME value: /helm-working-dir - name: HELM_CONFIG_HOME diff --git a/manifests/namespace-install.yaml b/manifests/namespace-install.yaml index 91826ef8d5620..c9180436fed2d 100644 --- a/manifests/namespace-install.yaml +++ b/manifests/namespace-install.yaml @@ -1274,6 +1274,12 @@ spec: key: reposerver.git.request.timeout name: argocd-cmd-params-cm optional: true + - name: ARGOCD_GRPC_MAX_SIZE_MB + valueFrom: + configMapKeyRef: + key: reposerver.grpc.max.size + name: argocd-cmd-params-cm + optional: true - name: HELM_CACHE_HOME value: /helm-working-dir - name: HELM_CONFIG_HOME diff --git a/pkg/apiclient/apiclient.go b/pkg/apiclient/apiclient.go index 83e841dd99bea..9b22530c45e74 100644 --- a/pkg/apiclient/apiclient.go +++ b/pkg/apiclient/apiclient.go @@ -62,13 +62,11 @@ const ( EnvArgoCDServer = "ARGOCD_SERVER" // EnvArgoCDAuthToken is the environment variable to look for an Argo CD auth token EnvArgoCDAuthToken = "ARGOCD_AUTH_TOKEN" - // EnvArgoCDgRPCMaxSizeMB is the environment variable to look for a max gRPC message size - EnvArgoCDgRPCMaxSizeMB = "ARGOCD_GRPC_MAX_SIZE_MB" ) var ( // MaxGRPCMessageSize contains max grpc message size - MaxGRPCMessageSize = env.ParseNumFromEnv(EnvArgoCDgRPCMaxSizeMB, 200, 0, math.MaxInt32) * 1024 * 1024 + MaxGRPCMessageSize = env.ParseNumFromEnv(common.EnvGRPCMaxSizeMB, 200, 0, math.MaxInt32) * 1024 * 1024 ) // Client defines an interface for interaction with an Argo CD server. diff --git a/reposerver/apiclient/clientset.go b/reposerver/apiclient/clientset.go index 417dc758ef5bd..41f8cef73eaa7 100644 --- a/reposerver/apiclient/clientset.go +++ b/reposerver/apiclient/clientset.go @@ -4,6 +4,9 @@ import ( "crypto/tls" "crypto/x509" "fmt" + "github.com/argoproj/argo-cd/v2/common" + "github.com/argoproj/argo-cd/v2/util/env" + "math" "time" grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" @@ -19,9 +22,9 @@ import ( //go:generate go run github.com/vektra/mockery/v2@v2.15.0 --name=RepoServerServiceClient -const ( +var ( // MaxGRPCMessageSize contains max grpc message size - MaxGRPCMessageSize = 100 * 1024 * 1024 + MaxGRPCMessageSize = env.ParseNumFromEnv(common.EnvGRPCMaxSizeMB, 100, 0, math.MaxInt32) * 1024 * 1024 ) // TLSConfiguration describes parameters for TLS configuration to be used by a repo server API client