Example #1
0
        public StatusController(
            IResourceInformer <V1Pod> podInformer,
            IResourceInformer <V1ConfigMap> configMapInformer,
            IHostApplicationLifetime hostApplicationLifetime,
            ILogger <StatusController> logger)
            : base(hostApplicationLifetime, logger)
        {
            if (hostApplicationLifetime is null)
            {
                throw new ArgumentNullException(nameof(hostApplicationLifetime));
            }

            if (podInformer is null)
            {
                throw new ArgumentNullException(nameof(podInformer));
            }

            if (configMapInformer is null)
            {
                throw new ArgumentNullException(nameof(configMapInformer));
            }

            if (logger is null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _informers = new[]
            {
                podInformer.Register(Notification),
                configMapInformer.Register(Notification),
            };
        }
        public IngressController(
            ICache cache,
            IReconciler reconciler,
            IResourceInformer <V1Ingress> ingressInformer,
            IResourceInformer <V1Service> serviceInformer,
            IResourceInformer <V1Endpoints> endpointsInformer,
            IHostApplicationLifetime hostApplicationLifetime,
            ILogger <IngressController> logger)
            : base(hostApplicationLifetime, logger)
        {
            if (ingressInformer is null)
            {
                throw new ArgumentNullException(nameof(ingressInformer));
            }

            if (serviceInformer is null)
            {
                throw new ArgumentNullException(nameof(serviceInformer));
            }

            if (endpointsInformer is null)
            {
                throw new ArgumentNullException(nameof(endpointsInformer));
            }

            if (hostApplicationLifetime is null)
            {
                throw new ArgumentNullException(nameof(hostApplicationLifetime));
            }

            if (logger is null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _registrations = new[]
            {
                ingressInformer.Register(Notification),
                serviceInformer.Register(Notification),
                endpointsInformer.Register(Notification),
            };

            _queue = new RateLimitingQueue <QueueItem>(new MaxOfRateLimiter <QueueItem>(
                                                           new BucketRateLimiter <QueueItem>(
                                                               limiter: new Limiter(
                                                                   limit: new Limit(perSecond: 10),
                                                                   burst: 100)),
                                                           new ItemExponentialFailureRateLimiter <QueueItem>(
                                                               baseDelay: TimeSpan.FromMilliseconds(5),
                                                               maxDelay: TimeSpan.FromSeconds(10))));

            _cache      = cache ?? throw new ArgumentNullException(nameof(cache));
            _reconciler = reconciler ?? throw new ArgumentNullException(nameof(reconciler));
            _reconciler.OnAttach(TargetAttached);
        }
    public IngressController(
        ICache cache,
        IReconciler reconciler,
        IResourceInformer <V1Ingress> ingressInformer,
        IResourceInformer <V1Service> serviceInformer,
        IResourceInformer <V1Endpoints> endpointsInformer,
        IHostApplicationLifetime hostApplicationLifetime,
        ILogger <IngressController> logger)
        : base(hostApplicationLifetime, logger)
    {
        if (ingressInformer is null)
        {
            throw new ArgumentNullException(nameof(ingressInformer));
        }

        if (serviceInformer is null)
        {
            throw new ArgumentNullException(nameof(serviceInformer));
        }

        if (endpointsInformer is null)
        {
            throw new ArgumentNullException(nameof(endpointsInformer));
        }

        if (hostApplicationLifetime is null)
        {
            throw new ArgumentNullException(nameof(hostApplicationLifetime));
        }

        if (logger is null)
        {
            throw new ArgumentNullException(nameof(logger));
        }

        _registrations = new[]
        {
            ingressInformer.Register(Notification),
            serviceInformer.Register(Notification),
            endpointsInformer.Register(Notification),
        };

        _queue = new ProcessingRateLimitedQueue <QueueItem>(perSecond: 0.5, burst: 1);

        _cache      = cache ?? throw new ArgumentNullException(nameof(cache));
        _reconciler = reconciler ?? throw new ArgumentNullException(nameof(reconciler));
        _reconciler.OnAttach(TargetAttached);

        _ingressChangeQueueItem = new QueueItem("Ingress Change", null);
    }
Example #4
0
 public ConfigureOperatorOptions(IResourceInformer <TRelatedResource> resourceInformer)
 {
     _resourceInformer = resourceInformer;
 }