コード例 #1
0
        /// <summary>
        /// Adds a node to the cluster.
        /// </summary>
        /// <param name="node">The new node.</param>
        public void AddNode(NodeDefinition node)
        {
            Covenant.Requires <ArgumentNullException>(node != null, nameof(node));
            Covenant.Requires <ArgumentException>(NeonHelper.DoesNotThrow(() => node.Validate(this)), nameof(node));

            NodeDefinitions.Add(node.Name, node);
        }
コード例 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="node">The node definition.</param>
        public NodeLabels(NodeDefinition node)
        {
            Covenant.Requires <ArgumentNullException>(node != null, nameof(node));

            this.Node = node;
        }
コード例 #3
0
 /// <summary>
 /// Returns the name to use for naming the virtual machine hosting the node.
 /// </summary>
 /// <param name="node">The target node.</param>
 /// <returns>The virtual machine name.</returns>
 private string GetVmName(NodeDefinition node)
 {
     return($"{cluster.Definition.Hosting.GetVmNamePrefix(cluster.Definition)}{node.Name}");
 }
コード例 #4
0
        //---------------------------------------------------------------------
        // Static methods

        /// <summary>
        /// Parses a <see cref="NodeDefinition"/> from Kubernetes node labels.
        /// </summary>
        /// <param name="labels">The node labels.</param>
        /// <returns>The parsed <see cref="NodeDefinition"/>.</returns>
        public static NodeDefinition ParseFromLabels(Dictionary <string, string> labels)
        {
            var node = new NodeDefinition();

            return(node);
        }