/// <summary> /// Initializes a new instance of the BrokerLauncherClient class. /// </summary> /// <param name="uri">The broker launcher EPR</param> public BrokerLauncherClient(Uri uri, string certThrumbprint) : base(GetBinding(uri), GetEndpoint(uri, certThrumbprint)) { string thumbpint = TelepathyContext.Get().GetSSLThumbprint().GetAwaiter().GetResult(); this.ClientCredentials.UseInternalAuthentication(thumbpint); if (!SoaHelper.IsOnAzure()) { this.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation; } }
/// <summary> /// Start scheduler delegation service /// </summary> private void StartSchedulerDelegationService() { string schedulerDelegationAddress = SoaHelper.GetSchedulerDelegationAddress("localhost"); this.delegationHost = new ServiceHost(this.schedulerDelegation, new Uri(schedulerDelegationAddress)); BindingHelper.ApplyDefaultThrottlingBehavior(this.delegationHost); #if HPCPACK if (this.schedulerDelegation is IHpcSchedulerAdapterInternal) { this.delegationHost.AddServiceEndpoint(typeof(IHpcSchedulerAdapterInternal), BindingHelper.HardCodedInternalSchedulerDelegationBinding, "Internal"); this.delegationHost.AddServiceEndpoint(typeof(IHpcSchedulerAdapter), BindingHelper.HardCodedInternalSchedulerDelegationBinding, string.Empty); this.delegationHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerOrChainTrust; this.delegationHost.Credentials.ClientCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck; this.delegationHost.Credentials.ServiceCertificate.SetCertificate( StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint, TelepathyContext.Get().GetSSLThumbprint().GetAwaiter().GetResult()); } else #endif { // Use insecure binding until unified authentication logic is implemented this.delegationHost.AddServiceEndpoint(typeof(ISchedulerAdapter), BindingHelper.HardCodedUnSecureNetTcpBinding, string.Empty); // if (SessionLauncherRuntimeConfiguration.OpenAzureStorageListener) // { // this.delegationHost.AddServiceEndpoint( // typeof(ISchedulerAdapter), // new TableTransportBinding() { ConnectionString = SessionLauncherRuntimeConfiguration.SessionLauncherStorageConnectionString, TargetPartitionKey = "all" }, // TelepathyConstants.SessionSchedulerDelegationAzureTableBindingAddress); // } } this.delegationHost.Faulted += SchedulerDelegationHostFaultHandler; this.delegationHost.Open(); TraceHelper.TraceEvent(TraceEventType.Information, "Open scheduler delegation service at {0}", schedulerDelegationAddress); }
/// <summary> /// Initializes a new instance of the BrokerNodesManager class with the specified head node. /// </summary> /// <param name="headNode">the head node name.</param> public BrokerNodesManager() { this.schedulerField = CommonSchedulerHelper.GetScheduler(TelepathyContext.Get().CancellationToken).GetAwaiter().GetResult(); // Initialize performance counters this.totalFailoverBrokerNodeCount = SessionPerformanceCounterHelper.GetPerfCounter(SessionPerformanceCounterKey.TotalFailoverBrokerNodeCount); this.totalFailoverClusterCount = SessionPerformanceCounterHelper.GetPerfCounter(SessionPerformanceCounterKey.TotalFailoverClusterCount); this.activeBrokerNodeCount = SessionPerformanceCounterHelper.GetPerfCounter(SessionPerformanceCounterKey.ActiveBrokerNodeCount); this.activeBrokerResourceGroupCount = SessionPerformanceCounterHelper.GetPerfCounter(SessionPerformanceCounterKey.ActiveBrokerResourceGroupCount); if (SoaHelper.IsOnAzure()) { this.brokerNodeTimer = new Timer(this.UpdateAvailableAzureBroker, null, 0, CheckNodesPerClusterInterval); } else { // poll the broker nodes immediately once connect to the scheduler. this.BrokerNodesTimerCallback(null); // Start the timer that will poll broker nodes // TODO: Consider a timer per cluster this.brokerNodeTimer = new Timer(this.BrokerNodesTimerCallback, null, CheckNodesPerClusterInterval, CheckNodesPerClusterInterval); } }
/// <summary> /// Start session launcher service /// </summary> private void StartSessionLauncherService() { try { string sessionLauncherAddress = SoaHelper.GetSessionLauncherAddress("localhost"); this.launcherHost = new ServiceHost(this.sessionLauncher, new Uri(sessionLauncherAddress)); BindingHelper.ApplyDefaultThrottlingBehavior(this.launcherHost); #if AZURE_STORAGE_BINDING if (SessionLauncherRuntimeConfiguration.OpenAzureStorageListener) { this.launcherHost.AddServiceEndpoint( typeof(ISessionLauncher), new TableTransportBinding() { ConnectionString = SessionLauncherRuntimeConfiguration.SessionLauncherStorageConnectionString, TargetPartitionKey = "all" }, TelepathyConstants.SessionLauncherAzureTableBindingAddress); TraceHelper.TraceEvent(TraceEventType.Information, "Add session launcher service endpoint {0}", TelepathyConstants.SessionLauncherAzureTableBindingAddress); } #endif if (SessionLauncherRuntimeConfiguration.SchedulerType == SchedulerType.HpcPack) { this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedSessionLauncherNetTcpBinding, string.Empty); this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedNoAuthSessionLauncherNetTcpBinding, "AAD"); this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedInternalSessionLauncherNetTcpBinding, "Internal"); TraceHelper.TraceEvent(TraceEventType.Information, "Open session launcher find cert {0}", TelepathyContext.Get().GetSSLThumbprint().GetAwaiter().GetResult()); this.launcherHost.Credentials.UseInternalAuthenticationAsync().GetAwaiter().GetResult(); TraceHelper.TraceEvent(TraceEventType.Information, "Add session launcher service endpoint {0}", sessionLauncherAddress); } else { this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedUnSecureNetTcpBinding, string.Empty); this.launcherHost.AddServiceEndpoint(typeof(ISessionLauncher), BindingHelper.HardCodedUnSecureNetTcpBinding, "Internal"); TraceHelper.TraceEvent(TraceEventType.Information, "Add session launcher service endpoint {0}", sessionLauncherAddress); } this.launcherHost.Faulted += this.SessionLauncherHostFaultHandler; ServiceAuthorizationBehavior myServiceBehavior = this.launcherHost.Description.Behaviors.Find <ServiceAuthorizationBehavior>(); myServiceBehavior.PrincipalPermissionMode = PrincipalPermissionMode.None; this.launcherHost.Open(); TraceHelper.TraceEvent(TraceEventType.Information, "Open session launcher service"); } catch (Exception ex) { Trace.TraceError(ex.ToString()); throw; } }