feat(crd-from-oas): EventGatewayVirtualClusterProducePolicy CRD#4342
feat(crd-from-oas): EventGatewayVirtualClusterProducePolicy CRD#4342tao12345666333 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
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
EventGatewayVirtualClusterProducePolicywith 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/generateSchemaTypesvia anemittedNested/emittedmap.
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.
randmonkey
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Is the MinLength required as it is an Enum?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Should we add some CELs to make sure that the type matches the configuration?
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
747a8f2 to
133270f
Compare
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:CHANGELOG.mdrelease notes have been updated to reflect significant changes