aboutsummaryrefslogtreecommitdiffstats
path: root/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/lb/LoadBalancerService.java
blob: 6d41f664fad277c58e0b8ddb963df317b412add8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.lb;

import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.EndpointsChecker.HealthChecker;
import com.yahoo.config.provision.NodeType;

/**
 * A managed load balance service.
 *
 * @author mpolden
 */
public interface LoadBalancerService extends HealthChecker {

    /**
     * Provisions load balancers from the given specification. Implementations are expected to be idempotent
     *
     * @param spec        Load balancer specification
     * @return The provisioned load balancer instance
     */
    LoadBalancerInstance provision(LoadBalancerSpec spec);

    /**
     * Configures load balancers for the given specification. Implementations are expected to be idempotent
     *
     * @param instance    Load balancer instance to reconfigure
     * @param spec        Load balancer specification
     * @param force       Whether reconfiguration should be forced (e.g. allow configuring an empty set of reals on a
     *                    pre-existing load balancer, or removing an unused private endpoint service load balancer).
     * @return The (re)configured load balancer instance
     */
    LoadBalancerInstance configure(LoadBalancerInstance instance, LoadBalancerSpec spec, boolean force);

    /** Permanently remove given load balancer */
    void remove(LoadBalancer loadBalancer);

    /** Returns the protocol supported by this load balancer service */
    Protocol protocol(boolean enclave);

    /** Returns whether load balancers created by this service can forward traffic to given node and cluster type */
    boolean supports(NodeType nodeType, ClusterSpec.Type clusterType);

    /** Load balancer protocols */
    enum Protocol {
        ipv4,
        ipv6,
        dualstack
    }

}