You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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.
0 commit comments