Example #1
0
        private async Task OnWatcherStateChanged <TS, TSL>(ManagedWatcher <TS, TSL, WatcherEvent <TS> > sender,
                                                           ManagedWatcherStateUpdate update) where TS : class, IKubernetesObject
        {
            var tag = sender.Tag ?? string.Empty;

            switch (update.State)
            {
            case ManagedWatcherState.Closed:
                _logger.LogDebug("{type} watcher {tag} {state}", typeof(TS).Name, tag, update.State);
                await _secretsWatcher.Stop();

                await _eventQueue.WaitAndClear();

                await _secretsWatcher.Start();

                break;

            case ManagedWatcherState.Faulted:
                _logger.LogError(update.Exception, "{type} watcher {tag} {state}", typeof(TS).Name, tag,
                                 update.State);
                break;

            default:
                _logger.LogDebug("{type} watcher {tag} {state}", typeof(TS).Name, tag, update.State);
                break;
            }
        }
        private async Task OnWatcherStateChanged <TResource, TResourceList>(
            ManagedWatcher <TResource, TResourceList, WatcherEvent <TResource> > sender,
            ManagedWatcherStateUpdate update) where TResource : class, IKubernetesObject
        {
            switch (update.State)
            {
            case ManagedWatcherState.Closed:
                _logger.LogDebug("{type} watcher {state}", typeof(TResource).Name, update.State);
                await _secretsWatcher.Stop();

                await _certificateWatcher.Stop();

                await _eventQueue.WaitAndClear();

                await _secretsWatcher.Start();

                await _certificateWatcher.Start();

                break;

            case ManagedWatcherState.Faulted:
                _logger.LogError(update.Exception, "{type} watcher {state}", typeof(TResource).Name,
                                 update.State);
                break;

            default:
                _logger.LogDebug("{type} watcher {state}", typeof(TResource).Name, update.State);
                break;
            }
        }
Example #3
0
        private async Task OnWatcherStateChanged <TResource, TResourceList>(
            ManagedWatcher <TResource, TResourceList, WatcherEvent <TResource> > sender,
            ManagedWatcherStateUpdate update) where TResource : class, IKubernetesObject
        {
            var tag = sender.Tag ?? string.Empty;

            switch (update.State)
            {
            case ManagedWatcherState.Closed:
                _logger.LogDebug("{type} watcher {tag} {state}", typeof(TResource).Name, tag, update.State);
                await _secretsWatcher.Stop();

                foreach (var certificatesWatcher in _certificatesWatchers.Values)
                {
                    await certificatesWatcher.Stop();
                }

                await _eventQueue.WaitAndClear();

                await _secretsWatcher.Start();

                foreach (var certificatesWatcher in _certificatesWatchers.Values)
                {
                    await certificatesWatcher.Start();
                }
                break;

            case ManagedWatcherState.Faulted:
                _logger.LogError(update.Exception, "{type} watcher {tag} {state}", typeof(TResource).Name, tag,
                                 update.State);
                break;

            default:
                _logger.LogDebug("{type} watcher {tag} {state}", typeof(TResource).Name, tag, update.State);
                break;
            }
        }