Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Operator Tooling to be Self-Contained and Written Idiomatically #265

Open
lindluni opened this issue Jan 10, 2021 · 0 comments
Open

Comments

@lindluni
Copy link
Contributor

The first thing I'll note is, this is going into a feature branch, not directly into master, as getting it right is more important to me than getting it in. I am opening the PR's here so the work is visible and can be commented on, but it will not change the way the Operator works today, as I wont be merging anything to master until all of the work is done.

The second thing is, I am focusing on one part at a time (Docker to start). This means I am okay breaking things related to kuberenetes up front. Once I am done with the Docker portion, I will come back through each PR and refactor each PR to work with Kubernetes. So the NodePortIP missing would be corrected in a refactor of this PR at a later time

Today the operator calls out to several command line tools: Docker, Configtxgen, Configtxlator, YTT, Crtyptogen, and even performing some tasks like moving a file by calling the bash mv as opposed to using the Go os.Rename, and until recently we also called out to the kubectl command.

This is highly problematic in that it requires the user to first put tools on their path before ever using our tool. It also prevents us from ensuring version compatibility, i.e., I don't know if they have configtxgen 2.0 or 1.1.

Because of YTT we also write a custom config to disk, over and over again. And we read the config and append data to it and write it to disk, then read it again, and append data to it and write it to disk, all before ever generating the YAML files we want.

Instead these changes will bring about proper config injection and dependency management. Creating in memory config objects where necessary and replacing tools like configtxgen and configtxlator with the fabric-config to manage config operations in code, and replace the calls to Docker with the Docker SDK, and ultimately remove YTT by replacing cryptogen with calls to the fabric CA using the Go SDK (since we aren't actually testing the functionality of cryptogen the place we get crypto from is irrelevant).

Ultimately this will allow us to remove external dependencies, and make the Operator tool a truly standalone tool.

The change to the Go SDK will allow us to embed everything we need to perform System Tests in the Operator tooling. Getting the Operator into state where it is able to extended and maintained is important, and today it is very hard to wrap your head around what is happening as a lot of things are managed on disk, rather than in code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant