Class ServiceProps.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • clusterIp

        @Stability(Stable)
        public ServiceProps.Builder clusterIp​(String clusterIp)
        Sets the value of ServiceProps#getClusterIp
        Parameters:
        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.
        Returns:
        this
      • externalIPs

        @Stability(Stable)
        public ServiceProps.Builder externalIPs​(List<String> externalIPs)
        Parameters:
        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.
        Returns:
        this
      • loadBalancerSourceRanges

        @Stability(Stable)
        public ServiceProps.Builder loadBalancerSourceRanges​(List<String> loadBalancerSourceRanges)
        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. More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/
        Returns:
        this
      • ports

        @Stability(Stable)
        public ServiceProps.Builder ports​(List<? extends ServicePort> ports)
        Sets the value of ServiceProps.getPorts()
        Parameters:
        ports - The ports this service binds to. If the selector of the service is a managed pod / workload, its ports will are automatically extracted and used as the default value. Otherwise, no ports are bound.
        Returns:
        this
      • selector

        @Stability(Stable)
        public ServiceProps.Builder selector​(IPodSelector selector)
        Sets the value of ServiceProps.getSelector()
        Parameters:
        selector - Which pods should the service select and route to. You can pass one of the following:

        • An instance of Pod or any workload resource (e.g Deployment, StatefulSet, ...)
        • Pods selected by the Pods.select function. Note that in this case only labels can be specified.
        Returns:
        this
      • type

        @Stability(Stable)
        public ServiceProps.Builder type​(ServiceType type)
        Sets the value of ServiceProps.getType()
        Parameters:
        type - Determines how the Service is exposed. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
        Returns:
        this
      • metadata

        @Stability(Stable)
        public ServiceProps.Builder metadata​(org.cdk8s.ApiObjectMetadata metadata)
        Sets the value of ResourceProps.getMetadata()
        Parameters:
        metadata - Metadata that all persisted resources must have, which includes all objects users must create.
        Returns:
        this
      • build

        @Stability(Stable)
        public ServiceProps build()
        Builds the configured instance.
        Specified by:
        build in interface software.amazon.jsii.Builder<ServiceProps>
        Returns:
        a new instance of ServiceProps
        Throws:
        NullPointerException - if any required attribute was not provided