Skip to content

Fix NSTlsInspectionPolicy and verify against realGCP - #12449

Merged
gemmahou merged 5 commits into
GoogleCloudPlatform:masterfrom
gemmahou:nstlsinspectionpolicy-real
Aug 26, 2026
Merged

gemmahou merged 5 commits into
GoogleCloudPlatform:masterfrom
gemmahou:nstlsinspectionpolicy-real

Conversation

@gemmahou

@gemmahou gemmahou commented Aug 18, 2026 •

Copy link
Copy Markdown
Collaborator

BRIEF Change description

Addresses #6787

  1. Updated NSTlsInspectionPolicy test cases, re-gen logs against real and mockGCP
  2. Added a mapper function manually and commented out the generated mapper, removed the prefix of the resolved "CAPoolRef", to satisfy the GCP API restriction.

WHY do we need this change?

Special notes for your reviewer:

Does this PR add something which needs to be 'release noted'?


  • Reviewer reviewed release note.

Additional documentation e.g., references, usage docs, etc.:


Intended Milestone

Please indicate the intended milestone.

  • Reviewer tagged PR with the actual milestone.

Tests you have done

  • Run make ready-pr to ensure this PR is ready for review.
  • Perform necessary E2E testing for changed resources.

@gemmahou
gemmahou force-pushed the nstlsinspectionpolicy-real branch 2 times, most recently from 7155544 to 7ec1650 Compare August 20, 2026 17:16
@gemmahou
gemmahou force-pushed the nstlsinspectionpolicy-real branch 2 times, most recently from 3838b02 to cfc5fd0 Compare August 20, 2026 20:16
"github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct"
)

func NetworkSecurityTLSInspectionPolicySpec_v1alpha1_FromProto(mapCtx *direct.MapContext, in *pb.TlsInspectionPolicy) *krmnetworksecurityv1alpha1.NetworkSecurityTLSInspectionPolicySpec {

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.

Is there a particular reason we need a hand-crafted mapper here instead of relying on generation?
Probably worth updating the PR description

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, in line52, we need to call then shared "StripCAPoolPrefix" function to convert the ref to the required format.

Updated PR description.

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.

Should we try updating load bearing fields instead of description?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added a -full test and updated all mutable fields there.

@gemmahou
gemmahou force-pushed the nstlsinspectionpolicy-real branch from afde8e3 to 9fce577 Compare August 24, 2026 18:20

@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.

Might worth update the delete operation response.

Otherwise LGTM.

Comment on lines +289 to +298
"response": {
"@type": "type.googleapis.com/google.protobuf.Empty"
}
}

---

GET https://privateca.googleapis.com/v1/projects/${projectId}/locations/us-central1/caPools/capool-${uniqueId}?alt=json
Content-Type: application/json
User-Agent: kcc/${kccVersion} (+https://github.com/GoogleCloudPlatform/k8s-config-connector) kcc/controller-manager/${kccVersion} DeclarativeClientLib/0.0.1

404 Not Found
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"error": {
"code": 404,
"message": "Resource 'projects/${projectId}/locations/us-central1/caPools/capool-${uniqueId}' was not found",
"status": "NOT_FOUND"
"@type": "type.googleapis.com/google.cloud.networksecurity.v1.TlsInspectionPolicy",
"caPool": "projects/${projectId}/locations/us-central1/caPools/capool-dep-2",
"createTime": "2024-04-01T12:34:56.123456Z",
"description": "An updated TLS Inspection Policy to decrypt traffic",
"excludePublicCaSet": true,
"minTlsVersion": "TLS_1_2",
"name": "projects/${projectId}/locations/us-central1/tlsInspectionPolicies/tlsinspection-${uniqueId}",
"tlsFeatureProfile": "PROFILE_COMPATIBLE",
"updateTime": "2024-04-01T12:34:56.123456Z"

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.

The response section of a delete operation is an empty struct here in real GCP.

I think that is probably a better behavior in mock as well.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated mock to match the real

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.

This is out of the scope.

I think the size of golden alignment test is a bit too large and contains so much normalization logic. It's hard to track which are outdated, and which will have side-effects, especially when they are mostly updated by overseer these days. We probably need to have a better solution to group these normalization logic.

@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.

/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

@gemmahou
gemmahou dismissed ldanielmadariaga’s stale review August 25, 2026 22:49

Comments addressed.

@gemmahou
gemmahou added this pull request to the merge queue Aug 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@gemmahou
gemmahou added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@gemmahou
gemmahou added this pull request to the merge queue Aug 26, 2026
Merged via the queue into GoogleCloudPlatform:master with commit 0a3cbda Aug 26, 2026
247 checks passed
@gemmahou
gemmahou deleted the nstlsinspectionpolicy-real branch August 26, 2026 17:11
@barney-s barney-s mentioned this pull request Sep 1, 2026
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.

3 participants

⌂ 换网址