-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update Kustomization integration KEP #698
Conversation
pwittrock
commented
Jan 18, 2019
- Split into 2 parts
- Add subcommand
- New kep for integration into file handling
- add more background and context. - revisit specifics of UX. - provide justification for not using plugins. - add more alternatives considered.
/assign @soltysh |
@pwittrock: GitHub didn't allow me to assign the following users: Liujingfang1. Note that only kubernetes members and repo collaborators can be assigned and that issues/PRs can only have 10 assignees at the same time. In response to this:
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. |
|
||
## Summary | ||
|
||
This is a follow up to [KEP-0031](https://github.com/kubernetes/enhancements/blob/master/keps/sig-cli/0031-kustomize.md) |
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 PR is removing that file.
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.
Updated
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.
Please remove any references to NEXT_KEP_NUMBER
and rename the KEP to just be the draft date and KEP title.
KEP numbers will be obsolete once #703 merges.
23d3fe4
to
f2d6e2a
Compare
@justaugustus That is great news. Updated. |
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 left you a few nits here and there, but overall this lgtm.
Thank you 🥇
Kubectl commands taking the common flags (`-f`, `--filename`, `-R`, `--recursive`) will support `kustomization.yaml` | ||
files. | ||
|
||
Cli-runtime will add the flags `-k, --kustomize=[]`, which will be registered along side the other file processing |
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.
Quick question, I assume -k
and -f
will be exclusive? If so, maybe it's worth adding that here.
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.
Hm. Good question. We could start that way and open it up in the future.
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.
Yeah, exclusive seems the best to start with, it'll leave us more room for change than the other way around.
|
||
Link to tracking issue: kubernetes/enhancements#633 | ||
|
||
See [KEP FAQ](kep-faq.md) for "why not as as plugin". |
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.
and Why should this be part of kubectl?
section too.
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.
Done
|
||
Kustomize Standalone Sub Command | ||
|
||
Publish the `kustomize build` command as `kubectl kustomize`. Update documentation demonstrate using kustomize as |
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.
to demonstrate
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.
Done
Publish the `kustomize build` command as `kubectl kustomize`. Update documentation demonstrate using kustomize as | ||
`kubectl kustomize <dir> | kubectl apply -f -`. | ||
|
||
`kubectl kustomize` takes a single argument with is the location of a directory containing a file named `Kustomization` |
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.
file named 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.
@monopole WDYT of changing the file name pre-integration (we could still recognize the old one, but not advertise it)? This follows the pattern of Makefile
and Dockerfile
.
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.
FWIW, We went with .yaml
(and, alas, .yml
) because emacs and vi both still use the legacy extension as a pretty reliable edit model signal. I just tried it without the extension, and my stock emacs and vim installs failed to do the Right Thing based on content detection.
Makefile
, being a unique text formatting class with one instantiation, doesn't suffer from this problem (emacs/vi do the Right Thing). Dockerfile
detection hasn't made it into my stock emacs install yet :)
I'm for allowing all of them ( Kustomization
, kustomization.yaml
, kustomization.yml
) pre-integration, erroring if none or more than one found (no ambiguity).
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.
Have we actually considered abandoning the brand name Kustomization and actually call it customization.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.
Yes we have.
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.
keeping this 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.
Honestly, since we're introducing -k
flag which is meant to point to kustomization.yaml
I think we can safely assume that any name is supported, right? Or did I miss something? Eventually we should make this more clearer in description of the flag, if so. But I remember from the discussion we've had during KubeCon we wanted to explicitly point to the file to run kustomization, unless the fact that we're using -k/--kustomize
allows users to pass file OR the directory containing the file. In which case there are two possibilities:
- if I pass file name to
-k
the name doesn't matter, only the kind specified in file must beKustomization
. - if I pass directory we can search for
kustomization.yaml
or just look for a file withKustomization
kind.
So actually the name doesn't matter. Other thoughts?
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'd expect -k to take a directory, and look for the kustomization file the same way we look for the file when processing a base referenced from another file. For these directories to be composable, they will need to use kustomize filenames findable via base reference, anyway.
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.
That's a reasonable argument for -k
accepting a dir.
`kubectl kustomize` takes a single argument with is the location of a directory containing a file named `Kustomization` | ||
and writes to stdout the kustomized Resource Config. | ||
|
||
If the directory does not contain a `Kustomization` file, it returns an error. |
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.
kustomize.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.
Done
|
||
## Kustomize Example | ||
|
||
Following is an example of a kustomization.yaml file used by kustomize: |
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.
Put kustomization.yaml
into back-quotes.
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.
Done
Following is an example of a kustomization.yaml file used by kustomize: | ||
|
||
``` | ||
apiVersion: v1beta1 |
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.
👍
|
||
## Graduation Criteria | ||
|
||
The API version for kustomize is defined in the kustomization.yaml file. The KEP is targeted `v1beta1`. |
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.
Back-quote kustomization.yaml
The API version for kustomize is defined in the kustomization.yaml file. The KEP is targeted `v1beta1`. | ||
|
||
The criteria for graduating from `v1beta1` for the kustomize sub-command should be determined as part of | ||
evaluating the success and maturity of kustomize as a command within kubectl. |
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.
👍
Most implementation will be in cli-runtime | ||
|
||
- [ ] vendor `kustomize/pkg` into kubernetes | ||
- [ ] copy `kustomize/k8sdeps` into cli-runtime |
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.
Yeah, at the end of the day I'm hoping that cli-runtime
will contain the core of kustomize, but everything above (commands, etc) should exist outside cli-runtime
. Maybe worth putting that here.
## Summary | ||
|
||
[Kustomize](https://github.com/kubernetes-sigs/kustomize) | ||
was developed as a subproject of sig-cli by kubectl maintainers with the goal of addressing |
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.
s/with the goal of addressing/to address/
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.
Done
|
||
[Kustomize](https://github.com/kubernetes-sigs/kustomize) | ||
was developed as a subproject of sig-cli by kubectl maintainers with the goal of addressing | ||
a collection of issues (See [motivation](#motivation)) creating friction for declarative workflows in kubectl |
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.
issues
can link to #motivation
- can drop the (See ...)
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.
Done
It is independent of, but complementary to, the [*server-side apply*](https://github.com/kubernetes/enhancements/issues/555) | ||
initiative that was started later and targeted at a separate collection of `kubectl apply` issues. | ||
|
||
**Note:** |
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 paragraph (the "Note") and the next offer more details on the purpose / history of kustomize,
Trying to rephrase without the "Note":
Kustomize offers generators and transformations in a declarative form that improve
on functionality provided by existing imperative commands in kubectl.The declarative approach offers a clear path to accountability (all input can be kept
in version control), can safely exploit a holistic, unbounded view of disparate resources
and their interdependence (it's a plan about what to do, not a direct action), and
can be easily constrained to verifiable rules across this view (all edits must be
structured, no removal semantics, no environment side-effects, etc.).Imperative kubectl commands / flags available through kustomize:
....
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.
Done
- updating Resources from Resource Config without wiping out control-plane defined fields (e.g. Service clusterIp) | ||
- automatically deciding whether to create, update or delete Resources | ||
|
||
**Motivation:** |
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.
heading repeated
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.
Done
@@ -0,0 +1,101 @@ | |||
--- | |||
title: Integrate Kustomize into cli-runtime |
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.
minor point: This KEP has three titles - this one (in the table), the file name, and the text after the first #
. Let's pick one.
more importantly - We've discussed -f
vs -k
/ visitation at length, and my views/concerns are missing here or perhaps just not expressed as I'd express them.
We want declarative features delivered as part of kubectl, and have established that the quickest way to do so is via adding a new subcommand (the other KEP), and deferring debate about -f
and its baggage.
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.
Done
If the directory does not contain a `Kustomization` file, it returns an error. | ||
|
||
Defer deeper integration into ResourceBuilder (e.g. `kubectl apply -k <dir>`) as a follow up after discussing | ||
the precise UX and technical tradeoffs. (i.e. deeper integration is more delicate and can be done independently.) |
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 enough about -f / -k for this PR
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.
Ack
literals: | ||
- JAVA_HOME=/opt/java/jdk | ||
- JAVA_TOOL_OPTIONS=-agentlib:hprof | ||
|
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.
The indentation is off for literals
.
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.
Done
- name: app-sec | ||
commands: | ||
username: "echo admin" | ||
password: "echo secret" |
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.
The indentation is off for commands
.
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.
Done
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: monopole, pwittrock 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 |