Re: Jenkins slave autoscaling in container platform (ECS or any other docker platforms)

2019-01-22 Thread Bill WANG
With "docker-plugin" or "amazon-ecs", I do get some progresses.

For example, if enable "amazon-ecs" (configure system -> "add a new cloud" 
-> "Amazon EC2 Container Service Cloud") , I can successfully build from a 
temporary slave container in ECS

1. define a task definition in above cloud setting.
2. the plugin will automatically start up a new container in nominated ECS 
cluster, run the build, and terminate itself

Bill

On Monday, January 21, 2019 at 2:58:22 PM UTC+11, Bill WANG wrote:
>
> It is popular solution to start up new Jenkins slave via ssh from Jenkins 
> master, for example, via ssh slaves plugin. But this solution is too old 
> and only for VM or ec2 instance (Hosts, virtual hosts or physical hosts)
>
> Now we are in world of containers.
>
> Another solution is to use jnlp (java web client), agent name and secrets 
> have to be defined at Jenkins master first, then we can start a jar with 
> the defined agent name and secrets. But the name and secrets can't be 
> defined on-fly when a new Agent try to register itself. 
>
> What I want to achieve: 
>
> 1. Jenkins master and slaves are all running in containers (in same vpc)
> 2. I don't mind scaling master currently, so run with one master is fine.
> 3. define number of slaves (desired capacity) in auto-scaling group, the 
> containers of slave should be started and registered themselves to master 
>
> What I did,
>
> 1. manually define several slaves, hard code the slave name and secrets, I 
> can see these slaves successfully registered in master. But if more agents 
> then defined are scaled up, the rest can't be registered, with error 
>
> ```
> Jenkins_slave is already connected to this master. Rejecting this 
> connection.
> ```
>
> So any suggestions to implement this idea?
>
> The problem I need resolve are:
>
> 1. Any ways to define slaves on-fly when a new slave container started (it 
> will be better to clean it in master later if the container is gone, if 
> possible)
>
> If above way is too hard, I think about the work around: 
>
> 1. I can pre-define 10 or even 30+ slaves in Jenkins master, any easier 
> way to initialise this automatically, (think about the jenkins master is 
> set up as a new server) . Real slaves' max capacity should be equal or less 
> than number of pre-define slaves.
>
> 2. save the slave names and secrets to secret managers (such as vault, ssm 
> parameter store or aws secret manager, etc)
>
> 3. When a container of slaves start, look for the agent name 
> (jenkins_slave_) with its secret one by one, if `jenkins_slave_1` 
> has been registered by another slave container, move on to next 
> `jenkins_slave_2` 
> and next.
>
> Need your feedback and helps.
>
> Thanks
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a44d7193-4199-45d2-b1a9-ace75034a2df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Jenkins slave autoscaling in container platform (ECS or any other docker platforms)

2019-01-20 Thread Bill WANG
It is popular solution to start up new Jenkins slave via ssh from Jenkins 
master, for example, via ssh slaves plugin. But this solution is too old 
and only for VM or ec2 instance (Hosts, virtual hosts or physical hosts)

Now we are in world of containers.

Another solution is to use jnlp (java web client), agent name and secrets 
have to be defined at Jenkins master first, then we can start a jar with 
the defined agent name and secrets. But the name and secrets can't be 
defined on-fly when a new Agent try to register itself. 

What I want to achieve: 

1. Jenkins master and slaves are all running in containers (in same vpc)
2. I don't mind scaling master currently, so run with one master is fine.
3. define number of slaves (desired capacity) in auto-scaling group, the 
containers of slave should be started and registered themselves to master 

What I did,

1. manually define several slaves, hard code the slave name and secrets, I 
can see these slaves successfully registered in master. But if more agents 
then defined are scaled up, the rest can't be registered, with error 

```
Jenkins_slave is already connected to this master. Rejecting this 
connection.
```

So any suggestions to implement this idea?

The problem I need resolve are:

1. Any ways to define slaves on-fly when a new slave container started (it 
will be better to clean it in master later if the container is gone, if 
possible)

If above way is too hard, I think about the work around: 

1. I can pre-define 10 or even 30+ slaves in Jenkins master, any easier way 
to initialise this automatically, (think about the jenkins master is set up 
as a new server) . Real slaves' max capacity should be equal or less than 
number of pre-define slaves.

2. save the slave names and secrets to secret managers (such as vault, ssm 
parameter store or aws secret manager, etc)

3. When a container of slaves start, look for the agent name 
(jenkins_slave_) with its secret one by one, if `jenkins_slave_1` 
has been registered by another slave container, move on to next 
`jenkins_slave_2` 
and next.

Need your feedback and helps.

Thanks




-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1ab19cfd-1907-4b2f-bce0-0f9ad05b8411%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.