Beispiel #1
0
        /// <summary>
        /// this method is expensive should be called in 2m period
        /// </summary>
        public void DiscoverWorkers()
        {
            //will go through all namespaces to figureout how many workers we have
            foreach (var ns in namespaces)
            {
                if (ns is null)
                {
                    continue;
                }

                // so we have a pod list, lets parse it
                ParsePod(ns, kubernetesClient.ListNamespacedPod(ns), true);
            }

            // may be someone is listening so lets fire this event
            OnDiscoveryCompleted?.Invoke(this, workers);
        }
        private void UpdateConnections()
        {
            try
            {
                ConnectionsCountLabel.Text = this.DiscoveredConnections.Count.ToString();
                PendingRequestsLabel.Text  = _pendingRequests.ToString();

                if (this._pendingRequests <= 0)
                {
                    OnDiscoveryCompleted?.Invoke();
                }

                Application.DoEvents();
            }
            catch (Exception e)
            {
                Logging.Error("Update Connections", e);
            }
        }
Beispiel #3
0
 public void HandleDiscoveryComplete(DiscoveryCompleteEventArgs discoveryCompleteEventArgs, IEnumerable <TestCase> lastChunk)
 {
     TestCases.AddRange(lastChunk);
     OnDiscoveryCompleted?.Invoke(this, EventArgs.Empty);
 }
Beispiel #4
0
 public K8SServiceDiscoveryHostedService(ILogger <K8SServiceDiscoveryHostedService> logger, K8SServiceDiscovery serviceDiscovery)
 {
     _logger           = logger;
     _serviceDiscovery = serviceDiscovery;
     _serviceDiscovery.OnDiscoveryCompleted += (s, w) => OnDiscoveryCompleted?.Invoke(s, w);
 }