/// <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); }
/// <summary> /// Constructor. /// </summary> /// <param name="node">The node definition.</param> public NodeLabels(NodeDefinition node) { Covenant.Requires <ArgumentNullException>(node != null, nameof(node)); this.Node = node; }
/// <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}"); }
//--------------------------------------------------------------------- // 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); }