Class Service.Builder
- java.lang.Object
-
- org.cdk8s.plus20.Service.Builder
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Servicebuild()Service.BuilderclusterIp(String clusterIp)The IP address of the service and is usually assigned randomly by the master.static Service.Buildercreate(software.constructs.Construct scope, String id)Service.BuilderexternalIPs(List<String> externalIPs)A list of IP addresses for which nodes in the cluster will also accept traffic for this service.Service.BuilderexternalName(String externalName)The externalName to be used when ServiceType.EXTERNAL_NAME is set.Service.BuilderloadBalancerSourceRanges(List<String> loadBalancerSourceRanges)A list of CIDR IP addresses, if specified and supported by the platform, will restrict traffic through the cloud-provider load-balancer to the specified client IPs.Service.Buildermetadata(org.cdk8s.ApiObjectMetadata metadata)Metadata that all persisted resources must have, which includes all objects users must create.Service.Builderports(List<? extends ServicePort> ports)The port exposed by this service.Service.Buildertype(ServiceType type)Determines how the Service is exposed.
-
-
-
Method Detail
-
create
@Stability(Stable) public static Service.Builder create(software.constructs.Construct scope, String id)
- Parameters:
scope- This parameter is required.id- This parameter is required.- Returns:
- a new instance of
Service.Builder.
-
metadata
@Stability(Stable) public Service.Builder metadata(org.cdk8s.ApiObjectMetadata metadata)
Metadata that all persisted resources must have, which includes all objects users must create.- Parameters:
metadata- Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.- Returns:
this
-
clusterIp
@Stability(Stable) public Service.Builder clusterIp(String clusterIp)
The IP address of the service and is usually assigned randomly by the master.If an address is specified manually and is not in use by others, it will be allocated to the service; otherwise, creation of the service will fail. This field can not be changed through updates. Valid values are "None", empty string (""), or a valid IP address. "None" can be specified for headless services when proxying is not required. Only applies to types ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName.
Default: - Automatically assigned.
- Parameters:
clusterIp- The IP address of the service and is usually assigned randomly by the master. This parameter is required.- Returns:
this
-
externalIPs
@Stability(Stable) public Service.Builder externalIPs(List<String> externalIPs)
A list of IP addresses for which nodes in the cluster will also accept traffic for this service.These IPs are not managed by Kubernetes. The user is responsible for ensuring that traffic arrives at a node with this IP. A common example is external load-balancers that are not part of the Kubernetes system.
Default: - No external IPs.
- Parameters:
externalIPs- A list of IP addresses for which nodes in the cluster will also accept traffic for this service. This parameter is required.- Returns:
this
-
externalName
@Stability(Stable) public Service.Builder externalName(String externalName)
The externalName to be used when ServiceType.EXTERNAL_NAME is set.Default: - No external name.
- Parameters:
externalName- The externalName to be used when ServiceType.EXTERNAL_NAME is set. This parameter is required.- Returns:
this
-
loadBalancerSourceRanges
@Stability(Stable) public Service.Builder loadBalancerSourceRanges(List<String> loadBalancerSourceRanges)
A list of CIDR IP addresses, if specified and supported by the platform, will restrict traffic through the cloud-provider load-balancer to the specified client IPs.More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
- Parameters:
loadBalancerSourceRanges- A list of CIDR IP addresses, if specified and supported by the platform, will restrict traffic through the cloud-provider load-balancer to the specified client IPs. This parameter is required.- Returns:
this
-
ports
@Stability(Stable) public Service.Builder ports(List<? extends ServicePort> ports)
The port exposed by this service.More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
- Parameters:
ports- The port exposed by this service. This parameter is required.- Returns:
this
-
type
@Stability(Stable) public Service.Builder type(ServiceType type)
Determines how the Service is exposed.More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
Default: ServiceType.ClusterIP
- Parameters:
type- Determines how the Service is exposed. This parameter is required.- Returns:
this
-
-