# CertManagerResource

- Kind: `class`
- Package: [Aspire.Hosting.Kubernetes](/reference/api/csharp/aspire.hosting.kubernetes.md)
- Version: `13.4.0-preview.1.26281.18`
- Namespace: `Aspire.Hosting.Kubernetes`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/becb48e2d61099e35ae336d527d3875e928d6594/src/Aspire.Hosting.Kubernetes/CertManagerResource.cs)
- Inherits: `Resource`
- Implements: `IResource`, `IResourceWithParent`, `IResourceWithParent<KubernetesEnvironmentResource>`

Represents a cert-manager installation on a Kubernetes environment.

## Definition

```csharp
namespace Aspire.Hosting.Kubernetes;

public sealed class CertManagerResource
    : Aspire.Hosting.ApplicationModel.Resource,
      Aspire.Hosting.ApplicationModel.IResource,
      Aspire.Hosting.ApplicationModel.IResourceWithParent,
      Aspire.Hosting.ApplicationModel.IResourceWithParent<Aspire.Hosting.Kubernetes.KubernetesEnvironmentResource>
{
    // ...
}
```

## ATS metadata

### ATS export

- Type ID: `Aspire.Hosting.Kubernetes/CertManagerResource`

## Remarks

cert-manager is a Kubernetes add-on that provisions and renews X.509 certificates from sources such as Let's Encrypt. Aspire models cert-manager as a typed resource so that issuer resources ( [CertManagerIssuerResource](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerissuerresource.md)) can be parented to it and gateways/ingresses can reference issuers in a strongly-typed way via `WithTls(issuer)`.

Under the covers, [CertManagerExtensions.AddCertManager(IResourceBuilder<KubernetesEnvironmentResource>, string, string?)](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerextensions/methods.md#addcertmanager-iresourcebuilder-kubernetesenvironmentresource-string-string) installs cert-manager using a [KubernetesHelmChartResource](/reference/api/csharp/aspire.hosting.kubernetes/kuberneteshelmchartresource.md) pointed at the upstream `oci://quay.io/jetstack/charts/cert-manager` chart, with CRDs and Gateway API support enabled. The chart resource is registered in the model under `"{name}-chart"` (so the cert-manager wrapper itself can keep the natural `"{name}"` identifier) and is exposed via [CertManagerResource.HelmChart](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerresource/properties.md#helmchart) for advanced configuration.

## Constructors

- [CertManagerResource(string, KubernetesEnvironmentResource, KubernetesHelmChartResource)](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerresource/constructors.md#constructor-string-kubernetesenvironmentresource-kuberneteshelmchartresource) -- Initializes a new instance of [CertManagerResource](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerresource.md).

## Properties

- [HelmChart](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerresource/properties.md#helmchart) : [KubernetesHelmChartResource](/reference/api/csharp/aspire.hosting.kubernetes/kuberneteshelmchartresource.md) `get` -- Gets the underlying Helm chart resource used to install cert-manager. Use this to layer additional Helm values via `WithHelmChartValues` or to inspect chart metadata. The chart name and version are fixed at construction time and cannot be changed through this property.
- [Parent](/reference/api/csharp/aspire.hosting.kubernetes/certmanagerresource/properties.md#parent) : [KubernetesEnvironmentResource](/reference/api/csharp/aspire.hosting.kubernetes/kubernetesenvironmentresource.md) `get` -- Gets the parent Kubernetes environment that hosts cert-manager.

## Examples

```csharp
var aks = builder.AddAzureKubernetesEnvironment("aks");
var certManager = aks.AddCertManager("cert-manager");

var letsencrypt = certManager.AddIssuer("letsencrypt-prod")
    .WithLetsEncryptProduction("ops@contoso.com")
    .WithHttp01Solver();

aks.AddGateway("gw")
   .WithRoute("/api", api.GetEndpoint("http"))
   .WithTls(letsencrypt);
```
