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

Add CLI command to generate k8s manifests #1046

Merged
merged 15 commits into from
May 12, 2020

Conversation

chlunde
Copy link
Contributor

@chlunde chlunde commented Apr 29, 2020

Defaults to stdin/stdout

Examples:

jaeger-operator generate \
    --jaeger-all-in-one-image localimage \
    --cr ./deploy/examples/all-in-one-with-options.yaml \
    | kubectl apply -f -

cat jaeger.yaml | podman run jaeger-operator generate > manifest.yaml

Fixes #375

@chlunde
Copy link
Contributor Author

chlunde commented Apr 29, 2020

POC for discussion, primarily because I wanted when looking at the code :)

pkg/strategy/strategy.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 29, 2020

Codecov Report

Merging #1046 into master will increase coverage by 0.19%.
The diff coverage is 94.59%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1046      +/-   ##
==========================================
+ Coverage   64.58%   64.78%   +0.19%     
==========================================
  Files          84       84              
  Lines        6715     6758      +43     
==========================================
+ Hits         4337     4378      +41     
- Misses       2236     2237       +1     
- Partials      142      143       +1     
Impacted Files Coverage Δ
pkg/strategy/strategy.go 95.53% <93.93%> (-0.67%) ⬇️
pkg/account/main.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 465ee77...62ebfae. Read the comment docs.

@pavolloffay
Copy link
Member

Could you please document this feature in readme how to use it as a docker command?

pkg/strategy/strategy.go Show resolved Hide resolved

// TODO: Did I get all the relevant options? Too many?

cmd.Flags().String("jaeger-agent-image", "jaegertracing/jaeger-agent", "The Docker image for the Jaeger Agent")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no-go to have double copy of all the flags. It should be unified with start/main.go

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now shared, if you have an idea for a better name/package, please say where :)

pkg/cmd/generate/main.go Show resolved Hide resolved
@pavolloffay
Copy link
Member

Could you add a e2e test that would generate all-in-one deployment from a generated file?

@chlunde chlunde force-pushed the generate-cmd branch 3 times, most recently from 88fb60a to b697b77 Compare May 6, 2020 22:07
pkg/account/main.go Show resolved Hide resolved
pkg/cmd/generate/main.go Outdated Show resolved Hide resolved
chlunde added 7 commits May 7, 2020 13:46
Defaults to stdin/stdout

Examples:

   jaeger-operator generate --jaeger-all-in-one-image localimage --cr ./deploy/examples/all-in-one-with-options.yaml | kubectl apply -f -

   cat jaeger.yaml | podman run jaeger-operator generate > manifest.yaml

Fixes jaegertracing#375

Signed-off-by: Carl Henrik Lunde <[email protected]>
Signed-off-by: Carl Henrik Lunde <[email protected]>
Signed-off-by: Carl Henrik Lunde <[email protected]>
Signed-off-by: Carl Henrik Lunde <[email protected]>
Signed-off-by: Carl Henrik Lunde <[email protected]>
chlunde added 4 commits May 7, 2020 15:44
Signed-off-by: Carl Henrik Lunde <[email protected]>
Signed-off-by: Carl Henrik Lunde <[email protected]>
@chlunde chlunde changed the title WIP Add CLI command jaeger-operator generate to generate manifests Add CLI command jaeger-operator generate to generate manifests May 7, 2020
Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work!

@kevinearls could you please have a look at e2e tests?

README.md Outdated Show resolved Hide resolved
README.md Outdated

## Command line invocation

To dry-run, experiment or run adapt the generated output with kustomize, command line invocation using the `generate`subcommand is possible. In this example we apply the manifest generated by examples/simple-prod.yaml to the namespace `jaeger-test`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be just dry-run some people still prefer to use plain manifest files. This paragraph should tell that jaeger-operator generate generates kubernetes manifest file from a given CR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, but I'm not sure if you wanted the introduction sentence at all. Maybe you want to spell our the whole paragraph instead? :)

If anything, maybe we should have an example with kustomize or hint that people should use kustomize instead of manually patching the generated file. This would allow them to run generate with a newer version of the operator to get upgrades later, and hopefully not update/redo the local changes.

pkg/cmd/generate/main.go Show resolved Hide resolved
Copy link
Contributor

@kevinearls kevinearls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've requested 2 minor test changes. I am also running this PR on our internal CI that uses OpenShift and will update this review once that finishes.

test/e2e/generator_test.go Show resolved Hide resolved
test/e2e/generator_test.go Show resolved Hide resolved
chlunde added 2 commits May 11, 2020 20:38
Signed-off-by: Carl Henrik Lunde <[email protected]>
Copy link
Contributor

@kevinearls kevinearls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just a couple of nits

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
pkg/cmd/start/main.go Outdated Show resolved Hide resolved
pkg/cmd/start/main.go Outdated Show resolved Hide resolved
pkg/cmd/generate/main.go Outdated Show resolved Hide resolved
pkg/cmd/generate/main.go Outdated Show resolved Hide resolved
Signed-off-by: Carl Henrik Lunde <[email protected]>
Signed-off-by: Carl Henrik Lunde <[email protected]>
@pavolloffay pavolloffay merged commit f3f1f23 into jaegertracing:master May 12, 2020
@pavolloffay pavolloffay changed the title Add CLI command jaeger-operator generate to generate manifests Add CLI command to generate k8s manifests May 12, 2020
@pavolloffay
Copy link
Member

thanks @chlunde 🚀 !

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

Successfully merging this pull request may close these issues.

Operator to generate k8s deployment manifests
3 participants