Run install.sh
sudo ./install.sh
Follow our wiki at Install As Daemon
- Proxy and barrel-network-plugin turn on(Default)
- Proxy only
- Calico-network-plugin only
Docker daemon wrapper, with calico plugin
Run install.sh
sudo ./install.sh
Follow our wiki at Install As Daemon
一切照旧
inherit network
no inherit network
no inerit network
inerit network
Currently, the barrel will return a bad gateway error to the client when failed. For example, when it failed to allocate a new address when creating a container with a fixed-ip
label, it will show a bad gateway error.
Related code:
func writeErrorResponse(res http.ResponseWriter, logger utils.Logger, err error, label string) {
logger.Errorf("%s failed %v", label, err)
if err := utils.WriteBadGateWayResponse(
res,
utils.HTTPSimpleMessageResponseBody{
Message: label + " error",
},
); err != nil {
logger.Errorf("write %s error response failed %v", label, err)
}
}
Logging:
Aug 25 19:02:51 bash[23490]: time="2021-08-25 19:02:51" level=info msg="Ran out of existing affine blocks for host"
Aug 25 19:02:51 bash[23490]: time="2021-08-25 19:02:51" level=info msg="Auto-assigned 0 out of 1 IPv4s: []"
Aug 25 19:02:51 bash[23490]: time="2021-08-25 19:02:51" level=error msg="[containerCreateHandler::Handle] check and request fixed-ip failed Unexpected number of assigned IP addresses. A single address should be assigned. Got []"
But the error message is not explicit to read on the client-side:
Error response from daemon: check and request fixed-ip error
The Barrel should be compatible with the docker client and act like a normal dockerd.
Actually, it's not my first time helping others (like QA colleagues) and I have already found it's difficult to identify the root cause. I am recalling my memory of it, if I made it, I will update it here.
Update:
I have recalled it. On day QA came to ask me why he kept getting an error The requested subnet must match the CIDR of a configured Calico IP Pool
when creating new containers using the calico network in his own test cluster.
It looked like the subnet was not right in the configuration. But after confirming this and others, it wasn't the cause. And I created a new one with calico, it worked normally. That really confused me. After spending time to reading code and logs, I found the problem finally. The related code was:
f := false
networkName := ""
for _, p := range pools.Items {
if nid, ok := p.Annotations[dockerLabelPrefix+"network.ID"]; ok && nid == request.NetworkID {
f = true
networkName = p.ObjectMeta.Name
log.Debugf("Find ippool : %v\n", p.Name)
break
}
}
if !f {
log.Errorln(types.ErrCIDRNotInPool)
return nil, types.ErrCIDRNotInPool
}
Though I didn't know how it happened, the network.ID
didn't match that in the configuration of docker. So the error message was totally misleading. I suggest we output appropriate and explicit logs at least or good to have a more explicit error message.
Assume that a user had bind several directory to a container, that parent of those directory also belongs to the container:
Mounts":[
{
"Type": "bind" ,
"Source": "/data/biz/cluster01/container01/data","Destination" : " /data/my_data" ,
"Mode" : "rw" ,
"RW" : true,
"Propagation" :"rprivate"
,
"Type" : "bind" ,
" Source" : " /data/biz/cluster01/container01/1og","Destination" : "/data/my_log",
"Mode" : "rw" ,
"RW":true,
"Propagation" :"rprivate"
],
The root directory for bindings of a single container is like "/data/biz/cluster01/container01", If user want to remove the directory, we need more info for us to conclude that the path is some sort of resource for the container. Thus we have plans:
A. User mount /data/biz/cluster01/container01 as well
B. Recording the infomation in label:
"Labels": {
“BARREL”: "{\"Mounts\: [\"/data/biz/cluster01/container01\"]"}"
}
For plan A, we need to parse the mounts to find out the directories need to remove and directories need not, and there will be a useless mount for the container. For plan B it's more simple but there is a risk that a container declares unrelated resources in the label, however we can do the same parsing to the mount declares inside label to eliminate the risk, or using a regex to safeguard it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.