Search in sources :

Example 1 with K8sPodService

use of org.onosproject.k8snetworking.api.K8sPodService in project onos by opennetworkinglab.

the class K8sServiceHandler method getSportEpAddressMap.

/**
 * Obtains the service port to endpoint address paired map.
 *
 * @param service   kubernetes service
 * @return a map where key is kubernetes service port, and value is the
 * endpoint addresses that are associated with the service port
 */
private Map<ServicePort, Set<String>> getSportEpAddressMap(Service service) {
    Map<ServicePort, Set<String>> map = Maps.newConcurrentMap();
    String serviceName = service.getMetadata().getName();
    List<Endpoints> endpointses = k8sEndpointsService.endpointses().stream().filter(ep -> serviceName.equals(ep.getMetadata().getName())).collect(Collectors.toList());
    service.getSpec().getPorts().stream().filter(Objects::nonNull).filter(sp -> sp.getTargetPort() != null).filter(sp -> sp.getTargetPort().getIntVal() != null || sp.getTargetPort().getStrVal() != null).forEach(sp -> {
        Integer targetPortInt = sp.getTargetPort().getIntVal() != null ? sp.getTargetPort().getIntVal() : 0;
        String targetPortName = sp.getTargetPort().getStrVal() != null ? sp.getTargetPort().getStrVal() : "";
        String targetProtocol = sp.getProtocol();
        for (Endpoints endpoints : endpointses) {
            for (EndpointSubset endpointSubset : endpoints.getSubsets()) {
                // as the target port number
                if (!targetPortName.equals("") && targetPortInt == 0) {
                    for (EndpointAddress addr : endpointSubset.getAddresses()) {
                        Pod pod = podByIp(k8sPodService, addr.getIp());
                        targetPortInt = portNumberByName(pod, targetPortName);
                    }
                }
                if (targetPortInt == 0) {
                    continue;
                }
                for (EndpointPort endpointPort : endpointSubset.getPorts()) {
                    if (targetProtocol.equals(endpointPort.getProtocol()) && (targetPortInt.equals(endpointPort.getPort()) || targetPortName.equals(endpointPort.getName()))) {
                        Set<String> addresses = endpointSubset.getAddresses().stream().map(EndpointAddress::getIp).collect(Collectors.toSet());
                        map.put(sp, addresses);
                    }
                }
            }
        }
    });
    return map;
}
Also used : DeviceService(org.onosproject.net.device.DeviceService) NODE_IP_PREFIX(org.onosproject.k8snetworking.api.Constants.NODE_IP_PREFIX) RulePopulatorUtil.niciraConnTrackTreatmentBuilder(org.onosproject.k8snetworking.util.RulePopulatorUtil.niciraConnTrackTreatmentBuilder) PRIORITY_CIDR_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_CIDR_RULE) NiciraConnTrackTreatmentBuilder(org.onosproject.k8snetworking.util.RulePopulatorUtil.NiciraConnTrackTreatmentBuilder) K8sEndpointsEvent(org.onosproject.k8snetworking.api.K8sEndpointsEvent) DriverService(org.onosproject.net.driver.DriverService) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) StorageService(org.onosproject.store.service.StorageService) ROUTING_TABLE(org.onosproject.k8snetworking.api.Constants.ROUTING_TABLE) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) RulePopulatorUtil.buildResubmitExtension(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildResubmitExtension) NAT_STATEFUL(org.onosproject.k8snetworking.api.Constants.NAT_STATEFUL) SELECT(org.onosproject.net.group.GroupDescription.Type.SELECT) K8sEndpointsListener(org.onosproject.k8snetworking.api.K8sEndpointsListener) PRIORITY_CT_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_CT_RULE) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) EndpointAddress(io.fabric8.kubernetes.api.model.EndpointAddress) PRIORITY_INTER_ROUTING_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_INTER_ROUTING_RULE) SERVICE_IP_NAT_MODE(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_IP_NAT_MODE) TUN_ENTRY_TABLE(org.onosproject.k8snetworking.api.Constants.TUN_ENTRY_TABLE) DeviceId(org.onosproject.net.DeviceId) Dictionary(java.util.Dictionary) Tools(org.onlab.util.Tools) K8sServiceService(org.onosproject.k8snetworking.api.K8sServiceService) ACL_TABLE(org.onosproject.k8snetworking.api.Constants.ACL_TABLE) ComponentContext(org.osgi.service.component.ComponentContext) K8sNetworkingUtil.portNumberByName(org.onosproject.k8snetworking.util.K8sNetworkingUtil.portNumberByName) GROUPING_TABLE(org.onosproject.k8snetworking.api.Constants.GROUPING_TABLE) Component(org.osgi.service.component.annotations.Component) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) K8sNetworkEvent(org.onosproject.k8snetworking.api.K8sNetworkEvent) K8sNodeEvent(org.onosproject.k8snode.api.K8sNodeEvent) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) K8S_NETWORKING_APP_ID(org.onosproject.k8snetworking.api.Constants.K8S_NETWORKING_APP_ID) TpPort(org.onlab.packet.TpPort) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Endpoints(io.fabric8.kubernetes.api.model.Endpoints) EndpointSubset(io.fabric8.kubernetes.api.model.EndpointSubset) Pod(io.fabric8.kubernetes.api.model.Pod) RulePopulatorUtil.computeCtMaskFlag(org.onosproject.k8snetworking.util.RulePopulatorUtil.computeCtMaskFlag) SERVICE_IP_NAT_MODE_DEFAULT(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_IP_NAT_MODE_DEFAULT) IPv4(org.onlab.packet.IPv4) GroupId(org.onosproject.core.GroupId) ExtensionSelector(org.onosproject.net.flow.criteria.ExtensionSelector) B_CLASS(org.onosproject.k8snetworking.api.Constants.B_CLASS) MacAddress(org.onlab.packet.MacAddress) RulePopulatorUtil.buildLoadExtension(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildLoadExtension) K8sNodeService(org.onosproject.k8snode.api.K8sNodeService) LeadershipService(org.onosproject.cluster.LeadershipService) POD_TABLE(org.onosproject.k8snetworking.api.Constants.POD_TABLE) CT_NAT_DST_FLAG(org.onosproject.k8snetworking.util.RulePopulatorUtil.CT_NAT_DST_FLAG) SERVICE_FAKE_MAC_STR(org.onosproject.k8snetworking.api.Constants.SERVICE_FAKE_MAC_STR) CoreService(org.onosproject.core.CoreService) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) ServicePort(io.fabric8.kubernetes.api.model.ServicePort) K8sNodeListener(org.onosproject.k8snode.api.K8sNodeListener) NAMESPACE_TABLE(org.onosproject.k8snetworking.api.Constants.NAMESPACE_TABLE) K8sNetworkListener(org.onosproject.k8snetworking.api.K8sNetworkListener) NAT_STATELESS(org.onosproject.k8snetworking.api.Constants.NAT_STATELESS) Ethernet(org.onlab.packet.Ethernet) STAT_EGRESS_TABLE(org.onosproject.k8snetworking.api.Constants.STAT_EGRESS_TABLE) A_CLASS(org.onosproject.k8snetworking.api.Constants.A_CLASS) SERVICE_IP_CIDR_DEFAULT(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_IP_CIDR_DEFAULT) K8sNetworkingUtil.podByIp(org.onosproject.k8snetworking.util.K8sNetworkingUtil.podByIp) K8sPodService(org.onosproject.k8snetworking.api.K8sPodService) K8sServiceEvent(org.onosproject.k8snetworking.api.K8sServiceEvent) NodeId(org.onosproject.cluster.NodeId) SERVICE_CIDR(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_CIDR) DST(org.onosproject.k8snetworking.api.Constants.DST) RulePopulatorUtil.computeCtStateFlag(org.onosproject.k8snetworking.util.RulePopulatorUtil.computeCtStateFlag) K8sFlowRuleService(org.onosproject.k8snetworking.api.K8sFlowRuleService) Executors.newSingleThreadExecutor(java.util.concurrent.Executors.newSingleThreadExecutor) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) ClusterService(org.onosproject.cluster.ClusterService) PRIORITY_NAT_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_NAT_RULE) IpPrefix(org.onlab.packet.IpPrefix) SRC(org.onosproject.k8snetworking.api.Constants.SRC) GroupBucket(org.onosproject.net.group.GroupBucket) K8sNetworkService(org.onosproject.k8snetworking.api.K8sNetworkService) K8sNetworkingUtil.getBclassIpPrefixFromCidr(org.onosproject.k8snetworking.util.K8sNetworkingUtil.getBclassIpPrefixFromCidr) K8sServiceListener(org.onosproject.k8snetworking.api.K8sServiceListener) Activate(org.osgi.service.component.annotations.Activate) Service(io.fabric8.kubernetes.api.model.Service) K8sNode(org.onosproject.k8snode.api.K8sNode) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) Logger(org.slf4j.Logger) RulePopulatorUtil(org.onosproject.k8snetworking.util.RulePopulatorUtil) SHIFTED_IP_PREFIX(org.onosproject.k8snetworking.api.Constants.SHIFTED_IP_PREFIX) EndpointPort(io.fabric8.kubernetes.api.model.EndpointPort) NAT_TABLE(org.onosproject.k8snetworking.api.Constants.NAT_TABLE) ExtensionTreatment(org.onosproject.net.flow.instructions.ExtensionTreatment) K8sGroupRuleService(org.onosproject.k8snetworking.api.K8sGroupRuleService) Maps(com.google.common.collect.Maps) SERVICE_TABLE(org.onosproject.k8snetworking.api.Constants.SERVICE_TABLE) K8sNetworkingUtil.nodeIpGatewayIpMap(org.onosproject.k8snetworking.util.K8sNetworkingUtil.nodeIpGatewayIpMap) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) RulePopulatorUtil.buildGroupBucket(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildGroupBucket) K8sEndpointsService(org.onosproject.k8snetworking.api.K8sEndpointsService) SHIFTED_IP_CIDR(org.onosproject.k8snetworking.api.Constants.SHIFTED_IP_CIDR) K8sNetwork(org.onosproject.k8snetworking.api.K8sNetwork) Modified(org.osgi.service.component.annotations.Modified) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Reference(org.osgi.service.component.annotations.Reference) ServicePort(io.fabric8.kubernetes.api.model.ServicePort) Set(java.util.Set) EndpointPort(io.fabric8.kubernetes.api.model.EndpointPort) Pod(io.fabric8.kubernetes.api.model.Pod) Endpoints(io.fabric8.kubernetes.api.model.Endpoints) EndpointSubset(io.fabric8.kubernetes.api.model.EndpointSubset) EndpointAddress(io.fabric8.kubernetes.api.model.EndpointAddress)

Example 2 with K8sPodService

use of org.onosproject.k8snetworking.api.K8sPodService in project onos by opennetworkinglab.

the class K8sPodListCommand method doExecute.

@Override
protected void doExecute() {
    K8sPodService service = get(K8sPodService.class);
    List<Pod> pods = Lists.newArrayList(service.pods());
    pods.sort(Comparator.comparing(p -> p.getMetadata().getName()));
    String format = genFormatString(ImmutableList.of(CLI_NAME_LENGTH, CLI_NAMESPACE_LENGTH, CLI_IP_ADDRESS_LENGTH, CLI_CONTAINERS_LENGTH));
    if (outputJson()) {
        print("%s", json(pods));
    } else {
        print(format, "Name", "Namespace", "IP Address", "Containers");
        for (Pod pod : pods) {
            List<String> containers = Lists.newArrayList();
            pod.getSpec().getContainers().forEach(c -> containers.add(c.getName()));
            print(format, StringUtils.substring(pod.getMetadata().getName(), 0, CLI_NAME_LENGTH - CLI_MARGIN_LENGTH), StringUtils.substring(pod.getMetadata().getNamespace(), 0, CLI_NAMESPACE_LENGTH - CLI_MARGIN_LENGTH), StringUtils.substring(pod.getStatus().getPodIP(), 0, CLI_IP_ADDRESS_LENGTH - CLI_MARGIN_LENGTH), containers.isEmpty() ? "" : containers);
        }
    }
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Pod(io.fabric8.kubernetes.api.model.Pod) CLI_CONTAINERS_LENGTH(org.onosproject.k8snetworking.api.Constants.CLI_CONTAINERS_LENGTH) IOException(java.io.IOException) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Command(org.apache.karaf.shell.api.action.Command) CLI_NAME_LENGTH(org.onosproject.k8snetworking.api.Constants.CLI_NAME_LENGTH) K8sNetworkingUtil.genFormatString(org.onosproject.k8snetworking.util.K8sNetworkingUtil.genFormatString) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) AbstractShellCommand(org.onosproject.cli.AbstractShellCommand) CLI_NAMESPACE_LENGTH(org.onosproject.k8snetworking.api.Constants.CLI_NAMESPACE_LENGTH) List(java.util.List) CLI_IP_ADDRESS_LENGTH(org.onosproject.k8snetworking.api.Constants.CLI_IP_ADDRESS_LENGTH) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) Serialization(io.fabric8.kubernetes.client.utils.Serialization) K8sNetworkingUtil.prettyJson(org.onosproject.k8snetworking.util.K8sNetworkingUtil.prettyJson) Service(org.apache.karaf.shell.api.action.lifecycle.Service) K8sPodService(org.onosproject.k8snetworking.api.K8sPodService) CLI_MARGIN_LENGTH(org.onosproject.k8snetworking.api.Constants.CLI_MARGIN_LENGTH) Comparator(java.util.Comparator) Pod(io.fabric8.kubernetes.api.model.Pod) K8sPodService(org.onosproject.k8snetworking.api.K8sPodService) K8sNetworkingUtil.genFormatString(org.onosproject.k8snetworking.util.K8sNetworkingUtil.genFormatString)

Example 3 with K8sPodService

use of org.onosproject.k8snetworking.api.K8sPodService in project onos by opennetworkinglab.

the class K8sServiceHandler method setGroupBuckets.

private void setGroupBuckets(Service service, boolean install) {
    Map<ServicePort, Set<String>> spEpasMap = getSportEpAddressMap(service);
    Map<ServicePort, List<GroupBucket>> spGrpBkts = Maps.newConcurrentMap();
    Map<String, String> nodeIpGatewayIpMap = nodeIpGatewayIpMap(k8sNodeService, k8sNetworkService);
    for (K8sNode node : k8sNodeService.completeNodes()) {
        spEpasMap.forEach((sp, epas) -> {
            List<GroupBucket> bkts = Lists.newArrayList();
            for (String ip : epas) {
                GroupBucket bkt = buildBuckets(node.intgBridge(), nodeIpGatewayIpMap.getOrDefault(ip, ip), sp);
                if (bkt == null) {
                    continue;
                }
                if (install) {
                    bkts.add(bkt);
                } else {
                    bkts.remove(bkt);
                }
            }
            spGrpBkts.put(sp, bkts);
        });
        String serviceIp = service.getSpec().getClusterIP();
        spGrpBkts.forEach((sp, bkts) -> {
            String svcStr = servicePortStr(serviceIp, sp.getPort(), sp.getProtocol());
            int groupId = svcStr.hashCode();
            if (bkts.size() > 0) {
                k8sGroupRuleService.setBuckets(appId, node.intgBridge(), groupId, bkts);
            }
        });
        spEpasMap.forEach((sp, epas) -> epas.forEach(epa -> {
            String podIp = nodeIpGatewayIpMap.getOrDefault(epa, epa);
            int targetPort;
            if (sp.getTargetPort().getIntVal() == null) {
                Pod pod = podByIp(k8sPodService, podIp);
                targetPort = portNumberByName(pod, sp.getTargetPort().getStrVal());
            } else {
                targetPort = sp.getTargetPort().getIntVal();
            }
            if (targetPort != 0) {
                setUnshiftDomainRules(node.intgBridge(), POD_TABLE, PRIORITY_NAT_RULE, serviceIp, sp.getPort(), sp.getProtocol(), podIp, targetPort, install);
            }
        }));
    }
}
Also used : DeviceService(org.onosproject.net.device.DeviceService) NODE_IP_PREFIX(org.onosproject.k8snetworking.api.Constants.NODE_IP_PREFIX) RulePopulatorUtil.niciraConnTrackTreatmentBuilder(org.onosproject.k8snetworking.util.RulePopulatorUtil.niciraConnTrackTreatmentBuilder) PRIORITY_CIDR_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_CIDR_RULE) NiciraConnTrackTreatmentBuilder(org.onosproject.k8snetworking.util.RulePopulatorUtil.NiciraConnTrackTreatmentBuilder) K8sEndpointsEvent(org.onosproject.k8snetworking.api.K8sEndpointsEvent) DriverService(org.onosproject.net.driver.DriverService) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) StorageService(org.onosproject.store.service.StorageService) ROUTING_TABLE(org.onosproject.k8snetworking.api.Constants.ROUTING_TABLE) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) RulePopulatorUtil.buildResubmitExtension(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildResubmitExtension) NAT_STATEFUL(org.onosproject.k8snetworking.api.Constants.NAT_STATEFUL) SELECT(org.onosproject.net.group.GroupDescription.Type.SELECT) K8sEndpointsListener(org.onosproject.k8snetworking.api.K8sEndpointsListener) PRIORITY_CT_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_CT_RULE) Deactivate(org.osgi.service.component.annotations.Deactivate) Set(java.util.Set) EndpointAddress(io.fabric8.kubernetes.api.model.EndpointAddress) PRIORITY_INTER_ROUTING_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_INTER_ROUTING_RULE) SERVICE_IP_NAT_MODE(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_IP_NAT_MODE) TUN_ENTRY_TABLE(org.onosproject.k8snetworking.api.Constants.TUN_ENTRY_TABLE) DeviceId(org.onosproject.net.DeviceId) Dictionary(java.util.Dictionary) Tools(org.onlab.util.Tools) K8sServiceService(org.onosproject.k8snetworking.api.K8sServiceService) ACL_TABLE(org.onosproject.k8snetworking.api.Constants.ACL_TABLE) ComponentContext(org.osgi.service.component.ComponentContext) K8sNetworkingUtil.portNumberByName(org.onosproject.k8snetworking.util.K8sNetworkingUtil.portNumberByName) GROUPING_TABLE(org.onosproject.k8snetworking.api.Constants.GROUPING_TABLE) Component(org.osgi.service.component.annotations.Component) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) K8sNetworkEvent(org.onosproject.k8snetworking.api.K8sNetworkEvent) K8sNodeEvent(org.onosproject.k8snode.api.K8sNodeEvent) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) K8S_NETWORKING_APP_ID(org.onosproject.k8snetworking.api.Constants.K8S_NETWORKING_APP_ID) TpPort(org.onlab.packet.TpPort) ComponentConfigService(org.onosproject.cfg.ComponentConfigService) Endpoints(io.fabric8.kubernetes.api.model.Endpoints) EndpointSubset(io.fabric8.kubernetes.api.model.EndpointSubset) Pod(io.fabric8.kubernetes.api.model.Pod) RulePopulatorUtil.computeCtMaskFlag(org.onosproject.k8snetworking.util.RulePopulatorUtil.computeCtMaskFlag) SERVICE_IP_NAT_MODE_DEFAULT(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_IP_NAT_MODE_DEFAULT) IPv4(org.onlab.packet.IPv4) GroupId(org.onosproject.core.GroupId) ExtensionSelector(org.onosproject.net.flow.criteria.ExtensionSelector) B_CLASS(org.onosproject.k8snetworking.api.Constants.B_CLASS) MacAddress(org.onlab.packet.MacAddress) RulePopulatorUtil.buildLoadExtension(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildLoadExtension) K8sNodeService(org.onosproject.k8snode.api.K8sNodeService) LeadershipService(org.onosproject.cluster.LeadershipService) POD_TABLE(org.onosproject.k8snetworking.api.Constants.POD_TABLE) CT_NAT_DST_FLAG(org.onosproject.k8snetworking.util.RulePopulatorUtil.CT_NAT_DST_FLAG) SERVICE_FAKE_MAC_STR(org.onosproject.k8snetworking.api.Constants.SERVICE_FAKE_MAC_STR) CoreService(org.onosproject.core.CoreService) Tools.groupedThreads(org.onlab.util.Tools.groupedThreads) ServicePort(io.fabric8.kubernetes.api.model.ServicePort) K8sNodeListener(org.onosproject.k8snode.api.K8sNodeListener) NAMESPACE_TABLE(org.onosproject.k8snetworking.api.Constants.NAMESPACE_TABLE) K8sNetworkListener(org.onosproject.k8snetworking.api.K8sNetworkListener) NAT_STATELESS(org.onosproject.k8snetworking.api.Constants.NAT_STATELESS) Ethernet(org.onlab.packet.Ethernet) STAT_EGRESS_TABLE(org.onosproject.k8snetworking.api.Constants.STAT_EGRESS_TABLE) A_CLASS(org.onosproject.k8snetworking.api.Constants.A_CLASS) SERVICE_IP_CIDR_DEFAULT(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_IP_CIDR_DEFAULT) K8sNetworkingUtil.podByIp(org.onosproject.k8snetworking.util.K8sNetworkingUtil.podByIp) K8sPodService(org.onosproject.k8snetworking.api.K8sPodService) K8sServiceEvent(org.onosproject.k8snetworking.api.K8sServiceEvent) NodeId(org.onosproject.cluster.NodeId) SERVICE_CIDR(org.onosproject.k8snetworking.impl.OsgiPropertyConstants.SERVICE_CIDR) DST(org.onosproject.k8snetworking.api.Constants.DST) RulePopulatorUtil.computeCtStateFlag(org.onosproject.k8snetworking.util.RulePopulatorUtil.computeCtStateFlag) K8sFlowRuleService(org.onosproject.k8snetworking.api.K8sFlowRuleService) Executors.newSingleThreadExecutor(java.util.concurrent.Executors.newSingleThreadExecutor) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) List(java.util.List) ClusterService(org.onosproject.cluster.ClusterService) PRIORITY_NAT_RULE(org.onosproject.k8snetworking.api.Constants.PRIORITY_NAT_RULE) IpPrefix(org.onlab.packet.IpPrefix) SRC(org.onosproject.k8snetworking.api.Constants.SRC) GroupBucket(org.onosproject.net.group.GroupBucket) K8sNetworkService(org.onosproject.k8snetworking.api.K8sNetworkService) K8sNetworkingUtil.getBclassIpPrefixFromCidr(org.onosproject.k8snetworking.util.K8sNetworkingUtil.getBclassIpPrefixFromCidr) K8sServiceListener(org.onosproject.k8snetworking.api.K8sServiceListener) Activate(org.osgi.service.component.annotations.Activate) Service(io.fabric8.kubernetes.api.model.Service) K8sNode(org.onosproject.k8snode.api.K8sNode) ExecutorService(java.util.concurrent.ExecutorService) IpAddress(org.onlab.packet.IpAddress) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) Logger(org.slf4j.Logger) RulePopulatorUtil(org.onosproject.k8snetworking.util.RulePopulatorUtil) SHIFTED_IP_PREFIX(org.onosproject.k8snetworking.api.Constants.SHIFTED_IP_PREFIX) EndpointPort(io.fabric8.kubernetes.api.model.EndpointPort) NAT_TABLE(org.onosproject.k8snetworking.api.Constants.NAT_TABLE) ExtensionTreatment(org.onosproject.net.flow.instructions.ExtensionTreatment) K8sGroupRuleService(org.onosproject.k8snetworking.api.K8sGroupRuleService) Maps(com.google.common.collect.Maps) SERVICE_TABLE(org.onosproject.k8snetworking.api.Constants.SERVICE_TABLE) K8sNetworkingUtil.nodeIpGatewayIpMap(org.onosproject.k8snetworking.util.K8sNetworkingUtil.nodeIpGatewayIpMap) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) RulePopulatorUtil.buildGroupBucket(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildGroupBucket) K8sEndpointsService(org.onosproject.k8snetworking.api.K8sEndpointsService) SHIFTED_IP_CIDR(org.onosproject.k8snetworking.api.Constants.SHIFTED_IP_CIDR) K8sNetwork(org.onosproject.k8snetworking.api.K8sNetwork) Modified(org.osgi.service.component.annotations.Modified) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Reference(org.osgi.service.component.annotations.Reference) ServicePort(io.fabric8.kubernetes.api.model.ServicePort) Set(java.util.Set) Pod(io.fabric8.kubernetes.api.model.Pod) K8sNode(org.onosproject.k8snode.api.K8sNode) GroupBucket(org.onosproject.net.group.GroupBucket) RulePopulatorUtil.buildGroupBucket(org.onosproject.k8snetworking.util.RulePopulatorUtil.buildGroupBucket) List(java.util.List)

Aggregations

Lists (com.google.common.collect.Lists)3 Pod (io.fabric8.kubernetes.api.model.Pod)3 List (java.util.List)3 Maps (com.google.common.collect.Maps)2 EndpointAddress (io.fabric8.kubernetes.api.model.EndpointAddress)2 EndpointPort (io.fabric8.kubernetes.api.model.EndpointPort)2 EndpointSubset (io.fabric8.kubernetes.api.model.EndpointSubset)2 Endpoints (io.fabric8.kubernetes.api.model.Endpoints)2 Service (io.fabric8.kubernetes.api.model.Service)2 ServicePort (io.fabric8.kubernetes.api.model.ServicePort)2 Dictionary (java.util.Dictionary)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Set (java.util.Set)2 ExecutorService (java.util.concurrent.ExecutorService)2 Executors.newSingleThreadExecutor (java.util.concurrent.Executors.newSingleThreadExecutor)2 Collectors (java.util.stream.Collectors)2 Ethernet (org.onlab.packet.Ethernet)2 IPv4 (org.onlab.packet.IPv4)2 IpAddress (org.onlab.packet.IpAddress)2