Skip to content

Conversation

@fghanmi
Copy link
Contributor

@fghanmi fghanmi commented Aug 5, 2025

Summary by Sourcery

Introduce a new configurable limit for incoming gRPC message sizes in Trillian components by extending CRDs, API types, and deployment logic.

New Features:

  • Add maxCertChainSize property to SecureSign and Trillian CRDs with a default of 153600 bytes
  • Add MaxRecvMessageSize field to TrillianSpec API type with a default value

Enhancements:

  • Include the --max_msg_size_bytes flag in Trillian server deployment arguments when the new setting is specified

@sourcery-ai
Copy link

sourcery-ai bot commented Aug 5, 2025

Reviewer's Guide

Introduce a configurable gRPC message size limit for Trillian by extending CRD schemas, API spec, and server deployment to accept a MaxRecvMessageSize setting (default 153600 bytes).

ER diagram for Trillian CRD with MaxRecvMessageSize field

erDiagram
    TRILLIAN_SPEC {
        int64 MaxRecvMessageSize
        LocalObjectReference TrustedCA
    }
Loading

Class diagram for updated TrillianSpec with MaxRecvMessageSize

classDiagram
    class TrillianSpec {
        +LocalObjectReference* TrustedCA
        +int64* MaxRecvMessageSize
    }
Loading

File-Level Changes

Change Details Files
Add maxCertChainSize property to custom resource definitions
  • Defined new integer property with default 153600
  • Added description explaining MaxRecvMessageSize purpose
  • Included format and validation rules
config/crd/bases/rhtas.redhat.com_securesigns.yaml
config/crd/bases/rhtas.redhat.com_trillians.yaml
Add MaxRecvMessageSize field to TrillianSpec API
  • Declared MaxRecvMessageSize as *int64 with kubebuilder default 153600
  • Marked field optional with JSON tag
  • Documented field purpose in Go struct comments
api/v1alpha1/trillian_types.go
Propagate MaxRecvMessageSize to Trillian server deployment args
  • Check if MaxRecvMessageSize is non-nil
  • Append --max_msg_size_bytes flag with formatted value
internal/controller/trillian/utils/server-deployment.go

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @fghanmi - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `api/v1alpha1/trillian_types.go:41` </location>
<code_context>
 	//+optional
 	TrustedCA *LocalObjectReference `json:"trustedCA,omitempty"`
+
+	// MaxRecvMessageSize sets the maximum size in bytes for incoming gRPC messages handled by the Trillian logserver and logsigner
+	//+kubebuilder:default:=153600
+	//+optional
+	MaxRecvMessageSize *int64 `json:"maxRecvMessageSize,omitempty"`
 }

</code_context>

<issue_to_address>
Consider aligning the field name with the CRD property for consistency.

The Go struct uses 'MaxRecvMessageSize', while the CRD uses 'maxCertChainSize'. If these refer to the same value, please align the names to avoid confusion.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
	// MaxRecvMessageSize sets the maximum size in bytes for incoming gRPC messages handled by the Trillian logserver and logsigner
	//+kubebuilder:default:=153600
	//+optional
	MaxRecvMessageSize *int64 `json:"maxRecvMessageSize,omitempty"`
=======
	// MaxCertChainSize sets the maximum allowed certificate chain size in bytes for incoming gRPC messages handled by the Trillian logserver and logsigner
	//+kubebuilder:default:=153600
	//+optional
	MaxCertChainSize *int64 `json:"maxCertChainSize,omitempty"`
>>>>>>> REPLACE

</suggested_fix>

### Comment 2
<location> `internal/controller/trillian/utils/server-deployment.go:138` </location>
<code_context>
 			"--alsologtostderr",
 		}, args...)

+		if instance.Spec.MaxRecvMessageSize != nil {
+			container.Args = append(container.Args, "--max_msg_size_bytes", fmt.Sprintf("%d", *instance.Spec.MaxRecvMessageSize))
+		}
+
</code_context>

<issue_to_address>
Check for potential mismatch between CRD and CLI flag naming.

Verify that '--max_msg_size_bytes' is the correct flag name for Trillian logserver and logsigner, and that it maps as intended to 'maxRecvMessageSize'. Otherwise, configuration may not be applied as expected.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@osmman osmman merged commit d68839a into main Aug 6, 2025
18 checks passed
@osmman osmman deleted the SECURESIGN-2191 branch August 6, 2025 10:25
@osmman osmman added the enhancement New feature or request label Aug 7, 2025
@osmman osmman changed the title [SECURESIGN-2191] Set max log entry size in Trillian feat: set max log entry size in Trillian Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants