Skip to content

Add support for large NGINX config file sizes #1053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: v3
Choose a base branch
from

Conversation

dhurley
Copy link
Collaborator

@dhurley dhurley commented Apr 18, 2025

Proposed changes

Add support for file chunking when uploading and downloading NGINX config from a management plane.

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@dhurley dhurley added the v3.x Issues and Pull Requests related to the major version v3 label Apr 18, 2025
@dhurley dhurley self-assigned this Apr 18, 2025
@dhurley dhurley requested a review from a team as a code owner April 18, 2025 16:37
@github-actions github-actions bot added the chore Pull requests for routine tasks label Apr 18, 2025
@@ -26,6 +29,107 @@ import (
"github.com./stretchr/testify/require"
)

type FakeClientStreamingClient struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these fakes be put in a a file in the fakes directory ?

fileName: filePath,
}

t.Logf("fakeServerStreamingClient: %v", fakeServerStreamingClient)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this log meant to be left in ?

fakeServerStreamingClient.chunks[uint32(i)] = []byte{fileContent[i]}
}

t.Logf("fakeServerStreamingClient: %v", fakeServerStreamingClient)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one

fileManagerService := NewFileManagerService(fakeFileServiceClient, agentConfig)

request := protos.CreateConfigApplyRequest(overview)
t.Logf("request: %v", request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here too

@@ -30,6 +33,7 @@ import (
"google.golang.org/protobuf/types/known/timestamppb"

backoffHelpers "github.com./nginx/agent/v3/internal/backoff"
grpc2 "google.golang.org/grpc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change the import name from grpc2 ?

return nil
}

func (fms *FileManagerService) writeChunkedFile(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be in file_operator.go ?

return fms.getChunkedFile(ctx, file)
}

func (fms *FileManagerService) getFile(ctx context.Context, file *mpi.File) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (fms *FileManagerService) getFile(ctx context.Context, file *mpi.File) error {
func (fms *FileManagerService) file(ctx context.Context, file *mpi.File) error {

return fms.validateFileHash(file.GetFileMeta().GetName())
}

func (fms *FileManagerService) getChunkedFile(ctx context.Context, file *mpi.File) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (fms *FileManagerService) getChunkedFile(ctx context.Context, file *mpi.File) error {
func (fms *FileManagerService) chunkedFile(ctx context.Context, file *mpi.File) error {

"context"
"encoding/json"
"errors"
"fmt"
"io"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has nothing to do with this import just wondering if we could look at refactoring this file or look at the whole file plugin, operator and manager service or something. There is now a lot going on in this file and wondering if we could do something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks v3.x Issues and Pull Requests related to the major version v3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants