Example #1
0
        public DeploymentV1 GetDeploymentInfo()
        {
            KuberntesConnection kubeConnection = new KuberntesConnection();
            var deployments = kubeConnection.GetAllDeployments();
            var appName     = MakeDeploymentName(Name);

            return(deployments.Items.Where(exp => exp.Metadata.Name.ToUpper() == appName.ToUpper()).FirstOrDefault());
        }
Example #2
0
        public void ScaleDeployment(int numberOfReplicas)
        {
            string kNameSpace     = GetNameSpaceFromYaml(ProjectDir, KubeDir);
            string deploymentName = MakeDeploymentName(Name);
            KuberntesConnection kubernetesConnection = new KuberntesConnection();

            kubernetesConnection.ScaleDeployment(deploymentName, numberOfReplicas, kNameSpace);
        }
Example #3
0
        public void DeleteKubernetesmDeployment(string deployment)
        {
            KuberntesConnection kubernetesConnection = new KuberntesConnection();

            kubernetesConnection.RemoveDeployment(deployment);

            _kubernetesDeployments.Remove(SelectedKubernetesDeployment);
            OnPropertyChanged("HelmDeployments");
        }
Example #4
0
        public bool HasDeploymnet()
        {
            bool retval = false;
            KuberntesConnection kubeConnection = new KuberntesConnection();
            var appName     = MakeDeploymentName(Name);
            var deployments = kubeConnection.GetAllDeployments();

            retval = deployments.Items.Any(exp => exp.Metadata.Name.ToUpper() == appName.ToUpper() && exp.Metadata.Namespace == NameSpace);

            return(retval);
        }
        public DeploymentV1 GetDeploymentInfo(KubernetesExtensionPackage package)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            _package = package;

            KuberntesConnection kubeConnection = new KuberntesConnection();
            var deployments = kubeConnection.GetAllDeployments();
            var appName     = MakeDeploymentName(_package.GetCurrentProject().Name);

            return(deployments.Items.Where(exp => exp.Metadata.Name.ToUpper() == appName.ToUpper()).FirstOrDefault());
        }
        public void ScaleDeployment(KubernetesExtensionPackage package, int numberOfReplicas)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            _package = package;

            string kNameSpace     = GetNameSpaceFromYaml();
            string deploymentName = MakeDeploymentName(package.GetCurrentProject().Name);
            KuberntesConnection kubernetesConnection = new KuberntesConnection();

            kubernetesConnection.ScaleDeployment(deploymentName, numberOfReplicas, kNameSpace);
        }
        public bool HasDeploymnet(KubernetesExtensionPackage package)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            _package = package;
            bool retval = false;
            KuberntesConnection kubeConnection = new KuberntesConnection();
            var appName     = MakeDeploymentName(_package.GetCurrentProject().Name);
            var deployments = kubeConnection.GetAllDeployments();

            retval = deployments.Items.Any(exp => exp.Metadata.Name.ToUpper() == appName.ToUpper());
            return(retval);
        }
Example #8
0
        public NamespaceListV1 GetNameSpaces()
        {
            KuberntesConnection kubernetesConnection = new KuberntesConnection();

            return(kubernetesConnection.GetNameSpaces());
        }
Example #9
0
        public void ScaleDeployment(string deployment, int replicaCount)
        {
            KuberntesConnection kubernetesConnection = new KuberntesConnection();

            kubernetesConnection.ScaleDeployment(deployment, replicaCount, SelectedNameSpace.Name);
        }
Example #10
0
        public void LoadItems(string kubeNameSpace)
        {
            KuberntesConnection kubernetesConnection = new KuberntesConnection();
            HelmConnection      helmConnection       = new HelmConnection();

            var config = kubernetesConnection.GetKubeConfigs();

            CurrentKubeContext = config.CurrentContext;
            OnPropertyChanged("CurrentKubeContext");

            var nodes = kubernetesConnection.GetNodes();

            _nodeInfo.Clear();
            foreach (var node in nodes)
            {
                var newNode = new NodeInfo()
                {
                    Name           = node.Metadata.Name,
                    IpAddress      = node.Status.Addresses.First().Address,
                    Cidr           = node.Spec.PodCIDR,
                    IsRunning      = node.Status.Conditions.FirstOrDefault(exp => exp.Type == "Ready").Status == "True",
                    StatusMessage  = node.Status.Conditions.FirstOrDefault(exp => exp.Type == "Ready").Message,
                    NodeSystemInfo = node.Status.NodeInfo
                };

                kubernetesConnection.GetPodsRunningOnNode(newNode.Name, kubeNameSpace).Items.ForEach(pod => newNode.PodList.Add(pod));
                _nodeInfo.Add(newNode);
            }

            var kubeDeployments = kubernetesConnection.GetDeployments(kubeNameSpace);

            if (kubeDeployments != null)
            {
                _kubernetesDeployments.Clear();
                kubeDeployments.Items.ForEach(deployment => _kubernetesDeployments.Add(deployment));
            }

            var helmDeployments = helmConnection.GetHelmReleases(kubeNameSpace);

            if (helmDeployments != null)
            {
                _helmDeployments.Clear();
                helmDeployments.Releases.ForEach(helmDeployment => _helmDeployments.Add(helmDeployment));
            }

            var pods = kubernetesConnection.GetPods(kubeNameSpace);

            if (pods != null)
            {
                _pods.Clear();
                pods.Items.ForEach(pod => _pods.Add(pod));
            }

            var services = kubernetesConnection.GetServices(kubeNameSpace);

            if (services != null)
            {
                _services.Clear();
                services.Items.ForEach(service => _services.Add(service));
            }

            var configMaps = kubernetesConnection.GetConfigMaps(kubeNameSpace);

            if (configMaps != null)
            {
                _configMaps.Clear();
                configMaps.Items.ForEach(configMap => _configMaps.Add(configMap));
            }

            var secrets = kubernetesConnection.GetSecrets(kubeNameSpace);

            if (secrets != null)
            {
                _secrets.Clear();
                secrets.Items.ForEach(secret => _secrets.Add(secret));
            }
        }