Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.kubevirtnetworking.api; |
| 17 | |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 18 | import org.onlab.packet.IpAddress; |
| 19 | import org.onlab.packet.MacAddress; |
| 20 | |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 21 | import java.util.Set; |
| 22 | |
| 23 | /** |
| 24 | * Representation of kubernetes external load balancer. |
| 25 | */ |
| 26 | public interface KubernetesExternalLb { |
| 27 | /** |
| 28 | * Returns the service name. |
| 29 | * |
| 30 | * @return service name |
| 31 | */ |
| 32 | String serviceName(); |
| 33 | |
| 34 | /** |
| 35 | * Returns the load balancer IP. |
| 36 | * |
| 37 | * @return load balancer IP |
| 38 | */ |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 39 | IpAddress loadBalancerIp(); |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 40 | |
| 41 | /** |
Daniel Park | 6a83ee6 | 2022-10-26 11:57:34 +0900 | [diff] [blame^] | 42 | * Returns the set of service ports. |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 43 | * |
| 44 | * @return node port |
| 45 | */ |
Daniel Park | 6a83ee6 | 2022-10-26 11:57:34 +0900 | [diff] [blame^] | 46 | Set<KubernetesServicePort> servicePorts(); |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * Returns the set of endpoint. |
| 50 | * |
| 51 | * @return endpoint set |
| 52 | */ |
| 53 | Set<String> endpointSet(); |
| 54 | |
| 55 | /** |
| 56 | * Returns the elected gateway node for this service. |
| 57 | * |
| 58 | * @return gateway node hostname |
| 59 | */ |
| 60 | String electedGateway(); |
| 61 | |
| 62 | /** |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 63 | * Returns the elected worker node for this service. |
| 64 | * |
| 65 | * @return worker node hostname |
| 66 | */ |
| 67 | String electedWorker(); |
| 68 | |
| 69 | /** |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 70 | * Updates the elected gateway node host name. |
| 71 | * |
| 72 | * @param electedGateway updated elected gateway node hostname |
| 73 | * @return kubernetes external lb with the updated gateway node hostname |
| 74 | */ |
| 75 | KubernetesExternalLb updateElectedGateway(String electedGateway); |
| 76 | |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 77 | /** |
| 78 | * Updates the elected worker node host name. |
| 79 | * |
| 80 | * @param electedWorker updated elected worker node hostname |
| 81 | * @return kubernetes external lb with the updated worker node hostname |
| 82 | */ |
| 83 | KubernetesExternalLb updateElectedWorker(String electedWorker); |
| 84 | |
| 85 | /** |
| 86 | * Returns the gateway IP of load balancer. |
| 87 | * TEG would send outbound traffic to this gateway. |
| 88 | * |
| 89 | * @return load balancer gateway IP |
| 90 | */ |
| 91 | IpAddress loadBalancerGwIp(); |
| 92 | |
| 93 | /** |
| 94 | * Returns the gateway MAC of load balancer. |
| 95 | * TEG would send outbound traffic to this gateway. |
| 96 | * |
| 97 | * @return load balancer gateway IP |
| 98 | */ |
| 99 | MacAddress loadBalancerGwMac(); |
| 100 | |
| 101 | |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 102 | interface Builder { |
| 103 | /** |
| 104 | * Builds an immutable kubernetes external load balancer instance. |
| 105 | * |
| 106 | * @return kubernetes external load balancer |
| 107 | */ |
| 108 | KubernetesExternalLb build(); |
| 109 | |
| 110 | /** |
| 111 | * Returns kubernetes external load balancer builder with supplied service name. |
| 112 | * |
| 113 | * @param serviceName external load balancer service name |
| 114 | * @return external load balancer builder |
| 115 | */ |
| 116 | Builder serviceName(String serviceName); |
| 117 | |
| 118 | /** |
| 119 | * Returns kubernetes external load balancer builder with supplied load balancer Ip. |
| 120 | * |
| 121 | * @param loadBalancerIp external load balancer Ip |
| 122 | * @return external load balancer builder |
| 123 | */ |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 124 | Builder loadBalancerIp(IpAddress loadBalancerIp); |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 125 | |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 126 | |
| 127 | /** |
Daniel Park | 6a83ee6 | 2022-10-26 11:57:34 +0900 | [diff] [blame^] | 128 | * Returns kubernetes external load balancer builder with supplied service port set. |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 129 | * |
Daniel Park | 6a83ee6 | 2022-10-26 11:57:34 +0900 | [diff] [blame^] | 130 | * @param servicePorts service port set |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 131 | * @return external load balancer builder |
| 132 | */ |
Daniel Park | 6a83ee6 | 2022-10-26 11:57:34 +0900 | [diff] [blame^] | 133 | Builder servicePorts(Set<KubernetesServicePort> servicePorts); |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 134 | |
| 135 | /** |
| 136 | * Returns kubernetes external load balancer builder with supplied endpoint set. |
| 137 | * |
| 138 | * @param endpointSet endpoint set |
| 139 | * @return external load balancer builder |
| 140 | */ |
| 141 | Builder endpointSet(Set<String> endpointSet); |
| 142 | |
| 143 | /** |
| 144 | * Returns kubernetes external load balancer builder with supplied elected gateway. |
| 145 | * |
| 146 | * @param gateway gateway node hostname |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 147 | * @return external load balancer builder |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 148 | */ |
| 149 | Builder electedGateway(String gateway); |
Daniel Park | 5ff76b7 | 2022-09-26 22:58:53 +0900 | [diff] [blame] | 150 | |
| 151 | /** |
| 152 | * Returns kubernetes external load balancer builder with supplied elected worker. |
| 153 | * |
| 154 | * @param worker worker node hostname |
| 155 | * @return external load balancer builder |
| 156 | */ |
| 157 | Builder electedWorker(String worker); |
| 158 | |
| 159 | |
| 160 | /** |
| 161 | * Returns kubernetes external load balancer builder with supplied load balancer gateway Ip. |
| 162 | * |
| 163 | * @param loadBalancerGwIp gateway IP of the external load balancer |
| 164 | * @return external load balancer builder |
| 165 | */ |
| 166 | Builder loadBalancerGwIp(IpAddress loadBalancerGwIp); |
| 167 | |
| 168 | /** |
| 169 | * Returns kubernetes external load balancer builder with supplied load balancer gateway Mac. |
| 170 | * |
| 171 | * @param loadBalancerGwMac gateway Mac of the external load balancer |
| 172 | * @return external load balancer builder |
| 173 | */ |
| 174 | Builder loadBalancerGwMac(MacAddress loadBalancerGwMac); |
Daniel Park | 734b553 | 2022-09-26 15:13:59 +0900 | [diff] [blame] | 175 | } |
| 176 | } |