public Controller(OperatorConfiguration configuration, IKubernetes client, ILoggerFactory loggerFactory = null)
 {
     this._client        = client;
     this._logger        = loggerFactory?.CreateLogger <Controller <T> >() ?? SilentLogger.Instance;
     this._eventManager  = new EventManager(loggerFactory);
     this._changeTracker = new ResourceChangeTracker(configuration, loggerFactory);
     this._crd           = (CustomResourceDefinitionAttribute)Attribute.GetCustomAttribute(typeof(T), typeof(CustomResourceDefinitionAttribute));
     this.RetryPolicy    = configuration.RetryPolicy;
 }
        public Operator(OperatorConfiguration configuration, IKubernetes client, ILoggerFactory loggerFactory = null)
        {
            this._configuration = configuration;
            this._client        = client;
            this._loggerFactory = loggerFactory;
            this._logger        = loggerFactory?.CreateLogger <Operator>() ?? SilentLogger.Instance;
            this._watchers      = new List <EventWatcher>();
            this._cts           = new CancellationTokenSource();

            TaskScheduler.UnobservedTaskException += (o, ev) =>
            {
                _logger.LogError(ev.Exception, "Unobserved exception");
                ev.SetObserved();
            };

            // TODO: log versions
        }
Exemple #3
0
 public ResourceChangeTracker(OperatorConfiguration configuration, ILoggerFactory loggerFactory)
 {
     this._logger = loggerFactory?.CreateLogger <ResourceChangeTracker>() ?? SilentLogger.Instance;
     this._lastResourceGenerationProcessed = new Dictionary <string, long>();
     this._discardDuplicates = configuration.DiscardDuplicateSpecGenerations;
 }