Commit Graph

119 Commits

Author SHA1 Message Date
monopole
b9f05dd357 Expose some top level kustomize commands.
The PR exposes some of the top level kustomize commands
(especially `build`) for reuse in other command line tools
(expecially `kubectl`, see #1500).

This PR represents option 3 from the following list of ways
this exposure could be arranged.

1. Expose the commands in the `api` module.

```
REPO/api/go.mod
REPO/api/builtins
REPO/api/commands <- new
REPO/api/...
```

Disadvantage: This would make `api` module depend on cobra.
That's bad for clients that want to depend on the api, but
want to write their own commands at their own version of
cobra.  The `api` module shouldn't depend on UX libraries
like cobra.

2. Expose the commands in their own `commands` module.

They'd appear alongside `api`, e.g. `

```
REPO/api/go.mod
REPO/api/builtins
REPO/api/...
REPO/commands/go.mod
REPO/commands/build
REPO/commands/edit
REPO/commands/...
```

Advantage: The commands would be consumed by the kustomize
binary and the kubectl binary in the same way.

Disadvantage: The kustomize binary module and the commands
module could evolve separately with their own version
numbers, creating confusion.

3. Expose the commands in the existing `kustomize` module

```
REPO/api/go.mod
REPO/api/builtins
REPO/api/...
REPO/kustomize/go.mod
REPO/kustomize/main.go
REPO/kustomize/commands/build
REPO/kustomize/commands/edit
REPO/kustomize/commands/...
```

Outside users, e.g. kubectl, could then

```
import sigs.k8s.io/kustomize/kustomize/v3/commands/build
```

and hopefully still get the `main` package
as they do now via:

```
go get sigs.k8s.io/kustomize/kustomize/v3
```

Advantage: 1) The kustomize binary ships at the same version
as the commands - which makes sense as the binary's
_version_ refers to how the CLI operates (command names,
flags, etc.).  This makes it easy to related the version of
a kustomize binary with the version of commands running in
some other CLI binary.  2) The path to the kustomize binary
doesn't change.

Disadvantage: It's an atypical Go module arrangement.
Usually `main` packages live as leaves under a directory
called `cmd` inside a module, rather than at the _top_ of
the module.  This might cause some problems.  If so, we can
go with option 4.

4. Same as 3, but move `main.go` (the `main` package) down one step.

```
REPO/api/go.mod
REPO/api/builtins
REPO/api/...
REPO/kustomize/go.mod
REPO/kustomize/cmd/main.go
REPO/kustomize/commands/build
REPO/kustomize/commands/edit
REPO/kustomize/commands/...
```
2021-02-04 08:35:01 -08:00
Jeff Regan
25e11e9020 Update install_kustomize.sh 2021-01-26 12:15:20 -08:00
Ma Xinjian
be57e1f6c2 Add support to install kustomize to specified directory
Signed-off-by: Ma Xinjian <maxj.fnst@cn.fujitsu.com>
2021-01-21 15:59:04 +08:00
Jeff Regan
0fb30a1010 In plugin tests, yell FAILURE on failure. 2021-01-15 13:58:09 -08:00
Yuval Kashtan
6442047e52 add curl timeout to install script
This is important to improve reliency of other automations/scripts that are using this script internally. Otherwise install script might stall forever in some cases.
2020-12-15 12:01:15 +02:00
jregan
97e4353755 Update test of examples against new releases. 2020-12-10 12:37:47 -08:00
jregan
125762d94d Pin kustomize to api/v0.6.7 2020-12-09 22:33:02 -08:00
jregan
67db23b24b Start directory for 'untested' plugins. 2020-12-01 07:32:44 -08:00
Donny Xia
8f7bcb9b16 update Go version to 1.15 2020-11-25 12:41:20 -08:00
Donny Xia
7e74271071 fix script name 2020-11-18 12:21:59 -08:00
Donny Xia
260e093547 modify pluginator to add support for krm function 2020-11-18 12:21:59 -08:00
tuti
a45523bb95 dry release_url 2020-11-13 11:25:35 -08:00
tuti
34863346b0 include arch type in grep string 2020-11-13 11:09:56 -08:00
tuti
e3ad472933 allow downloading older releases 2020-11-12 18:19:02 -08:00
tuti
154f894774 fix latest release download failure 2020-11-12 18:17:47 -08:00
tuti
dc31321b05 fix binary install script 2020-10-29 17:51:54 -07:00
Natasha Sarkar
de8e16df15 added script for installing kpt 2020-10-13 17:11:00 -07:00
jregan
0c169e96e5 Replace bash release helper scripts with Go progam 2020-10-08 10:54:14 -07:00
Timo Walter
6a9e75ee0d Improve the "install_kustomize.sh" script
- fix formatting
- remove unnecessary echo statements
2020-09-21 23:09:16 +02:00
Timo Walter
0c5fc5e694 Extend the install_kustomize.sh to enable the installation of specific versions 2020-09-21 15:16:57 +02:00
jregan
1dffc7577b Unpin transformers from kyaml. 2020-08-22 18:38:48 -07:00
Jeff Regan
e9c118fd55 Update readme.md 2020-07-13 12:24:34 -07:00
Donny Xia
6fabfe963e code review 2020-07-13 12:05:03 -07:00
Donny Xia
42e19d610a Improve cleanup 2020-07-08 11:08:19 -07:00
Donny Xia
f6cac7e7e8 Add newline to the end of file 2020-07-06 09:38:31 -07:00
Donny Xia
c2ccfd72ad Update readme 2020-07-01 12:55:38 -07:00
Donny Xia
6d324d70c4 Add benchmark for containerized KRM function in kustomize 2020-07-01 12:47:16 -07:00
Michael Cristina
823847d90a Add tools package, tidy go mods 2020-05-22 13:23:20 -05:00
jregan
8efc528117 Automated fix to hack/go.sum 2020-05-20 08:51:28 -07:00
jregan
ee095371b8 Automated ./hack/doGoMod.sh tidy;verify 2020-05-14 18:50:04 -07:00
jregan
53e7c87604 Adjust scripts to be go v1.14 compatible 2020-04-22 18:34:15 -07:00
jregan
1f35b37712 Check for prow, not travis, in CI test. 2020-04-21 21:09:09 -07:00
jregan
98414e8bf6 Start adding helm3 to ChartInflator and its coverage. 2020-04-21 20:45:19 -07:00
jregan
1653a70693 Plugin loader improvements. 2020-04-18 18:29:10 -07:00
Yujun Zhang
cad69ae415 Exlude golangci-lint v1.24.0 which breaks CI 2020-03-16 18:16:38 +08:00
Karl Gustav
7eca29daee Fix install_kustomize.sh so it works on alpine linux
The install script fails and thinks that alpine linux is in windows. This is because
`$OSTYPE` in alpine linux is linux-musl, not linux-gnu as this script assumes.

I tested these changes with this script:
```

set -euo pipefail

opsys=""
function check {
    opsys=windows
    if [[ "$OSTYPE" == linux* ]]; then
      opsys=linux
    elif [[ "$OSTYPE" == darwin* ]]; then
      opsys=darwin
    fi
}

OSTYPE="linux-gnu"
check
test "$opsys" == "linux" || echo $OSTYPE test failed

OSTYPE="linuxsomething"
check
test "$opsys" == "linux" || echo $OSTYPE test failed

OSTYPE="darwinsomething"
check
test "$opsys" == "darwin" || echo $OSTYPE test failed

OSTYPE="either"
check
test "$opsys" == "windows" || echo $OSTYPE test failed
```

ref: #2146
2020-01-25 22:46:10 +01:00
Phani Teja Marupaka
c340c30f25 Alpha commands e2e tests 2020-01-15 14:17:37 -08:00
Phani Teja Marupaka
1d3c3995ed End to End tests framework 2020-01-13 13:21:39 -08:00
Jeffrey Regan
00f7656f1b Script to ease pinning modules to kustomize api 2020-01-07 16:05:33 -08:00
Jeffrey Regan
400140a401 Tweak Go plugin build script and targets. 2019-12-12 11:06:44 -08:00
bzub
e1b18d125d Add script to detect/build Go plugins. 2019-12-09 17:59:59 -06:00
Jeffrey Regan
04bfb3e94d Tweak install. 2019-12-05 15:17:33 -08:00
Jeffrey Regan
e14c441e77 Kustomize installation script. 2019-12-05 13:50:53 -08:00
Jeffrey Regan
382c330f5b Consolidate test harness to one package. 2019-12-02 12:29:10 -08:00
Jeffrey Regan
ee8598dcbd Unpin all the plugins (non-builtins too). 2019-11-25 08:47:30 -08:00
Jeffrey Regan
416e1fcc1a Unpin the builtin plugins. 2019-11-22 14:08:24 -08:00
Haiyan Meng
f69d2d2e69 Move hack/crawl under api/internal 2019-11-14 13:17:28 -08:00
Jeff Regan
0a84a0d525 Merge pull request #1793 from haiyanmeng/fix-git
Fix two broken deps to allow tests under hack/crawl to pass
2019-11-14 13:04:21 -08:00
Jeffrey Regan
003b3eccc2 Drive kustomize repo verification from make. 2019-11-14 11:31:42 -08:00
Haiyan Meng
df25f3a93a Run go mod tidy to clean up go.sum 2019-11-14 10:16:58 -08:00