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

[docs][chuck] Example YAML generation using ksonnet and kubecfg #58

Merged
merged 2 commits into from
Aug 24, 2017
Merged

[docs][chuck] Example YAML generation using ksonnet and kubecfg #58

merged 2 commits into from
Aug 24, 2017

Conversation

jesscodez
Copy link
Contributor

This is heavily based off of @chuckha 's PR #52. (See the latest commit for the changes that I made).
cc @timothysc @kensimon PTAL

It is dependent on the pending merge of another PR I made yesterday (ksonnet/ksonnet-lib#67), which adds kubecfg to the ksonnet-lib Docker image. (The new image will also need to be pushed to the public registry).

This PR incorporates that new kubecfg functionality to:

  • Output YAML instead of JSON
  • Output pretty-printed YAML/JSON for the multiline values in the ConfigMaps
  • Generate an all-in-one YAML manifest (as well as component manifests)
  • Use an extVar (env variable $RBAC_ENABLED) to determine if RBAC resource definitions should be included in the generated YAML files.

It also fixes some minor bugs from Chuck's commit, and I have confirmed that it works on clusters with and without RBAC apigroups enabled.

@jesscodez
Copy link
Contributor Author

Oh I also updated docs accordingly, let me know if you have any changes in mind.

Makefile Outdated
# Note the only reason we are creating this is because upstream
# does not yet publish a released e2e container
# https://github.com/kubernetes/kubernetes/issues/47920

EXAMPLE_FILES = $(wildcard examples/ksonnet/components/*.jsonnet)
EXAMPLE_OUTPUT = examples/quickstart/aggregate.yaml $(patsubst examples/ksonnet/components/%.jsonnet,examples/quickstart/components/%.yaml,$(EXAMPLE_FILES))
KSONNET_BUILD_IMAGE = ksonnet:test # TODO: CHANGE ONCE NEW KSONNET IMAGE IS PUSHED
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reminder to self

local configmaps = import "examples/ksonnet/components/10-configmaps.jsonnet";
local pod = import "examples/ksonnet/components/20-pod.jsonnet";

rbac + configmaps + pod
Copy link
Contributor

Choose a reason for hiding this comment

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

does kubecfg take a k8s v1.List object and turn it into --- delimited yaml objects? :mindblown:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

heh I was so pleasantly surprised with all of kubecfg's functionality

@timothysc timothysc requested a review from kensimon August 21, 2017 13:53
@timothysc timothysc added this to the v0.9.0 milestone Aug 21, 2017
@timothysc timothysc added area/documentation Related to project documentation p1-important labels Aug 21, 2017
@timothysc
Copy link
Contributor

@chuckha @kensimon I'll let you two see this through.

README.md Outdated
@@ -32,19 +32,31 @@ This guide executes a Sonobuoy run on your cluster, and records the following re

* *You should have `kubectl` installed.* If not, follow the instructions for [installing via Homebrew (MacOS)][6] or [building the binary (Linux)][7].

* *You should have `docker` installed (minimum 17.05).* Docker images are used to generate the YAML examples, based on your cluster's RBAC settings.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the 17.05 requirement?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ncdc I saw that on Docker multi-stage build page (https://docs.docker.com/engine/userguide/eng-image/multistage-build/), but if that version is a potential blocker for folks, I can repurpose the Dockerfile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

err clarification: the Dockerfile for ksonnet

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, you're doing multistage builds. I know Fedora's newest is 1.13 (still on the previous versioning scheme). Might be an issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah ok, thanks for the heads up---the ksonnet PR is on hold til Alex gets back tomorrow, but if I finish the Ark PR, I'll come back and try to take out that dependency

Copy link
Contributor

Choose a reason for hiding this comment

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

We're not doing multi-stage builds yet, please remove the requirement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah my bad -- the 17.05 req is for building images, not running them. The ksonnet image has a multi-stage build but since we're pulling from a public image registry it should be fine. I'll remove this.

@chuckha
Copy link
Contributor

chuckha commented Aug 21, 2017

Were you able to test the quickstart files without RBAC enabled?

@jesscodez
Copy link
Contributor Author

@chuckha yup I disabled RBAC, sonobuoy worked fine (as long as I didn't include the manifests for RBAC components).

Copy link
Contributor

@chuckha chuckha left a comment

Choose a reason for hiding this comment

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

This looks good to me!

@timothysc
Copy link
Contributor

@abiogenesis-now please rebase and we can go ahead and merge.

@jesscodez
Copy link
Contributor Author

will rebase soon!

@jesscodez
Copy link
Contributor Author

@timothysc @kensimon rebased, but
(1) I think my branch name might be breaking the Jenkins build? Not sure how to best fix
(2) I ran both Sonobuoy master and my branch, and encountered the following error with both:
screen shot 2017-08-23 at 5 59 51 pm
Have you seen this before/do you know what might be causing it? The systemd_logs pods keep launching and dying.

@kensimon
Copy link

Looks like the git describe we're doing in the Makefile to pick an image tag is choking on the slash in the source branch (chuck/jsonnet). I'll take a look at that.

For your screenshot, I'd need more context for that error, a 409 happens when you're uploading something twice.

@jesscodez
Copy link
Contributor Author

👍 let me know if it's easier/simpler to somehow rename this remote branch (is that possible without having to recreate the PR?) thanks!

Will try to dig up some more useful logs

@kensimon
Copy link

run tests

@kensimon
Copy link

Bah, I hit the "Update branch" button in github hoping it would give me an option to rebase, but it created a merge commit (which breaks the signoff checker.) @abiogenesis-now could you rebase?

@jesscodez
Copy link
Contributor Author

👍 can do, also making some small docs revisions so please hold

also I'm no longer encountering the 409 error I screenshotted above--I'm not sure if I accidentally had too many sonobuoy instances running (???) from improper cleanup or some such thing. Confirmed that this code works on my quickstart cluster and my non-RBAC cluster.

Chuck Ha and others added 2 commits August 24, 2017 11:52
Closes issue #5.

- Adds jsonnet to generate the quickstart examples
- Removes the YAML
- Adds the generated JSON
- Docs are updated to reflect JSON files vs YAML
- Adds a Makefile target, `generate-examples`

Signed-off-by: Chuck Ha <[email protected]>
@jesscodez jesscodez changed the title [hold][docs][chuck] Example YAML generation using ksonnet and kubecfg [docs][chuck] Example YAML generation using ksonnet and kubecfg Aug 24, 2017
@jesscodez
Copy link
Contributor Author

@kensimon This is done on my end, feel free to merge if it looks good to you and the build passes!

@kensimon kensimon merged commit ed6b294 into vmware-tanzu:master Aug 24, 2017
@jesscodez jesscodez deleted the chuck/jsonnet branch August 24, 2017 18:56
jhamilton1 pushed a commit to jhamilton1/sonobuoy that referenced this pull request Jun 27, 2018
[docs][chuck] Example YAML generation using ksonnet and kubecfg
Signed-off-by: Jesse Hamilton [email protected]
jhamilton1 pushed a commit to jhamilton1/sonobuoy that referenced this pull request Jun 27, 2018
[docs][chuck] Example YAML generation using ksonnet and kubecfg
Signed-off-by: Jesse Hamilton [email protected]

Signed-off-by: Jesse Hamilton [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation Related to project documentation p1-important
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants