Skip to content

Commit

Permalink
CLI inject/uninject extraction of workload parser and injection methods
Browse files Browse the repository at this point in the history
- Extracted from `/cli/cmd/inject.go` and `/cli/cmd/inject_util.go`
the core methods doing the workload parsing and injection, and moved them into
`/pkg/inject/inject.go`. The CLI files should now deal only with
strictly CLI concerns, and applying the json patch returned by the new
lib.
- Proceeded analogously with `/cli/cmd/uninject.go` and
`/pkg/inject/uninject.go`.
- The `InjectReport` struct and helping methods were moved into
`/pkg/inject/report.go`

The only network call `/pkg/inject/inject.go` does is inside `shouldInject()` where it
retrieves the namespace annotations from kubernetes. I think we need to
review how that client is created in there.

Caveats:

- Currently passing aroung GlobalConfig and ProxyConfig and using their
GRPC methods directly, until we come up with an abstraction for all that.
- I removed support for parsing yamls with List containing multiple workloads
because it was not an easy refactor given the recursion. I'll re-add
that later on.
- Todo: fix all the tests.
- I've made a note to remove later on the bad v1 import alias that
VSCode is adding.

Ref #1748 and #2289

Signed-off-by: Alejandro Pedraza <[email protected]>
  • Loading branch information
alpeb committed Feb 21, 2019
1 parent c00447f commit 35bd360
Show file tree
Hide file tree
Showing 7 changed files with 811 additions and 622 deletions.
Loading

0 comments on commit 35bd360

Please sign in to comment.