Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Use a single binary to run the different Operator processes #252

Merged
merged 4 commits into from
May 13, 2020

Conversation

lrgar
Copy link
Contributor

@lrgar lrgar commented May 12, 2020

We currently run three containers with the Operator package,

  • The good old Operator itself.
  • The webhook bootstrapper.
  • The webhook server.

I initially created one binary for each one of these, but we can merge them into a single binary, and use a subcommand to run it on any of these modes. The difference between them is which reconcilers are started.

I'm calling the subcommands respectively,

  • operator
  • webhook-bootstrapper
  • webhook-server

So, if you run the Operator locally, it would be like,

$ operator-sdk run --local --operator-flags="operator"
$ WATCH_NAMESPACE=dynatrace go run ./cmd/manager/ -- operator

Finally, I'm removing the add_***.go files that are created by the operator-sdk's scaffolding, and instead using a list on cmd/manager/operator.go. The idea here is that we don't really use scaffolding and just copy/paste for new reconcilers, and having a simple list is more clear than depending on the behavior of init() functions. The webhook processes are already just adding specific reconcilers, so we would get some consistency.

@lrgar lrgar requested a review from DTMad May 12, 2020 14:33
@lrgar
Copy link
Contributor Author

lrgar commented May 13, 2020

Now using operator as the default subcommand if nothing is set. You need to explicitly use the subcommand to run the webhook server and bootstrapper.

@lrgar lrgar merged commit 63c887e into master May 13, 2020
@lrgar lrgar deleted the feature/onebin branch May 13, 2020 13:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants