Missing import and attribute in .NET generated code
When generating CRDs code for .NET the generated code has no import for the correct KubernetesResource base class, as well as using the CrdsResourceType attribute, which is nowhere to be found.
Steps to reproduce
- run
./crd2pulumi -d cert-manager.crds.yaml - open the
Pulumi.Crds.csprojproject - the project has errors in all the generated CDR code files
Expected: the generated project compiles Actual: the generated project doesn't compile
Example:
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Crds.Certmanager.V1
{
/// <summary>
/// A Certificate resource should be created to ensure an up to date and signed x509 certificate is stored in the Kubernetes Secret resource named in `spec.secretName`.
/// The stored certificate will be renewed before it expires (as configured by `spec.renewBefore`).
/// </summary>
[CrdsResourceType("kubernetes:cert-manager.io/v1:Certificate")]
public partial class Certificate : KubernetesResource
{
In this file, the KubernetesResource is not resolved in any using namespace. Adding this:
using Pulumi.crds;
solves the issue, but it must be done in all the files.
Also, the CrdsResourceType attribute is not resolved, and I cannot find it anywhere.
Same issue here, the code generated with the latest release in both linux and windows is missing the correct imports, CrdsResourceType and the Utilities class, even after importing the generated namespace, is conflicting with the namespace Pulumi.Utilities.
Possibly related to https://github.com/pulumi/crd2pulumi/issues/48?
the code generated with the latest release in both linux and windows is missing the correct imports
@nwrox Was this working previously for you and started not working with the latest release?
Possibly related to #48?
the code generated with the latest release in both linux and windows is missing the correct imports
@nwrox Was this working previously for you and started not working with the latest release?
First time using the tool. I'm trying to convert the traefik crds (https://github.com/traefik/traefik/tree/master/docs/content/reference/dynamic-configuration/traefik.containo.us_*.yaml) and i got the following errors:
Missing import (^1.0.5)

Namespace conflict (^1.0.5)

Stop the conflict if edited manually:

Missing reference (^1.0.6)

This last one i couldn't find a reference anywhere in pulumi's organization.
I had the same problem. I fixed it by adding the flag --dotnetName Crds to the command ./crd2pulumi -d --dotnetName Crds cert-manager.crds.yaml. This changes the namespace from Pulumi.crds to Pulumi.Crds in both KubernetesResource.cs and Utilities.cs. This fixes all namespace errors regarding KubernetesResource and the Version from the Utilities class.
The missing CrdsResourceType is because of a temporary fix here.
I added the following class after the Utilities class in the file Utilities.cs to fix the issue. The following class is a snippet from the template from the main pulumi repository which is missing from the temporary fix in this repository.
internal sealed class CrdsResourceTypeAttribute : Pulumi.ResourceTypeAttribute
{
public CrdsResourceTypeAttribute(string type) : base(type, Utilities.Version)
{
}
}
Added to epic https://github.com/pulumi/home/issues/3431