Skip to content

Support enforceInTransit field in PubSubTopic MessageStoragePolicy - #9700

Merged
justinsb merged 3 commits into
GoogleCloudPlatform:masterfrom
codebot-robot:issue_9649
Jun 12, 2026
Merged

Support enforceInTransit field in PubSubTopic MessageStoragePolicy#9700
justinsb merged 3 commits into
GoogleCloudPlatform:masterfrom
codebot-robot:issue_9649

Conversation

@codebot-robot

Copy link
Copy Markdown
Collaborator

This PR adds support for the enforceInTransit parameter under messageStoragePolicy in the PubSubTopic CRD (pubsubtopics.pubsub.cnrm.cloud.google.com).

Changes

  • Updated the local/vendored TPG Beta provider (resource_pubsub_topic.go) to add enforce_in_transit to the message_storage_policy schema, including its expander/flattener mapping helpers.
  • Added the EnforceInTransit *bool field under the MessageStoragePolicy struct in apis/pubsub/v1beta1/topic_types.go.
  • Added mapping logic for EnforceInTransit to pkg/controller/direct/pubsub/topic_mapper.go.
  • Promoted .message_storage_policy.enforce_in_transit to a SpecField in pkg/controller/direct/pubsub/topic_fuzzer.go.
  • Regenerated manifests (CRDs, DeepCopy functions, generated clients).
  • Updated the E2E golden tests for pubsubtopic to configure enforceInTransit: true during creation and enforceInTransit: false during update to verify correct handling in both states.

Fixes #9649

@justinsb

Copy link
Copy Markdown
Collaborator

@maqiuyujoyce I think this works - adding to both controllers (I've just reassigned back to codebot-robot to regenerate the clients, I'm assuming). Mind taking a look with me (I did cross-check against the terraform code, but I'm not sure I'm much more competent than the AI here 😂 )

@justinsb
justinsb requested a review from maqiuyujoyce June 11, 2026 11:17
@codebot-robot codebot-robot removed their assignment Jun 11, 2026
@justinsb

Copy link
Copy Markdown
Collaborator

We have a unit test failure:

=== NAME  TestSpecAndStatusToYAML
    utils.go:150: FAIL: unexpected diff in testdata/pubsubtopic-spec.yaml.golden:   (
          	"""
          	... // 6 identical lines
          	  allowedPersistenceRegions:
          	  - string
        + 	  enforceInTransit: boolean
          	resourceID: string
          	schemaSettings:
          	... // 6 identical lines
          	"""
          )
--- FAIL: TestSpecAndStatusToYAML (7.78s)

@codebot-robot codebot-robot removed their assignment Jun 11, 2026

@maqiuyujoyce maqiuyujoyce left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@maqiuyujoyce I think this works - adding to both controllers (I've just reassigned back to codebot-robot to regenerate the clients, I'm assuming). Mind taking a look with me (I did cross-check against the terraform code, but I'm not sure I'm much more competent than the AI here 😂 )

Yep, it looks good! A bit concerned about the real GCP test, but for a PubSubTopic, I think we can start with it and see how it goes.

/lgtm

@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maqiuyujoyce

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@justinsb

Copy link
Copy Markdown
Collaborator

Yep, it looks good! A bit concerned about the real GCP test, but for a PubSubTopic, I think we can start with it and see how it goes.

Yeah, we can see! We know that the GCP and Direct controllers behave the same way based on the logs, against mockgcp. When we run against realgcp we'll find out whether our mockgcp is accurate.

Another argument for a release branch :-)

@justinsb
justinsb added this pull request to the merge queue Jun 12, 2026
Merged via the queue into GoogleCloudPlatform:master with commit be3df83 Jun 12, 2026
178 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support enforceInTransit field in PubSubTopic MessageStoragePolicy

3 participants