Skip to content

feat(crd-from-oas): EventGatewayVirtualClusterProducePolicy CRD#4342

Open
tao12345666333 wants to merge 2 commits into
mainfrom
4238-crd-EventGatewayVirtualClusterProducePolicy
Open

feat(crd-from-oas): EventGatewayVirtualClusterProducePolicy CRD#4342
tao12345666333 wants to merge 2 commits into
mainfrom
4238-crd-EventGatewayVirtualClusterProducePolicy

Conversation

@tao12345666333
Copy link
Copy Markdown
Member

What this PR does / why we need it:

Which issue this PR fixes

Fixes #4238

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect significant changes

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new EventGatewayVirtualClusterProducePolicy CRD generated from the Konnect OpenAPI spec endpoint /v1/event-gateways/{gatewayId}/virtual-clusters/{virtualClusterId}/produce-policies, including parser/generator improvements to support nested event-gateway resources and deduplicate emitted union types.

Changes:

  • Add new OAS-generated CRD type EventGatewayVirtualClusterProducePolicy with associated funcs, deepcopy, scheme registration, kustomization, helm snapshots, and validation test.
  • Fix CRD parser to derive EventGatewayVirtualCluster-style ref field names (and accessor entity names) for nested resources under /v1/event-gateways/....
  • Deduplicate generated union types in writeNestedInlineTypes / generateSchemaTypes via an emittedNested/emitted map.

Reviewed changes

Copilot reviewed 27 out of 36 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crd-from-oas/config.yaml Registers new produce-policies endpoint.
crd-from-oas/pkg/parser/parser.go Adjusts path dependency naming for nested event-gateway resources.
crd-from-oas/pkg/parser/parser_test.go Adds parser test case for nested virtual cluster path.
crd-from-oas/pkg/generator/generator.go Deduplicates emitted union types.
api/konnect/v1alpha1/zz_generated_eventgatewayvirtualclusterproducepolicy_types.go Generated type, list, spec, status and union JSON marshaling.
api/konnect/v1alpha1/zz_generated_eventgatewayvirtualclusterproducepolicy_funcs.go Generated accessor helpers for the new type.
api/konnect/v1alpha1/zz_generated_eventgatewayvirtualclusterproducepolicy_types_test.go Generated JSON marshaling tests.
api/konnect/v1alpha1/zz_generated.deepcopy.go Deepcopy methods for the new and related shared types.
api/konnect/v1alpha1/zz_generated_groupversion_info.go Registers new types into the scheme.
api/konnect/v1alpha1/zz_generated_list_funcs.go Adds GetItems() for the new list.
api/konnect/v1alpha1/zz_generated_eventgatewaylistenerpolicy_funcs.go Removes duplicated GetListenerRef helper.
api/konnect/v1alpha1/schema_types_test.go Adds JSON marshal tests for new shared types.
scripts/apitypes-funcs/supportedtypes.go Registers new type for generated list helpers.
config/crd/kong-operator/kustomization.yaml + new CRD YAML Adds the CRD manifest into kustomization.
charts/kong-operator/ci/snapshots/*.snap Updates helm chart snapshots to include the new CRD.
test/crdsvalidation/konnect.konghq.com/eventgatewayvirtualclusterproducepolicy_test.go Adds envtest validation for the new CRD.
Files not reviewed (9)
  • api/konnect/v1alpha1/schema_types.go: Language not supported
  • api/konnect/v1alpha1/schema_types_test.go: Language not supported
  • api/konnect/v1alpha1/zz_generated.deepcopy.go: Language not supported
  • api/konnect/v1alpha1/zz_generated_eventgatewaylistenerpolicy_funcs.go: Language not supported
  • api/konnect/v1alpha1/zz_generated_eventgatewayvirtualclusterproducepolicy_funcs.go: Language not supported
  • api/konnect/v1alpha1/zz_generated_eventgatewayvirtualclusterproducepolicy_types.go: Language not supported
  • api/konnect/v1alpha1/zz_generated_eventgatewayvirtualclusterproducepolicy_types_test.go: Language not supported
  • api/konnect/v1alpha1/zz_generated_groupversion_info.go: Language not supported
  • api/konnect/v1alpha1/zz_generated_list_funcs.go: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tao12345666333 tao12345666333 marked this pull request as ready for review May 19, 2026 06:50
@tao12345666333 tao12345666333 requested a review from a team as a code owner May 19, 2026 06:50
Copy link
Copy Markdown
Contributor

@randmonkey randmonkey left a comment

Choose a reason for hiding this comment

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

Generally LGTM, some minor comments: Can it be done by generator, or can we add them manually after generating?

// Type designates the type of configuration.
//
// +required
// +kubebuilder:validation:MinLength=1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is the MinLength required as it is an Enum?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It is not necessary; I just kept it in the same format as the other CRDs for now. I think we will do a unified cleanup after we finish adding all these CRDs.

// EncryptionKey represents a union type for EncryptionKey.
// Only one of the fields should be set based on the Type.
//
type EncryptionKey struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we add some CELs to make sure that the type matches the configuration?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added 133270f

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
@tao12345666333 tao12345666333 force-pushed the 4238-crd-EventGatewayVirtualClusterProducePolicy branch from 747a8f2 to 133270f Compare May 19, 2026 13:11
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.

Konnect CRDs: (eventgateway) Generate CRDs for Event Gateway Virtual Cluster Produce Policy

3 participants