示例#1
0
    public ImmutableList <string> Update(WatchEventType eventType, V1Endpoints endpoints)
    {
        if (endpoints is null)
        {
            throw new ArgumentNullException(nameof(endpoints));
        }

        var serviceName = endpoints.Name();

        lock (_sync)
        {
            if (eventType == WatchEventType.Added || eventType == WatchEventType.Modified)
            {
                _endpointsData[serviceName] = new Endpoints(endpoints);
            }
            else if (eventType == WatchEventType.Deleted)
            {
                _endpointsData.Remove(serviceName);
            }

            if (_serviceToIngressNames.TryGetValue(serviceName, out var ingressNames))
            {
                return(ingressNames);
            }
            else
            {
                return(ImmutableList <string> .Empty);
            }
        }
    }
示例#2
0
        public Endpoints(V1Endpoints endpoints)
        {
            if (endpoints is null)
            {
                throw new ArgumentNullException(nameof(endpoints));
            }

            Name    = endpoints.Name();
            Subsets = endpoints.Subsets;
        }