示例#1
0
 public InstallCommand(IConsole console, IOpenShift openshift, IS2iRepo s2iRepo)
     : base(console)
 {
     _console   = console;
     _openshift = openshift;
     _s2iRepo   = s2iRepo;
 }
示例#2
0
 public static S2IDeployment GetDotnetDeployment(this IOpenShift openshift, string name)
 {
     if (name == null)
     {
         throw new ArgumentNullException(nameof(name));
     }
     S2IDeployment[] deployments = GetDotnetDeploymentsCore(openshift, name);
     if (deployments.Length == 0)
     {
         throw new FailedException("Deployment not found.");
     }
     return(deployments[0]);
 }
示例#3
0
        public static S2IDeployment[] GetDotnetDeploymentsCore(this IOpenShift openshift, string deploymentName = null)
        {
            var buildConfigs      = openshift.GetS2iBuildConfigs("dotnet");
            var deploymentConfigs = openshift.GetDeploymentConfigs();
            var services          = openshift.GetServices();
            var routes            = openshift.GetRoutes();

            var deployments = new List <S2IDeployment>();

            foreach (var deploymentConfig in deploymentConfigs)
            {
                if (deploymentName != null && deploymentConfig.Name != deploymentName)
                {
                    continue;
                }
                foreach (var trigger in deploymentConfig.Triggers)
                {
                    S2iBuildConfig buildConfig = buildConfigs.FirstOrDefault(
                        bc => bc.OutputName == trigger.FromName
                        );
                    if (buildConfig == null)
                    {
                        continue;
                    }
                    Service[] deploymentServices = services.Where(
                        svc => svc.Selectors.IsSubsetOf(deploymentConfig.Labels)
                        ).ToArray();
                    Route[] deploymentRoutes = routes.Where(
                        rt => rt.Backends.Any(be => deploymentServices.Any(ds => ds.Name == be.Name))
                        ).ToArray();
                    deployments.Add(new S2IDeployment
                    {
                        DeploymentConfig = deploymentConfig,
                        BuildConfig      = buildConfig,
                        Services         = deploymentServices,
                        Routes           = deploymentRoutes
                    });
                }
                if (deploymentName != null && deploymentConfig.Name == deploymentName)
                {
                    break;
                }
            }

            return(deployments.ToArray());
        }
示例#4
0
 public static S2IDeployment[] GetDotnetDeployments(this IOpenShift openshift)
 => GetDotnetDeploymentsCore(openshift);
示例#5
0
 public AppNewCommand(IConsole console, IOpenShift openshift, IS2iRepo s2iRepo)
     : base(console)
 {
     _openshift = openshift;
     _s2iRepo   = s2iRepo;
 }
示例#6
0
 public InstallOperations(IOpenShift openshift, IS2iRepo s2iRepo)
 {
     _openshift = openshift;
     _s2iRepo   = s2iRepo;
 }
示例#7
0
        }                            // TODO: try to guess this

        public AppStatusCommand(IConsole console, IOpenShift openshift)
            : base(console)
        {
            _openshift = openshift;
        }