-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to provide API version as resource-specific configuration #1089
Labels
area/crossplane
Issues or PRs related to crossplane
kind/enhancement
Categorizes issue or PR as related to existing feature enhancements.
Comments
muvaf
added
the
kind/enhancement
Categorizes issue or PR as related to existing feature enhancements.
label
Dec 7, 2021
If this sounds good to you all, I can dive into the code to see how we can implement it for both ACK and Crossplane. cc @jaypipes and friends |
Sounds great @muvaf, i believe this will also have an impact on aws-controllers-k8s/code-generator#122. We will have to generate webhooks for specific resource rather than full api versions |
ack-bot
pushed a commit
to aws-controllers-k8s/code-generator
that referenced
this issue
Jan 28, 2022
- Fixes #1089 - Adds config.ResourceConfig.APIVersion to be able to override the generated version for a CRD Issue #, if available: [#1089](aws-controllers-k8s/community#1089) Description of changes: This PR proposes a new configuration field named `APIVersion` (JSON-serialized name `api_version`) in `config.ResourceConfig` that allows overriding versions of specific CRDs generated by the Crossplane codegen pipeline. If a specific version string is not configured for a CRD-type, the default version specified with the `--version` command-line argument is used for backwards-compatibility. An [example configuration](https://github.com/crossplane/provider-aws/blob/master/apis/cloudfront/v1alpha1/generator-config.yaml) overriding the version for the CloudFront Distribution resource is as follows: ``` resources: "Distribution": api_versions: - name: "v1beta1" storage: true ignore: resource_names: - FieldLevelEncryptionProfile - Invalidation - KeyGroup - OriginRequestPolicy - PublicKey - StreamingDistribution - RealtimeLogConfig - MonitoringSubscription - FieldLevelEncryptionConfig field_paths: - DistributionConfig.CallerReference - Origins.Quantity - OriginAccessIdentityConfig.CallerReference ``` **This PR now introduces a backward-incompatible behavior change in the Crossplane pipeline:** Because the generator configuration is per API group (service) and because we may now have resources belonging to different API versions in a single group, this PR changes the default path of the `generator-config.yaml` file from: `apis/<API group>/<API version>/generator-config.yaml` to `apis/<API group>/generator-config.yaml` An example invocation `ack-generate crossplane cloudfront --output <output path> --generator-config-path generator-config.yaml` using the above configuration yields the following file structure: ```console ❯ tree . ├── apis │ └── cloudfront │ ├── v1alpha1 │ │ ├── zz_cache_policy.go │ │ ├── zz_cloud_front_origin_access_identity.go [0/941] │ │ ├── zz_doc.go │ │ ├── zz_enums.go │ │ ├── zz_function.go │ │ ├── zz_groupversion_info.go │ │ ├── zz_response_headers_policy.go │ │ └── zz_types.go │ └── v1beta1 │ ├── zz_distribution.go │ ├── zz_doc.go │ ├── zz_enums.go │ ├── zz_groupversion_info.go │ └── zz_types.go ├── generator-config.yaml ├── go.mod ├── go.sum └── pkg └── controller └── cloudfront ├── cachepolicy │ ├── zz_controller.go │ └── zz_conversions.go ├── cloudfrontoriginaccessidentity │ ├── zz_controller.go │ └── zz_conversions.go ├── distribution │ ├── zz_controller.go │ └── zz_conversions.go ├── function │ ├── zz_controller.go │ └── zz_conversions.go └── responseheaderspolicy ├── zz_controller.go └── zz_conversions.go 12 directories, 26 files ``` Without the `resources` configuration block, all resources are under `v1alpha1` version as expected: ```console ❯ tree . . ├── apis [0/1036] │ └── cloudfront │ └── v1alpha1 │ ├── zz_cache_policy.go │ ├── zz_cloud_front_origin_access_identity.go │ ├── zz_distribution.go │ ├── zz_doc.go │ ├── zz_enums.go │ ├── zz_function.go │ ├── zz_groupversion_info.go │ ├── zz_response_headers_policy.go │ └── zz_types.go ├── generator-config.yaml ├── go.mod ├── go.sum └── pkg └── controller └── cloudfront ├── cachepolicy │ ├── zz_controller.go │ └── zz_conversions.go ├── cloudfrontoriginaccessidentity │ ├── zz_controller.go │ └── zz_conversions.go ├── distribution │ ├── zz_controller.go │ └── zz_conversions.go ├── function │ ├── zz_controller.go │ └── zz_conversions.go └── responseheaderspolicy ├── zz_controller.go └── zz_conversions.go 11 directories, 22 files ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Closed
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/crossplane
Issues or PRs related to crossplane
kind/enhancement
Categorizes issue or PR as related to existing feature enhancements.
Is your feature request related to a problem?
Currently, you can give version input, i.e.
v1alpha1
, as a flag to the CLI but that means all members of that API group get to use the same version. However, there are cases where only a few resources in the given group are meant to be bumped tov1beta1
for example.Describe the solution you'd like
A new configuration field in
ResourceConfig
would give enough level of granularity for this configuration.The text was updated successfully, but these errors were encountered: