protected override async IAsyncEnumerable <ContainerArgs> AddContainersAsync()
        {
            var passivePorts = new PortRange(21100, 21110);

            var ftpVariables = new Dictionary <string, string>
            {
                ["FTP_USER"]      = "******",
                ["FTP_PASS"]      = "******",
                ["PASV_MIN_PORT"] = passivePorts.Start.ToString(),
                ["PASV_MAX_PORT"] = passivePorts.End.ToString()
            };

            var ftpPorts = new List <PortMapping>
            {
                PortMapping.MapSinglePort(30020, 20),
                PortMapping.MapSinglePort(30021, 21),
                new PortMapping(passivePorts, passivePorts)
            };

            var ftp = new ContainerArgs(
                "fauria/vsftpd",
                "ftp",
                ftpPorts,
                ftpVariables
                );

            yield return(ftp);
        }
예제 #2
0
    private IEnumerator Load(EventArgs args)
    {
        ContainerArgs cArgs = args as ContainerArgs;

        yield return(new WaitForSeconds(2f));

        StorageObject(cArgs.container);

        yield break;
    }
예제 #3
0
    private bool IsStorageble(EventArgs args)
    {
        ContainerArgs cArgs = args as ContainerArgs;
        Asteroid      aster = cArgs.container as Asteroid;

        if (aster == null)
        {
            Debug.LogWarning("Trying to magnet: " + cArgs.container.EntityName);
            return(false);
        }

        float volume = aster.Containment.Amount;

        return(volume <= 0.2f);
    }
예제 #4
0
    private IEnumerator Repulse(EventArgs args)
    {
        ContainerArgs cArgs = args as ContainerArgs;

//		Rigidbody2D rigid = cArgs.container.View.GetComponent<Rigidbody2D>();
        Rigidbody rigid = cArgs.container.View.GetComponent <Rigidbody>();

        while ((cArgs.container.View.transform.position - m_containerAttachedTo.View.transform.position).magnitude > 1f)
        {
            rigid.AddForce((rigid.position - myRigid.position).normalized * m_magnetPower);

            yield return(null);
        }

        yield break;
    }
예제 #5
0
 public RedisArgs(ContainerArgs containerArgs, PortPoolRental redisPort)
 {
     ContainerArgs = containerArgs;
     RedisPort     = redisPort;
 }
예제 #6
0
 public FtpArgs(ContainerArgs containerArgs, PortPoolRental ftpDefault, PortPoolRental ftpSecondary)
 {
     ContainerArgs = containerArgs;
     FtpDefault    = ftpDefault;
     FtpSecondary  = ftpSecondary;
 }
예제 #7
0
    public ServiceDeployment(string name, ServiceDeploymentArgs args, ComponentResourceOptions?opts = null)
        : base(name, "k8sx:service:ServiceDeployment", opts)
    {
        var labels = new InputMap <string>
        {
            { "app", name },
        };

        var deploymentPorts = args.Ports.ToOutput().Apply(ports =>
                                                          from p in ports select new ContainerPortArgs {
            ContainerPortValue = 6379
        }
                                                          );

        var container = new ContainerArgs
        {
            Name      = name,
            Image     = args.Image,
            Resources = args.Resources ?? new ResourceRequirementsArgs
            {
                Requests =
                {
                    { "cpu",    "100m"  },
                    { "memory", "100Mi" },
                },
            },
            Env   = args.Env,
            Ports = deploymentPorts,
        };

        this.Deployment = new Pulumi.Kubernetes.Apps.V1.Deployment(name, new DeploymentArgs
        {
            Spec = new DeploymentSpecArgs
            {
                Selector = new LabelSelectorArgs
                {
                    MatchLabels = labels,
                },
                Replicas = args.Replicas ?? 1,
                Template = new PodTemplateSpecArgs
                {
                    Metadata = new ObjectMetaArgs
                    {
                        Labels = labels,
                    },
                    Spec = new PodSpecArgs
                    {
                        Containers = { container },
                    },
                },
            },
        },
                                                                   new CustomResourceOptions {
            Parent = this
        });

        var servicePorts = args.Ports.ToOutput().Apply(ports =>
                                                       from p in ports select new ServicePortArgs {
            Port = p, TargetPort = p
        }
                                                       );

        this.Service = new Pulumi.Kubernetes.Core.V1.Service(name, new ServiceArgs
        {
            Metadata = new ObjectMetaArgs
            {
                Name   = name,
                Labels = this.Deployment.Metadata.Apply(metadata => metadata.Labels),
            },
            Spec = new ServiceSpecArgs
            {
                Type     = args.AllocateIPAddress.Apply(hasIp => hasIp ? (args.ServiceType ?? "LoadBalancer") : null),
                Ports    = servicePorts,
                Selector = this.Deployment.Spec.Apply(spec => spec.Template.Metadata.Labels),
            },
        },
                                                             new CustomResourceOptions {
            Parent = this
        });

        this.IpAddress = args.AllocateIPAddress.Apply(hasIp =>
        {
            if (hasIp)
            {
                return(args.ServiceType.Apply(serviceType =>
                                              serviceType == "ClusterIP"
                    ? this.Service.Spec.Apply(s => s.ClusterIP)
                    : this.Service.Status.Apply(status =>
                {
                    var ingress = status.LoadBalancer.Ingress[0];
                    // Return the ip address if populated or else the hostname
                    return ingress.Ip ?? ingress.Hostname;
                })
                                              ));
            }
            else
            {
                return(null);
            }
        });
    }
예제 #8
0
 public Smtp4DevArgs(ContainerArgs containerArgs, PortPoolRental smtpPort, PortPoolRental httpPort)
 {
     ContainerArgs = containerArgs;
     SmtpPort      = smtpPort;
     HttpPort      = httpPort;
 }
예제 #9
0
 public SeqArgs(ContainerArgs containerArgs, PortPoolRental httpPort)
 {
     ContainerArgs = containerArgs;
     HttpPort      = httpPort;
 }
예제 #10
0
 public PostgresArgs(ContainerArgs containerArgs, PortPoolRental pgPort)
 {
     ContainerArgs = containerArgs;
     PgPort        = pgPort;
 }