diff --git a/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralCluster.cs b/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralCluster.cs index f0e3769c96..17bfc781b1 100644 --- a/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralCluster.cs +++ b/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralCluster.cs @@ -60,13 +60,6 @@ protected EphemeralCluster(TConfiguration clusterConfiguration) : base(clusterCo protected EphemeralClusterComposer Composer { get; } - protected override void ModifyNodeConfiguration(NodeConfiguration nodeConfiguration, int port) - { - base.ModifyNodeConfiguration(nodeConfiguration, port); - - if (!ClusterConfiguration.EnableSsl) nodeConfiguration.Add("plugins.security.disabled", "true"); - } - public virtual ICollection NodesUris(string hostName = null) { hostName = hostName ?? (ClusterConfiguration.HttpFiddlerAware && Process.GetProcessesByName("fiddler").Any() diff --git a/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralClusterConfiguration.cs b/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralClusterConfiguration.cs index 77aaef02c4..a394b1e9fd 100644 --- a/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralClusterConfiguration.cs +++ b/abstractions/src/OpenSearch.OpenSearch.Ephemeral/EphemeralClusterConfiguration.cs @@ -29,74 +29,74 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text.RegularExpressions; using OpenSearch.OpenSearch.Ephemeral.Plugins; using OpenSearch.OpenSearch.Ephemeral.Tasks; using OpenSearch.OpenSearch.Managed.Configuration; using OpenSearch.Stack.ArtifactsApi; -using OpenSearch.Stack.ArtifactsApi.Products; -namespace OpenSearch.OpenSearch.Ephemeral +namespace OpenSearch.OpenSearch.Ephemeral; + +public class EphemeralClusterConfiguration : ClusterConfiguration { - public class EphemeralClusterConfiguration : ClusterConfiguration - { - public EphemeralClusterConfiguration(OpenSearchVersion version, OpenSearchPlugins plugins = null, - int numberOfNodes = 1) - : this(version, ClusterFeatures.None, plugins, numberOfNodes) - { - } - - public EphemeralClusterConfiguration(OpenSearchVersion version, ClusterFeatures features, - OpenSearchPlugins plugins = null, int numberOfNodes = 1) - : base(version, (v, s) => new EphemeralFileSystem(v, s), numberOfNodes, EphemeralClusterName) - { - Features = features; - - var pluginsList = plugins?.ToList() ?? new List(); - Plugins = new OpenSearchPlugins(pluginsList); - } - - private static string UniqueishSuffix => Guid.NewGuid().ToString("N").Substring(0, 6); - private static string EphemeralClusterName => $"ephemeral-cluster-{UniqueishSuffix}"; - - /// - /// The features supported by the cluster - /// - public ClusterFeatures Features { get; } - - /// - /// The collection of plugins to install - /// - public OpenSearchPlugins Plugins { get; } - - /// - /// Validates that the plugins to install can be installed on the target OpenSearch version. - /// This can be useful to fail early when subsequent operations are relying on installation - /// succeeding. - /// - public bool ValidatePluginsToInstall { get; } = true; - - public bool EnableSsl => Features.HasFlag(ClusterFeatures.SSL); - - public IList AdditionalBeforeNodeStartedTasks { get; } = new List(); - - public IList AdditionalAfterStartedTasks { get; } = new List(); - - /// - /// Expert level setting, skips all built-in validation tasks for cases where you need to guarantee your call is the - /// first call into the cluster - /// - public bool SkipBuiltInAfterStartTasks { get; set; } - - /// Bootstrapping HTTP calls should attempt to auto route traffic through fiddler if its running - public bool HttpFiddlerAware { get; set; } - - protected virtual string NodePrefix => "ephemeral"; - - public override string CreateNodeName(int? node) - { - var suffix = Guid.NewGuid().ToString("N").Substring(0, 6); - return $"{NodePrefix}-node-{suffix}{node}"; - } - } + public EphemeralClusterConfiguration(OpenSearchVersion version, OpenSearchPlugins plugins = null, + int numberOfNodes = 1) + : this(version, ClusterFeatures.None, plugins, numberOfNodes) + { + } + + public EphemeralClusterConfiguration(OpenSearchVersion version, ClusterFeatures features, + OpenSearchPlugins plugins = null, int numberOfNodes = 1) + : base(version, (v, s) => new EphemeralFileSystem(v, s), numberOfNodes, EphemeralClusterName) + { + Features = features; + + var pluginsList = plugins?.ToList() ?? []; + Plugins = new OpenSearchPlugins(pluginsList); + + Add("plugins.security.disabled", (!EnableSsl).ToString()); + if (EnableSsl) Add("plugins.security.audit.type", "debug"); + } + + private static string UniqueishSuffix => Guid.NewGuid().ToString("N").Substring(0, 6); + private static string EphemeralClusterName => $"ephemeral-cluster-{UniqueishSuffix}"; + + /// + /// The features supported by the cluster + /// + public ClusterFeatures Features { get; } + + /// + /// The collection of plugins to install + /// + public OpenSearchPlugins Plugins { get; } + + /// + /// Validates that the plugins to install can be installed on the target OpenSearch version. + /// This can be useful to fail early when subsequent operations are relying on installation + /// succeeding. + /// + public bool ValidatePluginsToInstall { get; } = true; + + public bool EnableSsl => Features.HasFlag(ClusterFeatures.SSL); + + public IList AdditionalBeforeNodeStartedTasks { get; } = new List(); + + public IList AdditionalAfterStartedTasks { get; } = new List(); + + /// + /// Expert level setting, skips all built-in validation tasks for cases where you need to guarantee your call is the + /// first call into the cluster + /// + public bool SkipBuiltInAfterStartTasks { get; set; } + + /// Bootstrapping HTTP calls should attempt to auto route traffic through fiddler if its running + public bool HttpFiddlerAware { get; set; } + + protected virtual string NodePrefix => "ephemeral"; + + public override string CreateNodeName(int? node) + { + var suffix = Guid.NewGuid().ToString("N").Substring(0, 6); + return $"{NodePrefix}-node-{suffix}{node}"; + } }