164 Commits

Author SHA1 Message Date
Yannis Zarkadas
a502717460 Make ordering configurable (#4019)
* api: Add new types for customizeable resource ordering

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Implement SortOrderTransformer plugin

Implement the SortOrderTransformer plugin. This plugin allows the user
to customize the order that kustomize will output resources in.

The API for the plugin is the following:

sortOptions:
  order: legacy | fifo
  legacySortOptions:
    orderFirst:
    - {GVK}
    orderLast:
    - {GVK}

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Add boilerplate and generate code for new SortOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* build: Add option to denote if the reorder flag was set by the user

We want to take different actions if the reorder flag was set by the
user or filled by the default value. Thus, we propagate this information
from build to the krusty options.

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* api/krusty: Ensure sort ordering works with CLI flag and kustomization

Sort order can be defined in two places:
- (new) kustomization file
- (old) CLI flag
We want the kustomization file to take precedence over the CLI flag.

Eventually, we may want to move away from having a CLI flag altogether:
https://github.com/kubernetes-sigs/kustomize/issues/3947

Case 1: Sort order set in kustomization file AND in CLI flag.
Print a warning and let the kustomization file take precedence.

Case 2: Sort order set in CLI flag only or not at all.
Follow the CLI flag (defaults to legacy) and reorder at the end.

Case 3: Sort order set in kustomization file only.
Simply build the kustomization.

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* krusty: Add e2e test for SortOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>

* plugins: Purge LegacyOrderTransformer

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* Update go.work.sum

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

* review: Make review changes

Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>

Signed-off-by: Yannis Zarkadas <yanniszark@arrikto.com>
Signed-off-by: Yannis Zarkadas <yanniszark@gmail.com>
2022-12-02 13:59:53 -08:00
Claus F. Strasburger
adce67301b install_kustomize: support linux/aarch64, with fallback to old behavior (#4619)
* install_kustomize: support linux/aarch64, with fallback to old behavior

* shellcheck

* Comments from first review

* Comments from review

* Review comments: message consistency
2022-11-24 10:20:04 -08:00
Alex Vulaj
a3a3140e4c Update hack/install_kustomize.sh
update error message to be more descriptive

Co-authored-by: Natasha Sarkar <natashasarkar@google.com>
2022-07-27 14:30:07 -04:00
Alex Vulaj
d244c8a8bb Update error message for m1 mac users trying to fetch older versions 2022-07-27 13:54:04 -04:00
Katrina Verey
29104d6fa9 Ignore XML in license header script 2022-04-05 15:03:13 -04:00
Katrina Verey
03c94eabb7 Base makefile and root makefile target for functions/examples 2022-04-05 14:37:18 -04:00
Katrina Verey
2d4bce5112 Do not run ineffective targets, do run all module tests 2022-04-04 18:13:00 -04:00
Katrina Verey
46875b6ac4 More makefile cleanup 2022-04-04 16:46:41 -04:00
Katrina Verey
0fa010c7e7 Add missing boilerplate 2022-04-04 14:24:04 -04:00
Katrina Verey
3e652d6fea Add helpful error message to license check 2022-04-04 14:22:24 -04:00
Katrina Verey
08924dc2f5 Fix root var and add sanity check 2022-04-04 14:03:29 -04:00
Katrina Verey
877d72b10b Run license check in CI 2022-04-01 17:42:59 -04:00
Katrina Verey
0d32543ebd Makefiles for all modules 2022-04-01 17:31:34 -04:00
Katrina Verey
2a9adbeb1e Makefile cleanup 2022-03-31 19:02:19 -04:00
Katrina Verey
5c359bda28 Go 1.18 compatibility updates 2022-03-30 17:57:48 -04:00
David Jacob
c64351aa01 Exclude site directory from go.mod search 2022-03-09 18:03:04 +01:00
Katrina Verey
975482390f Remove more links to defunct site 2022-03-02 14:04:17 -05:00
John Matthews
4f5dfb5d42 Updating with 'uname -m' 2022-02-05 09:02:28 -05:00
John Matthews
91f65b3441 Install arch appropriate build if the 'arch' command is present 2022-01-29 11:17:48 -05:00
Julian
3dbc88bf94 Refactor the PrefixSuffixTransformer into separate prefix- and suffix transformers (#4318)
* Refactor prefix filter into its own filter, decoupled from the prefixsuffix filter

* Refactor prefix transformer into its own transformer, decoupled from the prefixsuffix transformer

* Refactor suffix filter into its own filter, decoupled from the prefixsuffix filter

* Refactor suffix transformer into its own transformer, decoupled from the prefixsuffix transformer

* Add a default nameSuffix field spec in addition to the namePrefix

* Remove the PrefixSuffixTransformer from the list of builtin transformers

* Add a multi-transformer to builtinhelpers.TransformFactories

* Remove the implementation of the prefixsuffixtransformer.PrefixSuffixTransformer

* Resolve style and format related feedback from the pull request

* Add test to test the legacy PrefixSuffixTransformer for BC purposes
2021-12-22 12:01:06 -08:00
natasha41575
26999664e6 remove multi-module check 2021-12-15 11:06:38 -08:00
Osher De Paz
f7cd553044 return a meaningful message if we hit the rate-limiter of GitHub 2021-08-31 23:26:49 +03:00
Andrew Butcher
ec069e4f19 Unset CDPATH to restore default cd behavior. 2021-07-21 11:38:44 -04:00
Petr Studeny
ab9b010856 fix: Allow custom MYGOBIN in mdrip invokations 2021-07-13 14:34:50 +02:00
monopole
8f82c4c748 Don't run helm inflator test against released version. 2021-06-07 12:26:12 -07:00
monopole
172adc404f Consolidate scripts into k8s-traditional hack dir. 2021-05-24 17:09:11 -07:00
monopole
f618f9ce96 Fix makefile install-tools for Go 1.16 2021-05-20 10:54:13 -07:00
monopole
a4f4945455 Run e2e tests against 4.1.2 2021-05-02 13:01:24 -07:00
monopole
240cda089a Add flag --enable-helm 2021-04-12 13:40:21 -07:00
monopole
aa5b4814d6 upgrade to helm 3.5.4 and imdario/mergo v0.3.12 2021-04-09 15:05:41 -07:00
Kubernetes Prow Robot
a9bcf7187a Merge pull request #3558 from zhijianli88/GOBIN
Makefile: check and use GOBIN environment variable first
2021-03-31 10:01:01 -07:00
Simon Behar
6dd50de7a4 Use portable method to emulate 'readlink -f' behavior
Signed-off-by: Simon Behar <simbeh7@gmail.com>
2021-03-08 09:27:38 -08:00
Jeff Regan
c036830c70 Merge pull request #3676 from rhtenhove/master
allow most recent release with specific path
2021-03-07 12:47:28 -08:00
Ruben ten Hove
ebbd0c7b5a check if version exists 2021-03-06 13:55:39 +01:00
monopole
60c8a0498b Full tree go mod tidy. 2021-03-05 18:22:32 -08:00
Ruben ten Hove
216ab488a6 allow most recent release with specific path 2021-03-04 17:19:39 +01:00
Natasha Sarkar
e9c97a4c4e updated go version to 1.16 2021-03-02 16:40:08 -08:00
monopole
cd2b0fce7e Remove tool deps from shippable modules. 2021-02-24 17:37:16 -08:00
Jeff Regan
c9e7f627fe Update makeKubectlPr.sh 2021-02-13 15:29:39 -08:00
monopole
c7a504c9cf Add 4.0.1 to example tests and unpin. 2021-02-13 13:51:59 -08:00
Jeff Regan
ba0baa828c Merge pull request #3600 from natasha41575/TestExamplesAgainst4.0
Test examples against 4.0
2021-02-13 12:47:30 -08:00
Jeff Regan
8cf7bc67bb Create makeKubectlPr.sh 2021-02-13 07:26:13 -08:00
Natasha Sarkar
48d6af6e38 test examples against kustomize 4.0 2021-02-12 17:08:45 -08:00
Li Zhijian
054f18701a Makefile/scripts: check and use GOBIN environment variable first
'go get/install' will install binaries into GOBIN when it's set which is not
always same with GOPATH/bin

Fix below error:
$ hack/testExamplesAgainstKustomize.sh HEAD
Installing kustomize HEAD
On linux, and not on remote CI.  Running expensive tests.
make: Nothing to be done for '/home/lizj/gosrc/bin/helm'.
Removing kustomize HEAD
rm: cannot remove '/home/lizj/gosrc/bin/kustomize': No such file or directory

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
2021-02-10 14:06:00 +08:00
monopole
dc25a6a1ce Fix #3571 with a -V 2021-02-09 16:28:31 -08:00
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