Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is kubernetes source code an order of magnitude larger than other container orchestrators?

Considering other orchestration tools like dokku, dcos, deis, flynn, docker swarm, etc.. Kubernetes is no where near to them in terms of lines of code, on an average those tools are around 100k-200k lines of code.

Intuitively it feels strange that to manage containers i.e. to check health, scale containers up and down, kill them, restart them, etc.. doesn't have to consist of 2.4M+ lines of code (which is the scale of an entire Operating System code base), I feel like there is something more to it.

What is different in Kubernetes compared to other orchestration solutions that makes it so big?

I dont have any knowledge of maintaining more than 5-6 servers. Please explain why it is so big, what functionalities play big part in it.

like image 203
user3713466 Avatar asked Jan 11 '17 08:01

user3713466


1 Answers

Aside from the reasons given by @abronan, the Kubernetes codebase contains lots of duplication and generated files which will artificially increase the code size. The actual size of the code that does "real work" is much smaller.

For example, take a look at the staging directory. This directory is 500,000 LOC but nothing in there is original code; it is all copied from elsewhere in the Kubernetes repo and rearranged. This artificially inflates the total LOC.

There's also things like Swagger API generation which are auto-generated files that describe the Kubernetes API in the OpenAPI format. Here are some places where I found these files:

  • kubernetes/api/

  • Kubernetes/federation/apis/swagger-spec

  • kubernetes/federation/apis/openapi-spec

Together these files account for ~116,000 LOC and all they do is describe the Kubernetes API in OpenAPI format!

And these are just the OpenAPI definition files - the total number of LOC required to support OpenAPI is probably much higher. For instance, I've found a ~12,000 LOC file and a ~13,000 LOC file that are related to supporting Swagger/OpenAPI. I'm sure there are plenty more files related to this feature as well.

The point is that the code that does the actual heavy lifting behind the scenes might be a small fraction of the supporting code that is required to make Kubernetes a maintainable and scalable project.

like image 142
Pixel Elephant Avatar answered Oct 18 '22 07:10

Pixel Elephant