-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Initial commit for a tutorial on getting started with kustomize #4516
Initial commit for a tutorial on getting started with kustomize #4516
Conversation
Hi @rob8714. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really clear and a good basic introduction, nice work! :)
I left a few comments, most of the minor things and some discussion on maybe how to consistently style some of this stuff going forward.
EOF | ||
``` | ||
|
||
The `kustomization.yaml` files in the overlays are just including the `base` folder, so if you were to run `kustomize build` on the overlay folders at this point you would get the same output we got when we built `base`. The directory structure you created so far should look like this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to point out that the the tutorial never explicitly gives the command for building the Staging
and Production
variants. While it might be obvious to a lot of people what command to run, it's probably best to include them both as some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, I have added this in the build code blocks
We can achieve the names required by making use of `namePrefix` and `nameSuffix` as follows: | ||
|
||
|
||
_Production overlay kustomization.yaml_: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A style I like in these tutorials is including the name of the file as a comment on top of the content. So in this case you'd have # overlays/production/kustomization.yaml
instead of the "Production overlay kustomization.yaml" bit. Makes everything nice and explicit, the layout looks better and things are still simple to copy-paste without editing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the suggestion, have updated this as well. It would be nice if there could be a way to make this comment be an actual title for the code block, but haven't figured out if there's a way to do it or if it is possible yet
|Replicas |3 |2 | | ||
|
||
|
||
We can achieve the names required by making use of `namePrefix` and `nameSuffix` as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an actual name for things like namePrefix
, nameSuffix
, namespace
, etc as we define in a kustomization.yaml
file? Directives, commands, something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I avoided using a name to refer to these because I was unsure if they had one... @natasha41575 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an actual name for things like namePrefix, nameSuffix, namespace, etc as we define in a kustomization.yaml file? Directives, commands, something else?
I usually call them "fields in the kustomization file", "kustomization fields", etc. We can define a name for them if you'd like. I like the sound of directives, idk if there is a standard for these kinds of things already.
Maybe a Definitions section somewhere near the top of the doc? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw in some of the docs that they are referred to as fields in some cases and I like the sound of directives for these more than fields, but thinking more about it maybe we have to be a bit careful about introducing new terms since they can also be referred to as transformers? Or define that directives and transformers may be used interchangeably?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My two cents: They can be "fields" when you're talking about the literal key you put into a Kustomization file, "transformers" when you're talking about the code that drives their functionality, or maybe "features" when you're being really abstract. "Directives" is already a (somewhat obscure) feature in this space: patch directives.
--- | ||
|
||
We're going to use kustomize to deploy an nginx instance into our Kubernetes cluster. | ||
This page is intended to help you get started with using this amazing tool called kustomize! We will start off with creating a simple nginx deployment manifest and then use it as an example to explore kustomize basics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a style guide on how we want to write the word kustomize consistently?
- Kustomize?
- kustomize?
kustomize
?
I'm a fan of the last one but things can be a bit cluttered sometimes when you have too many words in backticks flying around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the second one, the word kustomize will be used a lot and back ticking every single one will start to decrease its emphasis and/or may get annoying to look at.
@rob8714: This PR has multiple commits, and the default merge method is: merge. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Co-authored-by: David Jacob <[email protected]>
Co-authored-by: David Jacob <[email protected]>
Thanks for the review @DavidJacob! I did some changes based on your suggestions |
/ok-to-test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great! I have some comments regarding the wording. I may do another pass at some point, but I think this is an excellent start. Thank you so much for doing this.
--- | ||
|
||
We're going to use kustomize to deploy an nginx instance into our Kubernetes cluster. | ||
This page is intended to help you get started with using this amazing tool called kustomize! We will start off with creating a simple nginx deployment manifest and then use it as an example to explore kustomize basics. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the second one, the word kustomize will be used a lot and back ticking every single one will start to decrease its emphasis and/or may get annoying to look at.
|Replicas |3 |2 | | ||
|
||
|
||
We can achieve the names required by making use of `namePrefix` and `nameSuffix` as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an actual name for things like namePrefix, nameSuffix, namespace, etc as we define in a kustomization.yaml file? Directives, commands, something else?
I usually call them "fields in the kustomization file", "kustomization fields", etc. We can define a name for them if you'd like. I like the sound of directives, idk if there is a standard for these kinds of things already.
Maybe a Definitions section somewhere near the top of the doc? WDYT?
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
Co-authored-by: Natasha Sarkar <[email protected]>
|Replicas |3 |2 | | ||
|
||
|
||
We can achieve the names required by making use of `namePrefix` and `nameSuffix` as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My two cents: They can be "fields" when you're talking about the literal key you put into a Kustomization file, "transformers" when you're talking about the code that drives their functionality, or maybe "features" when you're being really abstract. "Directives" is already a (somewhat obscure) feature in this space: patch directives.
```bash | ||
mkdir -p kustomize-example-2/base kustomize-example-2/overlays/staging kustomize-example-2/overlays/production | ||
cd kustomize-example-2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you feel strongly about restarting from scratch as of this step, vs. moving the existing files they've made into a new subdir? As it is this makes me wonder if it should be a second tutorial, since it is independent of what they've done so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I started from scratch to avoid having to make them undo changes and keep the name short, can think of how to update later this week
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KnVerey consolidated the example into one folder structure
Co-authored-by: Katrina Verey <[email protected]>
Co-authored-by: Katrina Verey <[email protected]>
nameSuffix: -staging | ||
|
||
namespace: staging | ||
|
||
replicas: | ||
- name: nginx | ||
- name: example-nginx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@natasha41575 @KnVerey putting just nginx
works here even though we are updating a resource coming from the base, is this expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, under the hood, the name reference transformer keeps track of all the names objects have had throughout the build, and as long as there's no ambiguity, it will successfully resolve the names either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
nameSuffix: -staging | ||
|
||
namespace: staging | ||
|
||
replicas: | ||
- name: nginx | ||
- name: example-nginx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, under the hood, the name reference transformer keeps track of all the names objects have had throughout the build, and as long as there's no ambiguity, it will successfully resolve the names either way.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey, rob8714 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…rnetes-sigs#4516) * Initial commit for a tutorial on getting started with kustomize * add build commands and update comment with name of the file * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: David Jacob <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: David Jacob <[email protected]> * fix typo * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Natasha Sarkar <[email protected]> * updates following review * updates to getting started guide * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Katrina Verey <[email protected]> * Update site/content/en/docs/Getting started/first_kustomization.md Co-authored-by: Katrina Verey <[email protected]> * updates to consolidate example into one folder Co-authored-by: David Jacob <[email protected]> Co-authored-by: Natasha Sarkar <[email protected]> Co-authored-by: Katrina Verey <[email protected]>
/assign |
An initial commit to tackle #3973
cc @KnVerey @natasha41575 @DavidJacob