Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(import): failure when multiple versions of the same CRD exist in …
…different obejcts (#1042) When a CRD has multiple objects that represent the same *kind* but for different versions, `cdk8s import` will fail with a vague "already exists" error. For example: ```yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: tenants.capsule.clastix.io spec: group: capsule.clastix.io names: kind: Tenant listKind: TenantList plural: tenants shortNames: - tnt singular: tenant scope: Cluster versions: - name: v1beta1 schema: openAPIV3Schema: ... --- apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: tenants.capsule.clastix.io spec: group: capsule.clastix.io names: kind: Tenant listKind: TenantList plural: tenants shortNames: - tnt singular: tenant scope: Cluster versions: - name: v1beta2 schema: openAPIV3Schema: ... ``` Note that if the two versions are defined within the same object, import will succeed. For example: ```yaml apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: name: tenants.capsule.clastix.io spec: group: capsule.clastix.io names: kind: Tenant listKind: TenantList plural: tenants shortNames: - tnt singular: tenant scope: Cluster versions: - name: v1beta1 schema: openAPIV3Schema: ... - name: v1beta2 schema: openAPIV3Schema: ... ``` This is actually a followup to #387.
- Loading branch information