Ejemplo n.º 1
0
        private void SetOptionalFeatureParameters(SetupSettings settings)
        {
            this.EnableCircularTraceSession = settings.EnableCircularTraceSession;
            DeploymentSpecification.SetEnableCircularTraceSession(this.EnableCircularTraceSession);

            // Initialize the properties used to reflect state of preview features that need to lightup at runtime
            this.EnableUnsupportedPreviewFeatures = settings.EnableUnsupportedPreviewFeatures;
            this.IsSFVolumeDiskServiceEnabled     = settings.IsSFVolumeDiskServiceEnabled;
        }
Ejemplo n.º 2
0
        private void ResolveLogRoot(bool isDataRootProvided)
        {
            if (this.FabricLogRoot == null)
            {
                if (isDataRootProvided)
                {
                    this.FabricLogRoot = DeploymentSpecification.GetLogRoot();
                }
                else
                {
                    this.FabricLogRoot = FabricEnvironment.GetLogRoot();
                }
            }

            Helpers.CreateDirectoryIfNotExist(this.FabricLogRoot, this.MachineName);
        }
Ejemplo n.º 3
0
 private static void Deploy(DeploymentSpecification specification, Arguments arguments) =>
 specification.Execute().Do(deployment => PostDeploy(deployment, arguments));
Ejemplo n.º 4
0
        public void Initialize()
        {
            DeploymentOperations operation = Operation;

            if (operation == DeploymentOperations.Create || operation == DeploymentOperations.Update || operation == DeploymentOperations.Configure)
            {
                if (this.ClusterManifestLocation == null || !File.Exists(this.ClusterManifestLocation))
                {
                    throw new InvalidDeploymentParameterException(StringResources.Error_FabricDeployer_ClusterManifestNotFound_Formatted);
                }
            }

            switch (operation)
            {
            case DeploymentOperations.Configure:
            {
                ClusterManifestType manifest = XmlHelper.ReadXml <ClusterManifestType>(this.ClusterManifestLocation, SchemaLocation.GetWindowsFabricSchemaLocation());
                SetupSettings       settings = new SetupSettings(manifest);
                this.FabricDataRoot = settings.FabricDataRoot == null ? this.FabricDataRoot : settings.FabricDataRoot;
                this.FabricLogRoot  = settings.FabricLogRoot == null ? this.FabricLogRoot : settings.FabricLogRoot;
                bool isDataRootProvided = this.FabricDataRoot != null;
                ResolveDataRoot(isDataRootProvided);
                DeploymentSpecification.SetDataRoot(this.FabricDataRoot);
                ResolveLogRoot(isDataRootProvided);
                DeploymentSpecification.SetLogRoot(this.FabricLogRoot);
            }
            break;

            case DeploymentOperations.RemoveNodeConfig:
                // for RemoveNodeConfig the user does not pass the data root in, so it has to be determined
                this.FabricDataRoot = FabricEnvironment.GetDataRoot(this.MachineName);
                this.FabricLogRoot  = FabricEnvironment.GetLogRoot(this.MachineName);
                DeploymentSpecification.SetDataRoot(this.FabricDataRoot);
                DeploymentSpecification.SetLogRoot(this.FabricLogRoot);
                break;

            case DeploymentOperations.Create:
            case DeploymentOperations.None:
            case DeploymentOperations.Remove:
            case DeploymentOperations.Rollback:
            case DeploymentOperations.Update:
            case DeploymentOperations.UpdateNodeState:
            case DeploymentOperations.UpdateInstanceId:
                SetCommonRoots();
                break;

            case DeploymentOperations.ValidateClusterManifest:
                SetCommonRoots(Directory.GetCurrentDirectory());
                break;

            case DeploymentOperations.Validate:
                if (this.OldClusterManifestLocation != null && File.Exists(this.OldClusterManifestLocation) && this.FabricDataRoot == null)
                {
                    SetCommonRoots(Path.GetDirectoryName(this.OldClusterManifestLocation));
                }
                else
                {
                    SetCommonRoots();
                }
                break;

            case DeploymentOperations.DockerDnsSetup:
            case DeploymentOperations.DockerDnsCleanup:
            case DeploymentOperations.ContainerNetworkSetup:
            case DeploymentOperations.ContainerNetworkCleanup:
            case DeploymentOperations.IsolatedNetworkSetup:
            case DeploymentOperations.IsolatedNetworkCleanup:
                break;

            default:
                throw new InvalidOperationException(String.Format("The operation {0} has no explicit deployment criteria.", operation.ToString()));
            }

            if (this.InfrastructureManifestLocation == null && this.NodeName != null)
            {
                this.InfrastructureManifestLocation = this.DeploymentSpecification.GetInfrastructureManfiestFile(this.NodeName);
            }

            if (operation == DeploymentOperations.UpdateNodeState ||
                operation == DeploymentOperations.Remove ||
                operation == DeploymentOperations.UpdateInstanceId ||
                (operation == DeploymentOperations.RemoveNodeConfig && !string.IsNullOrEmpty(this.FabricDataRoot) && Directory.Exists(this.FabricDataRoot)))
            {
                this.ClusterManifestLocation        = Helpers.GetCurrentClusterManifestPath(this.FabricDataRoot);
                this.InfrastructureManifestLocation = Helpers.GetInfrastructureManifestPath(this.FabricDataRoot);
            }

            if (!string.IsNullOrEmpty(this.ClusterManifestLocation))
            {
                ClusterManifestType manifest = XmlHelper.ReadXml <ClusterManifestType>(this.ClusterManifestLocation, SchemaLocation.GetWindowsFabricSchemaLocation());
                SetupSettings       settings = new SetupSettings(manifest);
                this.SkipFirewallConfiguration = settings.SkipFirewallConfiguration;
                this.ContainerDnsSetup         = settings.ContainerDnsSetup;
                this.ContainerNetworkSetup     = settings.ContainerNetworkSetup;
                this.ContainerNetworkName      = settings.ContainerNetworkName;
#if !DotNetCoreClrLinux
                this.SkipContainerNetworkResetOnReboot = settings.SkipContainerNetworkResetOnReboot;
                this.SkipIsolatedNetworkResetOnReboot  = settings.SkipIsolatedNetworkResetOnReboot;
#endif
                this.IsolatedNetworkSetup            = settings.IsolatedNetworkSetup;
                this.IsolatedNetworkName             = settings.IsolatedNetworkName;
                this.IsolatedNetworkInterfaceName    = settings.IsolatedNetworkInterfaceName;
                this.UseContainerServiceArguments    = settings.UseContainerServiceArguments;
                this.ContainerServiceArguments       = settings.ContainerServiceArguments;
                this.EnableContainerServiceDebugMode = settings.EnableContainerServiceDebugMode;

                SetOptionalFeatureParameters(settings);
            }
            else
            {
                this.SkipFirewallConfiguration = false;
            }

            Validate();
        }