Exemplo n.º 1
0
        public void updateClusterView(Pod pod)
        {
            // If the container image is "image:tag", strip the ":tag", otherwise leave it alone
            // not all images are tagged, so..
            if (pod.ContainerImage.Contains(':'))
            {
                pod.ContainerImage = pod.ContainerImage.Substring(0, pod.ContainerImage.IndexOf(':'));
            }

            if (Pods.Any(x => x.Name == pod.Name))
            {
                if (pod.Action == POD_DELETED_STATUS)
                {
                    RemovePod(pod);
                }
                else
                {
                    UpdatePod(pod);
                }
            }
            else
            {
                AddPod(pod);
            }

            Clients.All.SendAsync("clusterViewUpdated", Pods);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Registers and returns a new ID for an object of the given type.
 /// </summary>
 /// <returns>A new unique ID that can be used to identify the object.</returns>
 public int RegisterPodID()
 {
     if (Pods.Any() && _podID <= Pods.Max(e => e.ID))
     {
         _podID = Pods.Max(e => e.ID) + 1;
     }
     return(_podID++);
 }