Skip to content

Commit

Permalink
feat: added support for GRPC_MESSAGE_SIZE env var (#6258)
Browse files Browse the repository at this point in the history
Signed-off-by: David Peer <david.peer@mobileye.com>

Co-authored-by: David Peer <david.peer@mobileye.com>
  • Loading branch information
dpeer6 and David Peer authored Jul 22, 2021
1 parent 98721a9 commit 49db7cd
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
31 changes: 31 additions & 0 deletions docs/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,37 @@ Note that these environment variables may be removed at any time.
| `WORKFLOW_GC_PERIOD` | `time.Duration` | The periodicity for GC of workflows. |
| `BUBBLE_ENTRY_TEMPLATE_ERR` | `bool` | Whether to bubble up template errors to workflow. Default true |
| `INFORMER_WRITE_BACK` | `bool` | Whether to write back to informer instead of catching up. Deafult true |
| `GRPC_MESSAGE_SIZE` | `string` | Use different GRPC Max message size for Argo server deployment (supporting huge workflows) |

You can set environment variable for the argo-server deployment, for example:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: argo-server
spec:
selector:
matchLabels:
app: argo-server
template:
metadata:
labels:
app: argo-server
spec:
containers:
- args:
- server
image: argoproj/argocli:latest
name: argo-server
env:
- name: GRPC_MESSAGE_SIZE
value: "209715200"
ports:
..
...
....
```

You can set the environment variables for controller in controller's container spec like the following:

Expand Down
17 changes: 13 additions & 4 deletions server/apiserver/argoserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"google.golang.org/grpc/credentials"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/rest"
"k8s.io/utils/env"

"github.com/argoproj/argo-workflows/v3"
"github.com/argoproj/argo-workflows/v3/config"
Expand Down Expand Up @@ -56,10 +57,7 @@ import (
"github.com/argoproj/argo-workflows/v3/workflow/hydrator"
)

const (
// MaxGRPCMessageSize contains max grpc message size
MaxGRPCMessageSize = 100 * 1024 * 1024
)
var MaxGRPCMessageSize int

type argoServer struct {
baseHRef string
Expand Down Expand Up @@ -96,6 +94,17 @@ type ArgoServerOpts struct {
AccessControlAllowOrigin string
}

func init() {
var err error
MaxGRPCMessageSize, err = env.GetInt("GRPC_MESSAGE_SIZE", 100 * 1024 * 1024)
if err != nil {
log.Fatalf("GRPC_MESSAGE_SIZE environment variable must be set as an integer", err)
}
log.WithFields(log.Fields{
"GRPC_MESSAGE_SIZE": MaxGRPCMessageSize,
}).Info("GRPC Server Max Message Size, MaxGRPCMessageSize, is set")
}

func NewArgoServer(ctx context.Context, opts ArgoServerOpts) (*argoServer, error) {
configController := config.NewController(opts.Namespace, opts.ConfigName, opts.Clients.Kubernetes, emptyConfigFunc)
ssoIf := sso.NullSSO
Expand Down

0 comments on commit 49db7cd

Please sign in to comment.