/// <summary> /// Adds a docker node to the hive. /// </summary> /// <param name="node">The new node.</param> public void AddNode(NodeDefinition node) { Covenant.Requires <ArgumentNullException>(node != null); Covenant.Requires <ArgumentException>(NeonHelper.DoesNotThrow(() => node.Validate(this))); NodeDefinitions.Add(node.Name, node); }
/// <summary> /// Parses a <see cref="NodeDefinition"/> from Docker node labels. /// </summary> /// <param name="labels">The Docker labels.</param> /// <returns>The parsed <see cref="NodeDefinition"/>.</returns> public static NodeDefinition ParseFromLabels(Dictionary <string, string> labels) { var node = new NodeDefinition(); node.Labels.Parse(labels); return(node); }
/// <summary> /// Returns a clone of the current instance. /// </summary> /// <param name="parentNode">The cloned parent node.</param> /// <returns>The clone.</returns> public NodeLabels Clone(NodeDefinition parentNode) { Covenant.Requires <ArgumentNullException>(parentNode != null); var clone = new NodeLabels(parentNode); this.CopyTo(clone); return(clone); }
/// <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($"{hive.Definition.Hosting.GetVmNamePrefix(hive.Definition)}{node.Name}"); }
/// <summary> /// Returns the hostname for a registry cache instance hosted on a manager node. /// </summary> /// <param name="manager">The manager node.</param> /// <returns>The hostname.</returns> public string GetRegistryCacheHost(NodeDefinition manager) { return($"{manager.Name}.{Hostnames.RegistryCache}"); }
private NodeDefinition node; // The parent node /// <summary> /// Constructor. /// </summary> /// <param name="parentNode">The parent node.</param> public NodeLabels(NodeDefinition parentNode) { Covenant.Requires <ArgumentNullException>(parentNode != null); this.node = parentNode; }