KubernetesServiceExtensions.PublishAsKubernetesService<T> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Publishes the specified resource as a Kubernetes service.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> PublishAsKubernetesService<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, Action<Aspire.Hosting.Kubernetes.KubernetesResource> configure) where T : Aspire.Hosting.ApplicationModel.IComputeResource;
static member PublishAsKubernetesService : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)> * Action<Aspire.Hosting.Kubernetes.KubernetesResource> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.IComputeResource)
<Extension()>
Public Function PublishAsKubernetesService(Of T As IComputeResource) (builder As IResourceBuilder(Of T), configure As Action(Of KubernetesResource)) As IResourceBuilder(Of T)
Type Parameters
- T
The type of the resource.
Parameters
- builder
- IResourceBuilder<T>
The resource builder.
- configure
- Action<KubernetesResource>
The configuration action for the Kubernetes service.
Returns
The updated resource builder.
Remarks
This method checks if the application is in publish mode. If it is, it adds a customization annotation that will be applied by the infrastructure when generating the Kubernetes service.
builder.AddContainer("redis", "redis:alpine").PublishAsKubernetesService((service) =>
{
service.Name = "redis";
});