mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-30 18:01:21 +00:00
Add example for kustomize build {url}
This commit is contained in:
@@ -34,15 +34,29 @@ type buildOptions struct {
|
||||
outputPath string
|
||||
}
|
||||
|
||||
var examples = `
|
||||
Use the file somedir/kustomization.yaml to generate a set of api resources:
|
||||
build somedir
|
||||
|
||||
Use a url pointing to a remote directory/kustomization.yaml to generate a set of api resources:
|
||||
build url
|
||||
The url should follow hashicorp/go-getter URL format described in
|
||||
https://github.com/hashicorp/go-getter#url-format
|
||||
|
||||
url examples:
|
||||
github.com/kubernetes-sigs/kustomize//examples/multibases?ref=v1.0.6
|
||||
github.com/Liujingfang1/mysql
|
||||
github.com/Liujingfang1/kustomize//examples/helloWorld?ref=repoUrl2
|
||||
`
|
||||
|
||||
// newCmdBuild creates a new build command.
|
||||
func newCmdBuild(out io.Writer, fs fs.FileSystem) *cobra.Command {
|
||||
var o buildOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "build [path]",
|
||||
Short: "Print current configuration per contents of " + constants.KustomizationFileName,
|
||||
Example: "Use the file somedir/" + constants.KustomizationFileName +
|
||||
" to generate a set of api resources:\nbuild somedir/",
|
||||
Use: "build [path]",
|
||||
Short: "Print current configuration per contents of " + constants.KustomizationFileName,
|
||||
Example: examples,
|
||||
SilenceUsage: true,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := o.Validate(args)
|
||||
|
||||
@@ -35,23 +35,22 @@ type Kustomization struct {
|
||||
// Annotations to add to all objects.
|
||||
CommonAnnotations map[string]string `json:"commonAnnotations,omitempty" yaml:"commonAnnotations,omitempty"`
|
||||
|
||||
// Each entry should be either a path to a file with a name matching the value of
|
||||
// constants.KustomizationFileName, or a path to a directory containing a file with that name.
|
||||
// Each entry should be either a path to a directory containing kustomization.yaml
|
||||
// Or a repo URL pointing to a remote directory containing kustomization.yaml
|
||||
// The repo URL should follow hashicorp/go-getter URL format
|
||||
// https://github.com/hashicorp/go-getter#url-format
|
||||
Bases []string `json:"bases,omitempty" yaml:"bases,omitempty"`
|
||||
|
||||
// Resources specifies the relative paths within the package.
|
||||
// It could be any format that kubectl -f allows, i.e. files, directories,
|
||||
// URLs and globs.
|
||||
// Resources specifies the relative paths for resource files within the package.
|
||||
// URLs and globs are not supported
|
||||
Resources []string `json:"resources,omitempty" yaml:"resources,omitempty"`
|
||||
|
||||
// Crds specifies relative paths to custom resource definition files.
|
||||
Crds []string `json:"crds,omitempty" yaml:"crds,omitempty"`
|
||||
|
||||
// An Patch entry is very similar to an Resource entry.
|
||||
// It specifies the relative paths within the package, and could be any
|
||||
// format that kubectl -f allows.
|
||||
// It should be able to be merged by Strategic Merge Patch on top of its
|
||||
// corresponding base resource.
|
||||
// It specifies the relative paths for patch files within the package.
|
||||
// URLs and globs are not supported
|
||||
Patches []string `json:"patches,omitempty" yaml:"patches,omitempty"`
|
||||
|
||||
// List of configmaps to generate from configuration sources.
|
||||
|
||||
Reference in New Issue
Block a user