public KubernetesDiscoveryHostedService(
            IServiceProvider serviceProvider,
            KubernetesDiscoverySettings discoveryOptions,
            IHttpClientFactory httpClientFactory,
            ILogger <KubernetesDiscoveryHostedService> logger)
        {
            _serviceProvider  = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
            _discoveryOptions = discoveryOptions ?? throw new ArgumentNullException(nameof(discoveryOptions));
            _logger           = logger ?? throw new ArgumentNullException(nameof(logger));

            _discoveryClient      = httpClientFactory.CreateClient(Keys.K8S_DISCOVERY_HTTP_CLIENT_NAME);
            _clusterServiceClient = httpClientFactory.CreateClient(Keys.K8S_CLUSTER_SERVICE_HTTP_CLIENT_NAME);
        }
 public KubernetesDiscoveryHostedService(
     IServiceProvider serviceProvider,
     IOptions <KubernetesDiscoverySettings> discoveryOptions,
     IHttpClientFactory httpClientFactory,
     ILogger <KubernetesDiscoveryHostedService> logger,
     IHostApplicationLifetime hostLifetime)
 {
     _serviceProvider      = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
     _discoveryOptions     = discoveryOptions?.Value ?? throw new ArgumentNullException(nameof(discoveryOptions));
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _hostLifetime         = hostLifetime ?? throw new ArgumentNullException(nameof(hostLifetime));
     _clusterServiceClient = httpClientFactory?.CreateClient(Keys.K8S_CLUSTER_SERVICE_HTTP_CLIENT_NAME) ?? throw new ArgumentNullException(nameof(httpClientFactory));
     _addressFactory       = new KubernetesAddressFactory(_discoveryOptions);
 }
Exemple #3
0
 public KubernetesAddressFactory(KubernetesDiscoverySettings discoveryOptions)
 {
     _settings = discoveryOptions;
 }