ServiceArgs

data class ServiceArgs(val apiVersion: Output<String>? = null, val kind: Output<String>? = null, val metadata: Output<ObjectMetaArgs>? = null, val spec: Output<ServiceSpecArgs>? = null) : ConvertibleToJava<ServiceArgs>

Service is a named abstraction of software service (for example, mysql) consisting of local port (for example 3306) that the proxy listens on, and the selector that determines which pods will answer requests sent through the proxy. This resource waits until its status is ready before registering success for create/update, and populating output properties from the current state of the resource. The following conditions are used to determine whether the resource creation has succeeded or failed:

  1. Service object exists.

  2. Related Endpoint objects are created. Each time we get an update, wait 10 seconds for any stragglers.

  3. There are no "not ready" endpoints -- unless the Service is an "empty headless" Service 1, a Service with '.spec.type: ExternalName', or a Service without a selector.

  4. External IP address is allocated (if Service has '.spec.type: LoadBalancer'). If the Service has not reached a Ready state after 10 minutes, it will time out and mark the resource update as Failed. You can override the default timeout value by setting the 'customTimeouts' option on the resource.

Example Usage

Create a Service with auto-naming

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.kubernetes.core_v1.Service;
import com.pulumi.kubernetes.core_v1.ServiceArgs;
import com.pulumi.kubernetes.core_v1.inputs.ServiceSpecArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var service = new Service("service", ServiceArgs.builder()
.spec(ServiceSpecArgs.builder()
.ports(ServicePortArgs.builder()
.port(80)
.protocol("TCP")
.targetPort(9376)
.build())
.selector(Map.of("app", "MyApp"))
.build())
.build());
}
}

Create a Service with a user-specified name

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.kubernetes.core_v1.Service;
import com.pulumi.kubernetes.core_v1.ServiceArgs;
import com.pulumi.kubernetes.meta_v1.inputs.ObjectMetaArgs;
import com.pulumi.kubernetes.core_v1.inputs.ServiceSpecArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var service = new Service("service", ServiceArgs.builder()
.metadata(ObjectMetaArgs.builder()
.name("my-service")
.build())
.spec(ServiceSpecArgs.builder()
.ports(ServicePortArgs.builder()
.port(80)
.protocol("TCP")
.targetPort(9376)
.build())
.selector(Map.of("app", "MyApp"))
.build())
.build());
}
}

Constructors

Link copied to clipboard
constructor(apiVersion: Output<String>? = null, kind: Output<String>? = null, metadata: Output<ObjectMetaArgs>? = null, spec: Output<ServiceSpecArgs>? = null)

Properties

Link copied to clipboard
val apiVersion: Output<String>? = null

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources

Link copied to clipboard
val kind: Output<String>? = null

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds

Link copied to clipboard
val metadata: Output<ObjectMetaArgs>? = null

Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata

Link copied to clipboard
val spec: Output<ServiceSpecArgs>? = null

Spec defines the behavior of a service. https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status

Functions

Link copied to clipboard
open override fun toJava(): ServiceArgs