Compare commits

...

69 Commits

Author SHA1 Message Date
Katrina Verey
efe1374940 Merge pull request #5089 from KnVerey/pinToCmdConfig
Update cmd/config to v0.11.1
2023-03-13 20:49:50 -04:00
Katrina Verey
b751ffe5a0 Update cmd/config to v0.11.1 2023-03-13 20:27:40 -04:00
Katrina Verey
28a2a01c29 Merge pull request #5088 from KnVerey/pinToKyaml
Update kyaml to v0.14.1
2023-03-13 19:45:23 -04:00
Katrina Verey
0c650423ed Update kyaml to v0.14.1 2023-03-13 19:24:20 -04:00
Katrina Verey
4ffc861854 Merge pull request #5087 from KnVerey/prerelease_update
Changes from local test run
2023-03-13 19:11:00 -04:00
Katrina Verey
8338873e56 Changes from local test run 2023-03-13 18:40:16 -04:00
Katrina Verey
dd520f8889 Revert strict decoding of Kustomization due to regression in anchor handling (#5073)
* Revert strict decoding of Kustomization due to regression in anchor handling

* Empty commit
2023-03-13 13:46:47 -07:00
Kubernetes Prow Robot
bf6e6ad33b Merge pull request #5085 from koba1t/chore/update_golangci_to_1.51.2
update golangci-lint to v1.51.2
2023-03-10 14:28:39 -08:00
koba1t
e1094da3cf skip unrelevant lint 2023-03-11 05:11:47 +09:00
koba1t
7d150ce973 Revert "use enable-all on golangci-lint"
This reverts commit 39264a7057.
2023-03-11 05:08:25 +09:00
koba1t
39264a7057 use enable-all on golangci-lint 2023-03-09 05:25:19 +09:00
koba1t
736e166168 update golangci-lint to 1.51.2 2023-03-09 05:08:25 +09:00
Kubernetes Prow Robot
e8b521e3ab Merge pull request #5053 from kubernetes-sigs/dependabot/go_modules/functions/examples/application-cr/image/golang.org/x/net-0.7.0
Bump golang.org/x/net from 0.4.0 to 0.7.0 in /functions/examples/application-cr/image
2023-02-28 11:33:16 -08:00
dependabot[bot]
a4954d386a Bump golang.org/x/net in /functions/examples/application-cr/image
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.4.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.4.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 18:17:11 +00:00
Kubernetes Prow Robot
976193ce70 Merge pull request #5054 from kubernetes-sigs/dependabot/go_modules/cmd/depprobcheck/golang.org/x/net-0.7.0
Bump golang.org/x/net from 0.4.0 to 0.7.0 in /cmd/depprobcheck
2023-02-27 10:08:39 -08:00
dependabot[bot]
ee0b26601b Bump golang.org/x/net from 0.4.0 to 0.7.0 in /cmd/depprobcheck
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.4.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.4.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-27 16:35:34 +00:00
Kubernetes Prow Robot
78e310231e Merge pull request #5065 from kubernetes-sigs/dependabot/go_modules/cmd/depprobcheck/golang.org/x/crypto-0.1.0
Bump golang.org/x/crypto from 0.0.0-20210921155107-089bfa567519 to 0.1.0 in /cmd/depprobcheck
2023-02-27 08:34:38 -08:00
Kubernetes Prow Robot
ffa554b371 Merge pull request #5064 from kubernetes-sigs/dependabot/go_modules/functions/examples/application-cr/image/golang.org/x/crypto-0.1.0
Bump golang.org/x/crypto from 0.0.0-20210921155107-089bfa567519 to 0.1.0 in /functions/examples/application-cr/image
2023-02-27 08:26:39 -08:00
dependabot[bot]
68a0fc95da Bump golang.org/x/crypto in /cmd/depprobcheck
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210921155107-089bfa567519 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-25 03:30:10 +00:00
dependabot[bot]
9b43e76947 Bump golang.org/x/crypto in /functions/examples/application-cr/image
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20210921155107-089bfa567519 to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-25 00:50:47 +00:00
Kubernetes Prow Robot
adf760e246 Merge pull request #5058 from ephesused/optimize-gvk-version
perf: optimize Gvk.ApiVersion()
2023-02-21 11:57:56 -08:00
Kubernetes Prow Robot
7a89df8350 Merge pull request #5048 from cailynse/issue-5039
Remove Log Assignment to Stdout
2023-02-21 11:23:56 -08:00
Ed Overton
93d7511b38 perf: optimize Gvk.ApiVersion()
Convert Gvk.ApiVersion() from using strings.Builder to raw string
concatenation. The logic in Gvk.ApiVersion() is simple enough that
raw concatenation executes quicker and consumes less memory.
2023-02-21 11:02:57 -05:00
Cailyn Edwards
7c33fe30b7 Remove Log Assignment to Stdout 2023-02-21 10:53:22 -05:00
Kubernetes Prow Robot
22dbd3eb17 Merge pull request #5038 from KnVerey/unpin-modules
Update all modules to latest releases, but unpinned
2023-02-08 11:08:44 -08:00
Katrina Verey
51e2714408 Back to development mode; unpin the modules 2023-02-07 19:56:39 -05:00
Katrina Verey
d825beff27 Update all modules to latest releases 2023-02-07 19:56:11 -05:00
Katrina Verey
aa4eb59bb0 Fix constant reference in instructions 2023-02-07 19:54:58 -05:00
Katrina Verey
00d450cce7 Revert plugin exclusion to name sanity check 2023-02-07 19:47:21 -05:00
Kubernetes Prow Robot
a090ceac6c Merge pull request #5026 from KnVerey/update_releasing_instr
Update releasing workflow
2023-02-07 13:14:58 -08:00
Katrina Verey
63c37b1780 Update releasing/README.md
Co-authored-by: Cailyn <cailyn.s.e@gmail.com>
2023-02-06 16:49:19 -05:00
Kubernetes Prow Robot
0fd385d719 Merge pull request #4946 from researchapps/add/github-token-install
add GitHub token to install_kustomize.sh
2023-02-02 13:58:42 -08:00
Katrina Verey
57d8583887 Fix lint errors 2023-02-02 14:25:20 -05:00
Katrina Verey
9c116e9031 Bespoke mod edits no longer needed if gorepomod pins all modules 2023-02-02 14:23:23 -05:00
Katrina Verey
e6c16a6ddc Restore previous test-go-mod and commit changes 2023-02-02 14:20:13 -05:00
Katrina Verey
03669a1804 Improve error message and fix typo in iampolicygenerator module name 2023-02-02 14:15:40 -05:00
vsoch
3c44db8746 add GitHub token to install_kustomize.sh
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
2023-02-02 12:08:20 -07:00
Katrina Verey
9a1a203b52 Update example targets 2023-02-02 12:28:37 -05:00
Katrina Verey
8b51c295a1 Allow gorepomod to update plugin mod files 2023-02-02 11:33:46 -05:00
Kubernetes Prow Robot
738ca56ccd Merge pull request #5027 from KnVerey/remove-replaces
Remove leftover replace statements
2023-02-02 08:32:41 -08:00
Katrina Verey
f901b4a5fd Remove leftover replace statements 2023-02-02 11:23:00 -05:00
Katrina Verey
4fff8399ea Update releasing instructions 2023-02-02 11:22:00 -05:00
Katrina Verey
e532d6f1a1 Merge pull request #5025 from KnVerey/pinToApi
Update api to v0.13.1
2023-02-02 10:58:41 -05:00
Katrina Verey
db2a3800ed Update api to v0.13.1 2023-02-02 10:45:39 -05:00
Kubernetes Prow Robot
183928e6ba Merge pull request #5023 from KnVerey/issue4998
Fix regression with scp-style urls with only one path element
2023-02-01 23:41:29 -08:00
Katrina Verey
c0e2030905 Fix regression with scp-style urls with only one path element 2023-02-01 22:19:40 -05:00
Kubernetes Prow Robot
87c428e7cd Merge pull request #5021 from KnVerey/module_version_v5
Bump kustomize module to v5
2023-02-01 17:03:29 -08:00
Katrina Verey
f5ad795995 Bump kustomize module to v5 2023-02-01 19:01:08 -05:00
Kubernetes Prow Robot
f851cc7181 Merge pull request #5020 from KnVerey/pinToCmdConfig
Pin to cmd config
2023-02-01 14:39:36 -08:00
Katrina Verey
7e3ad53890 Allow cloud build to authenticate to gh when generating changelog 2023-02-01 17:25:57 -05:00
Katrina Verey
5cdc080406 Update cmd/config to v0.11.0 2023-02-01 17:22:46 -05:00
Katrina Verey
10fb04cdf2 Merge pull request #5019 from KnVerey/pinToKyaml
Update kyaml to v0.14.0
2023-02-01 17:09:20 -05:00
Katrina Verey
ea8fc77f2f Update kyaml in the secondary modules 2023-02-01 16:55:56 -05:00
Katrina Verey
e9507c940d Update kyaml to v0.14.0 2023-02-01 16:44:34 -05:00
Katrina Verey
bea105d793 Merge pull request #5017 from KnVerey/fix-changelog-unauthed
Don't have empty string when no auth info
2023-02-01 16:30:39 -05:00
Katrina Verey
e4d7eaa479 Don't have empty string when no auth info 2023-02-01 16:28:20 -05:00
Kubernetes Prow Robot
85949329b8 Merge pull request #5015 from KnVerey/changelog-auth
Allow authenticated Github use in changelog script and improve error messages
2023-02-01 12:59:36 -08:00
Katrina Verey
0c34cf4192 Allow authenticated Github use in changelog script and improve error messages 2023-02-01 15:39:38 -05:00
Cailyn
95edcc0681 Update Versioning to Improve Output (#5000)
* Update Versioning to Improve Output

* Always get commit from build info, always get date and version from ldflag

* Just replace broken main output with semver and deprecate short flag as is

---------

Co-authored-by: Katrina Verey <katrina.verey@shopify.com>
2023-02-01 11:25:37 -08:00
Anna Song
9d8ed39d3d Localize helm additionValuesFiles (#5013) 2023-02-01 10:39:20 -08:00
Natasha Sarkar
1957d5c746 support for more helm template args (#4926)
* support for more helm template args

* move templateArgs and unit tests to api/types

* undo package name change

* use our own simple helm chart instead of forking one

* add argument to AsHelmArgs

* code review

* lint errors
2023-02-01 10:19:05 -08:00
Anna Song
236166097e Add localize command handle (#4959)
* Add localize command handle

* Align to kustomize command conventions

* Print success msg
2023-02-01 08:11:07 -08:00
Kubernetes Prow Robot
3370177b9d Merge pull request #5012 from natasha41575/reponotfileerr
make TestResourcesRepoNotFile even less specific
2023-01-31 11:16:50 -08:00
natasha41575
c8b112c79f make TestResourcesRepoNotFile even less specific 2023-01-31 12:58:55 -06:00
Katrina Verey
d91e31cf18 Run test-go-mod unpinned (#5011)
* Remove go module ci job

* Add script that runs go mod tidy with replace statements

* Invoke one script from the makefile and pass in the command to run in the pinned context

---------

Co-authored-by: Anna Song <annasong@google.com>
2023-01-31 09:56:48 -08:00
Kubernetes Prow Robot
00b0bd8473 Merge pull request #5010 from annasong20/expose-localize-dst
Expose path to `localize` destination
2023-01-30 18:36:48 -08:00
Anna Song
e2aff13587 Expose path to localize destination 2023-01-30 15:42:58 -08:00
Anna Song
361154dabc Localize HelmChartInflationGenerator (#5007)
* Localize HelmChartInflationGenerator

* Add explicit inline generators test
2023-01-30 13:16:48 -08:00
Kubernetes Prow Robot
7db330d2cc Merge pull request #5009 from kubernetes-sigs/no-partial-releases
Warn against partial releases
2023-01-30 13:04:49 -08:00
200 changed files with 1700 additions and 15337 deletions

View File

@@ -93,6 +93,9 @@ linters:
- interfacebloat
- loggercheck
- reassign
- ginkgolinter
- gocheckcompilerdirectives
- musttag
linters-settings:
dupl:
@@ -110,6 +113,7 @@ linters-settings:
gomnd:
ignored-functions:
- os.WriteFile
- make
gomoddirectives:
replace-local: true
gosec:

View File

@@ -3,7 +3,7 @@
#
# Makefile for kustomize CLI and API.
LATEST_V4_RELEASE=v4.5.6
LATEST_RELEASE=v5.0.0
SHELL := /usr/bin/env bash
GOOS = $(shell go env GOOS)
@@ -75,7 +75,8 @@ $(MYGOBIN)/pluginator:
# Build from local source.
$(MYGOBIN)/kustomize: build-kustomize-api
cd kustomize; \
go install .
go install -ldflags "-X sigs.k8s.io/kustomize/api/provenance.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" \
.
kustomize: $(MYGOBIN)/kustomize
@@ -100,7 +101,7 @@ verify-kustomize-repo: \
build-non-plugin-all \
test-go-mod \
test-examples-kustomize-against-HEAD \
test-examples-kustomize-against-v4-release
test-examples-kustomize-against-latest-release
# The following target referenced by a file in
# https://github.com/kubernetes/test-infra/tree/master/config/jobs/kubernetes-sigs/kustomize
@@ -111,7 +112,7 @@ prow-presubmit-check: \
test-go-mod \
build-non-plugin-all \
test-examples-kustomize-against-HEAD \
test-examples-kustomize-against-v4-release
test-examples-kustomize-against-latest-release
.PHONY: license
license: $(MYGOBIN)/addlicense
@@ -152,7 +153,7 @@ functions-examples-all:
done
test-go-mod:
./hack/for-each-module.sh "go list -m -json all > /dev/null && go mod tidy -v"
./hack/for-each-module.sh "go mod tidy -v"
.PHONY:
verify-kustomize-e2e: $(MYGOBIN)/mdrip $(MYGOBIN)/kind
@@ -169,8 +170,8 @@ test-examples-kustomize-against-HEAD: $(MYGOBIN)/kustomize $(MYGOBIN)/mdrip
./hack/testExamplesAgainstKustomize.sh HEAD
.PHONY:
test-examples-kustomize-against-v4-release: $(MYGOBIN)/mdrip
./hack/testExamplesAgainstKustomize.sh v4@$(LATEST_V4_RELEASE)
test-examples-kustomize-against-latest-release: $(MYGOBIN)/mdrip
./hack/testExamplesAgainstKustomize.sh v5@$(LATEST_RELEASE)
# --- Cleanup targets ---

View File

@@ -1,7 +1,7 @@
# Copyright 2022 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
GOLANGCI_LINT_VERSION=v1.50.1
GOLANGCI_LINT_VERSION=v1.51.2
MYGOBIN = $(shell go env GOBIN)
ifeq ($(MYGOBIN),)

View File

@@ -20,6 +20,14 @@ This tool is sponsored by [sig-cli] ([KEP]).
## kubectl integration
To find the kustomize version embedded in recent versions of kubectl, run `kubectl version`:
```sh
> kubectl version --short --client
Client Version: v1.26.0
Kustomize Version: v4.5.7
```
The kustomize build flow at [v2.0.3] was added
to [kubectl v1.14][kubectl announcement]. The kustomize
flow in kubectl remained frozen at v2.0.3 until kubectl v1.21,

View File

@@ -4,10 +4,10 @@
include ../Makefile-modules.mk
test:
go test -v -timeout 45m -cover ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222"
go test -v -timeout 45m -cover ./... -ldflags "-X sigs.k8s.io/kustomize/api/provenance.buildDate=2023-01-31T23:38:41Z -X sigs.k8s.io/kustomize/api/provenance.version=(test)"
build:
go build -ldflags "-X sigs.k8s.io/kustomize/api/provenance.version=v444.333.222" ./...
go build -ldflags "-X sigs.k8s.io/kustomize/api/provenance.buildDate=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")" ./...
generate: $(MYGOBIN)/k8scopy $(MYGOBIN)/stringer
go generate ./...

View File

@@ -10,7 +10,7 @@ require (
github.com/stretchr/testify v1.8.1
gopkg.in/yaml.v2 v2.4.0
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596
sigs.k8s.io/kustomize/kyaml v0.13.9
sigs.k8s.io/kustomize/kyaml v0.14.1
sigs.k8s.io/yaml v1.3.0
)
@@ -28,6 +28,7 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/sys v0.3.0 // indirect

View File

@@ -51,6 +51,7 @@ github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28=
github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
@@ -68,11 +69,13 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
@@ -135,6 +138,7 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
@@ -145,7 +149,7 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596 h1:8cNCQs+WqqnSpZ7y0LMQPKD+RZUHU17VqLPMW3qxnxc=
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
sigs.k8s.io/kustomize/kyaml v0.13.9 h1:Qz53EAaFFANyNgyOEJbT/yoIHygK40/ZcvU3rgry2Tk=
sigs.k8s.io/kustomize/kyaml v0.13.9/go.mod h1:QsRbD0/KcU+wdk0/L0fIp2KLnohkVzs6fQ85/nOXac4=
sigs.k8s.io/kustomize/kyaml v0.14.1 h1:c8iibius7l24G2wVAGZn/Va2wNys03GXLjYVIcFVxKA=
sigs.k8s.io/kustomize/kyaml v0.14.1/go.mod h1:AN1/IpawKilWD7V+YvQwRGUvuUOOWpjsHu6uHwonSF4=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on AnnotationsTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on ConfigMapGenerator; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on HashTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on HelmChartInflationGenerator; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins
@@ -16,6 +16,7 @@ import (
"sigs.k8s.io/kustomize/api/resmap"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kyaml/errors"
"sigs.k8s.io/kustomize/kyaml/kio"
"sigs.k8s.io/yaml"
)
@@ -86,12 +87,20 @@ func (p *HelmChartInflationGeneratorPlugin) validateArgs() (err error) {
p.ChartHome = types.HelmDefaultHome
}
// The ValuesFile may be consulted by the plugin, so it must
// The ValuesFile(s) may be consulted by the plugin, so it must
// be under the loader root (unless root restrictions are
// disabled).
if p.ValuesFile == "" {
p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml")
}
for i, file := range p.AdditionalValuesFiles {
// use Load() to enforce root restrictions
if _, err := p.h.Loader().Load(file); err != nil {
return errors.WrapPrefixf(err, "could not load additionalValuesFile")
}
// the additional values filepaths must be relative to the kust root
p.AdditionalValuesFiles[i] = filepath.Join(p.h.Loader().Root(), file)
}
if err = p.errIfIllegalValuesMerge(); err != nil {
return err
@@ -240,49 +249,28 @@ func (p *HelmChartInflationGeneratorPlugin) Generate() (rm resmap.ResMap, err er
return nil, err
}
var stdout []byte
stdout, err = p.runHelmCommand(p.templateCommand())
stdout, err = p.runHelmCommand(p.AsHelmArgs(p.absChartHome()))
if err != nil {
return nil, err
}
rm, err = p.h.ResmapFactory().NewResMapFromBytes(stdout)
if err == nil {
rm, resMapErr := p.h.ResmapFactory().NewResMapFromBytes(stdout)
if resMapErr == nil {
return rm, nil
}
// try to remove the contents before first "---" because
// helm may produce messages to stdout before it
stdoutStr := string(stdout)
if idx := strings.Index(stdoutStr, "\n---\n"); idx != -1 {
return p.h.ResmapFactory().NewResMapFromBytes([]byte(stdoutStr[idx:]))
}
return nil, err
}
r := &kio.ByteReader{Reader: bytes.NewBufferString(string(stdout)), OmitReaderAnnotations: true}
nodes, err := r.Read()
func (p *HelmChartInflationGeneratorPlugin) templateCommand() []string {
args := []string{"template"}
if p.ReleaseName != "" {
args = append(args, p.ReleaseName)
if len(nodes) != 0 {
rm, err = p.h.ResmapFactory().NewResMapFromRNodeSlice(nodes)
if err != nil {
return nil, fmt.Errorf("could not parse rnode slice into resource map: %w\n", err)
}
return rm, nil
}
if p.Namespace != "" {
args = append(args, "--namespace", p.Namespace)
}
args = append(args, filepath.Join(p.absChartHome(), p.Name))
if p.ValuesFile != "" {
args = append(args, "--values", p.ValuesFile)
}
if p.ReleaseName == "" {
// AFAICT, this doesn't work as intended due to a bug in helm.
// See https://github.com/helm/helm/issues/6019
// I've tried placing the flag before and after the name argument.
args = append(args, "--generate-name")
}
if p.IncludeCRDs {
args = append(args, "--include-crds")
}
if p.SkipHooks {
args = append(args, "--no-hooks")
}
return args
return nil, fmt.Errorf("could not parse bytes into resource map: %w\n", resMapErr)
}
func (p *HelmChartInflationGeneratorPlugin) pullCommand() []string {

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on IAMPolicyGenerator; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on ImageTagTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on LabelTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on NamespaceTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on PatchJson6902Transformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on PatchStrategicMergeTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on PatchTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on PrefixTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on ReplacementTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on ReplicaCountTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on SecretGenerator; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on SortOrderTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on SuffixTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -1,5 +1,5 @@
// Code generated by pluginator on ValueAddTransformer; DO NOT EDIT.
// pluginator {unknown 1970-01-01T00:00:00Z }
// pluginator {(devel) unknown }
package builtins

View File

@@ -370,8 +370,9 @@ func trimPrefixIgnoreCase(s, prefix string) (string, bool) {
func findPathSeparator(hostPath string, acceptSCP bool) int {
sepIndex := strings.Index(hostPath, pathSeparator)
if acceptSCP {
colonIndex := strings.Index(hostPath, ":")
// The colon acts as a delimiter in scp-style ssh URLs only if not prefixed by '/'.
if colonIndex := strings.Index(hostPath, ":"); colonIndex > 0 && colonIndex < sepIndex {
if sepIndex == -1 || (colonIndex > 0 && colonIndex < sepIndex) {
sepIndex = colonIndex
}
}

View File

@@ -659,6 +659,26 @@ func TestNewRepoSpecFromUrl_Smoke(t *testing.T) {
RepoPath: "kubernetes-sigs/kustomize",
},
},
{
name: "scp format gist url",
input: "git@gist.github.com:bc7947cb727d7f9217e7862d961a1ffd.git",
cloneSpec: "git@gist.github.com:bc7947cb727d7f9217e7862d961a1ffd.git",
absPath: notCloned.String(),
repoSpec: RepoSpec{
Host: "git@gist.github.com:",
RepoPath: "bc7947cb727d7f9217e7862d961a1ffd.git",
},
},
{
name: "https gist url",
input: "https://gist.github.com/bc7947cb727d7f9217e7862d961a1ffd.git",
cloneSpec: "https://gist.github.com/bc7947cb727d7f9217e7862d961a1ffd.git",
absPath: notCloned.String(),
repoSpec: RepoSpec{
Host: "https://gist.github.com/",
RepoPath: "bc7947cb727d7f9217e7862d961a1ffd.git",
},
},
}
for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {

View File

@@ -48,6 +48,14 @@ func (lbp *localizeBuiltinPlugins) Filter(plugins []*yaml.RNode) ([]*yaml.RNode,
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.SecretGenerator.String()},
Path: "envs",
},
types.FieldSpec{
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.HelmChartInflationGenerator.String()},
Path: "valuesFile",
},
types.FieldSpec{
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.HelmChartInflationGenerator.String()},
Path: "additionalValuesFiles",
},
types.FieldSpec{
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.PatchTransformer.String()},
Path: "path",
@@ -82,6 +90,24 @@ func (lbp *localizeBuiltinPlugins) Filter(plugins []*yaml.RNode) ([]*yaml.RNode,
return lbp.localizeAll(node)
},
},
yaml.FilterFunc(func(node *yaml.RNode) (*yaml.RNode, error) {
isHelm := node.GetApiVersion() == konfig.BuiltinPluginApiVersion &&
node.GetKind() == builtinhelpers.HelmChartInflationGenerator.String()
if !isHelm {
return node, nil
}
home, err := node.Pipe(yaml.Lookup("chartHome"))
if err != nil {
return nil, errors.Wrap(err)
}
if home == nil {
_, err = lbp.lc.copyChartHomeEntry("")
} else {
lbp.locPathFn = lbp.lc.copyChartHomeEntry
err = lbp.localizeScalar(home)
}
return node, errors.WrapPrefixf(err, "plugin %s", resid.FromRNode(node))
}),
fieldspec.Filter{
FieldSpec: types.FieldSpec{
Gvk: resid.Gvk{Version: konfig.BuiltinPluginApiVersion, Kind: builtinhelpers.PatchStrategicMergeTransformer.String()},
@@ -92,7 +118,6 @@ func (lbp *localizeBuiltinPlugins) Filter(plugins []*yaml.RNode) ([]*yaml.RNode,
return lbp.localizeAll(node)
},
})
// TODO(annasong): localize HelmChartInflationGenerator
if err != nil {
return nil, errors.Wrap(err)
}
@@ -106,6 +131,7 @@ func (lbp *localizeBuiltinPlugins) localizeAll(node *yaml.RNode) error {
// We rely on the build command to throw errors for nodes in
// built-in plugins that are sequences when expected to be scalar,
// and vice versa.
//nolint: exhaustive
switch node.YNode().Kind {
case yaml.SequenceNode:
return errors.Wrap(node.VisitElements(lbp.localizeScalar))

View File

@@ -38,10 +38,11 @@ type localizer struct {
}
// Run attempts to localize the kustomization root at target with the given localize arguments
func Run(target string, scope string, newDir string, fSys filesys.FileSystem) error {
// and returns the path to the created newDir.
func Run(target, scope, newDir string, fSys filesys.FileSystem) (string, error) {
ldr, args, err := NewLoader(target, scope, newDir, fSys)
if err != nil {
return errors.Wrap(err)
return "", errors.Wrap(err)
}
defer func() { _ = ldr.Cleanup() }()
@@ -51,7 +52,7 @@ func Run(target string, scope string, newDir string, fSys filesys.FileSystem) er
}
dst := args.NewDir.Join(toDst)
if err = fSys.MkdirAll(dst); err != nil {
return errors.WrapPrefixf(err, "unable to create directory in localize destination")
return "", errors.WrapPrefixf(err, "unable to create directory in localize destination")
}
err = (&localizer{
@@ -66,9 +67,9 @@ func Run(target string, scope string, newDir string, fSys filesys.FileSystem) er
if errCleanup != nil {
log.Printf("unable to clean localize destination: %s", errCleanup)
}
return errors.WrapPrefixf(err, "unable to localize target %q", target)
return "", errors.WrapPrefixf(err, "unable to localize target %q", target)
}
return nil
return args.NewDir.String(), nil
}
// localize localizes the root that lc is at
@@ -279,6 +280,14 @@ func (lc *localizer) localizeHelmCharts(kust *types.Kustomization) error {
return errors.WrapPrefixf(err, "unable to localize helmCharts entry %d valuesFile", i)
}
kust.HelmCharts[i].ValuesFile = locFile
for j, valuesFile := range chart.AdditionalValuesFiles {
locFile, err = lc.localizeFile(valuesFile)
if err != nil {
return errors.WrapPrefixf(err, "unable to localize helmCharts entry %d additionalValuesFiles", i)
}
kust.HelmCharts[i].AdditionalValuesFiles[j] = locFile
}
}
if kust.HelmGlobals != nil {
locDir, err := lc.copyChartHomeEntry(kust.HelmGlobals.ChartHome)

View File

@@ -102,6 +102,14 @@ func addFiles(t *testing.T, fSys filesys.FileSystem, parentDir string, files map
}
}
func checkRun(t *testing.T, fSys filesys.FileSystem, target, scope, dst string) {
t.Helper()
actualDst, err := Run(target, scope, dst, fSys)
require.NoError(t, err)
require.Equal(t, dst, actualDst)
}
func makeFileSystems(t *testing.T, target string, files map[string]string) (expected filesys.FileSystem, actual filesys.FileSystem) {
t.Helper()
@@ -161,9 +169,7 @@ func checkLocalizeInTargetSuccess(t *testing.T, files map[string]string) {
fSys := makeMemoryFs(t)
addFiles(t, fSys, "/a", files)
err := Run("/a", "/", "dst", fSys)
require.NoError(t, err)
checkRun(t, fSys, "/a", "/", "/dst")
fSysExpected := makeMemoryFs(t)
addFiles(t, fSysExpected, "/a", files)
addFiles(t, fSysExpected, "/dst/a", files)
@@ -179,9 +185,7 @@ namePrefix: my-
}
fSysExpected, fSysActual := makeFileSystems(t, "/a", kustomization)
err := Run("/a", "", "/a/b/dst", fSysActual)
require.NoError(t, err)
checkRun(t, fSysActual, "/a", "/a", "/a/b/dst")
addFiles(t, fSysExpected, "/a/b/dst", kustomization)
checkFSys(t, fSysExpected, fSysActual)
}
@@ -202,9 +206,7 @@ patches:
}
fSysExpected, fSysActual := makeFileSystems(t, "/a/b", kustomization)
err := Run("/a/b", "/", "/a/b/dst", fSysActual)
require.NoError(t, err)
checkRun(t, fSysActual, "/a/b", "/", "/a/b/dst")
addFiles(t, fSysExpected, "/a/b/dst/a/b", kustomization)
checkFSys(t, fSysExpected, fSysActual)
}
@@ -259,9 +261,9 @@ func TestLoadUnknownKustFields(t *testing.T) {
suffix: invalid`,
})
err := Run("/a", "", "", fSysTest)
_, err := Run("/a", "", "", fSysTest)
require.EqualError(t, err,
`unable to localize target "/a": invalid Kustomization: error unmarshaling JSON: while decoding JSON: json: unknown field "suffix"`)
`unable to localize target "/a": invalid Kustomization: json: unknown field "suffix"`)
checkFSys(t, fSysExpected, fSysTest)
}
@@ -299,9 +301,7 @@ patches:
}
expected, actual := makeFileSystems(t, "/alpha/beta/gamma", kustAndPatch)
err := Run("/alpha/beta/gamma", "/", "", actual)
require.NoError(t, err)
checkRun(t, actual, "/alpha/beta/gamma", "/", "/localized-gamma")
addFiles(t, expected, "/localized-gamma/alpha/beta/gamma", map[string]string{
"kustomization.yaml": `apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
@@ -328,9 +328,7 @@ kind: Kustomization
}
expected, actual := makeFileSystems(t, "/alpha/beta", targetAndUnreferenced)
err := Run("/alpha/beta", "/alpha", "/beta", actual)
require.NoError(t, err)
checkRun(t, actual, "/alpha/beta", "/alpha", "/beta")
addFiles(t, expected, "/beta/beta", map[string]string{
"kustomization.yaml": targetAndUnreferenced["kustomization.yaml"],
"env": targetAndUnreferenced["env"],
@@ -586,15 +584,43 @@ patches:
}
expected, actual := makeFileSystems(t, "/a/b", kustAndPatch)
err := Run("/a/b", "", "/dst", actual)
_, err := Run("/a/b", "", "/dst", actual)
require.EqualError(t, err, `unable to localize target "/a/b": unable to localize patches: invalid file reference: '/a/b/name-DNE.yaml' doesn't exist`)
checkFSys(t, expected, actual)
}
func TestLocalizePluginsInlineAndFile(t *testing.T) {
kustAndPlugins := map[string]string{
"kustomization.yaml": `apiVersion: kustomize.config.k8s.io/v1beta1
for _, test := range []struct {
name string
files map[string]string
}{
{
name: "generators",
files: map[string]string{
"kustomization.yaml": `generators:
- generator.yaml
- |
apiVersion: builtin
env: second.properties
kind: ConfigMapGenerator
metadata:
name: inline
`,
"generator.yaml": `apiVersion: builtin
env: first.properties
kind: ConfigMapGenerator
metadata:
name: file
`,
"first.properties": "APPLE=orange",
"second.properties": "BANANA=pear",
},
},
{
name: "transformers",
files: map[string]string{
"kustomization.yaml": `apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
transformers:
- |
@@ -605,16 +631,39 @@ transformers:
path: patchSM-one.yaml
- patch.yaml
`,
"patch.yaml": `apiVersion: builtin
"patch.yaml": `apiVersion: builtin
kind: PatchTransformer
metadata:
name: file
path: patchSM-two.yaml
`,
"patchSM-one.yaml": podConfiguration,
"patchSM-two.yaml": podConfiguration,
"patchSM-one.yaml": podConfiguration,
"patchSM-two.yaml": podConfiguration,
},
},
{
name: "validators",
files: map[string]string{
"kustomization.yaml": `validators:
- |
apiVersion: builtin
kind: ReplacementTransformer
metadata:
name: inline
replacements:
- path: first.yaml
- second.yaml
`,
"first.yaml": replacementTransformerWithPath,
"second.yaml": replacementTransformerWithPath,
"replacement.yaml": replacements,
},
},
} {
t.Run(test.name, func(t *testing.T) {
checkLocalizeInTargetSuccess(t, test.files)
})
}
checkLocalizeInTargetSuccess(t, kustAndPlugins)
}
func TestLocalizeMultiplePluginsInEntry(t *testing.T) {
@@ -659,9 +708,7 @@ transformers:
}
expected, actual := makeFileSystems(t, "/a", kustAndPlugins)
err := Run("/a", "", "/dst", actual)
require.NoError(t, err)
checkRun(t, actual, "/a", "/a", "/dst")
addFiles(t, expected, "/dst", map[string]string{
"kustomization.yaml": kustAndPlugins["kustomization.yaml"],
"patch.yaml": fmt.Sprintf(patchf, "patchSM.yaml"),
@@ -920,7 +967,7 @@ metadata:
t.Run(test.name, func(t *testing.T) {
expected, actual := makeFileSystems(t, "/", test.files)
err := Run("/", "", "/dst", actual)
_, err := Run("/", "", "/dst", actual)
var actualErr ResourceLoadError
require.ErrorAs(t, err, &actualErr)
@@ -974,7 +1021,7 @@ func TestLocalizeBuiltinPlugins_Errors(t *testing.T) {
} {
t.Run(name, func(t *testing.T) {
expected, actual := makeFileSystems(t, "/a", test.files)
err := Run("/a", "", "/dst", actual)
_, err := Run("/a", "", "/dst", actual)
const errPrefix = `unable to localize target "/a"`
require.EqualError(t, err, fmt.Sprintf(
"%s: %s: %s", errPrefix, test.fieldSpecErr, test.locErr))
@@ -1094,9 +1141,7 @@ namespace: kustomize-namespace
}
expected, actual := makeFileSystems(t, "/alpha", kustAndComponents)
err := Run("/alpha/beta/gamma", "/alpha", "/alpha/beta/dst", actual)
require.NoError(t, err)
checkRun(t, actual, "/alpha/beta/gamma", "/alpha", "/alpha/beta/dst")
cleanedFiles := map[string]string{
"beta/gamma/kustomization.yaml": `apiVersion: kustomize.config.k8s.io/v1beta1
components:
@@ -1159,9 +1204,7 @@ namePrefix: my-
}
expected, actual := makeFileSystems(t, "/a/b", kustAndResources)
err := Run("/a/b", "/", "", actual)
require.NoError(t, err)
checkRun(t, actual, "/a/b", "/", "/localized-b")
addFiles(t, expected, "/localized-b/a/b", kustAndResources)
checkFSys(t, expected, actual)
}
@@ -1176,7 +1219,7 @@ resources:
}
expected, actual := makeFileSystems(t, "/a", kustAndResources)
err := Run("/a", "/", "", actual)
_, err := Run("/a", "/", "", actual)
const expectedFileErr = `invalid file reference: '/a/b' must resolve to a file`
const expectedRootErr = `unable to localize root "b": unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization' in directory '/a/b'`
@@ -1230,8 +1273,13 @@ func TestLocalizeHelmCharts(t *testing.T) {
- includeCRDs: true
name: localize-valuesFile
valuesFile: file
- additionalValuesFiles:
- another
- third
`,
"file": valuesFile,
"another": valuesFile,
"third": valuesFile,
"charts/nothing-to-localize/values.yaml": valuesFile,
"charts/localize-valuesFile/values.yaml": valuesFile,
},
@@ -1273,9 +1321,7 @@ func TestLocalizeHelmChartsNoDefault(t *testing.T) {
}
expected, actual := makeFileSystems(t, "/a", files)
err := Run("/a", "", "/dst", actual)
require.NoError(t, err)
checkRun(t, actual, "/a", "/a", "/dst")
addFiles(t, expected, "/dst", map[string]string{
"kustomization.yaml": files["kustomization.yaml"],
"home/name/values.yaml": valuesFile,
@@ -1389,9 +1435,7 @@ helmGlobals:
t.Run(name, func(t *testing.T) {
expected, actual := makeFileSystems(t, "/a/b", test.files)
err := Run("/a/b", "/a/b", "/dst", actual)
require.NoError(t, err)
checkRun(t, actual, "/a/b", "/a/b", "/dst")
addFiles(t, expected, "/dst", test.copiedFiles)
checkFSys(t, expected, actual)
})
@@ -1408,9 +1452,7 @@ func TestCopyChartHomeEmpty(t *testing.T) {
require.NoError(t, actual.Mkdir("/a/home"))
require.NoError(t, expected.Mkdir("/a/home"))
err := Run("/a", "", "/dst", actual)
require.NoError(t, err)
checkRun(t, actual, "/a", "/a", "/dst")
addFiles(t, expected, "/dst", kustomization)
require.NoError(t, expected.Mkdir("/dst/home"))
checkFSys(t, expected, actual)
@@ -1452,7 +1494,7 @@ func TestCopyChartHomeError(t *testing.T) {
t.Run(name, func(t *testing.T) {
expected, actual := makeFileSystems(t, "/", test.files)
err := Run("/a/b", "/a", "/dst", actual)
_, err := Run("/a/b", "/a", "/dst", actual)
const prefix = `unable to localize target "/a/b"`
require.EqualError(t, err, fmt.Sprintf("%s: %s", prefix, test.err))
@@ -1461,6 +1503,67 @@ func TestCopyChartHomeError(t *testing.T) {
}
}
func TestLocalizeGeneratorsHelm(t *testing.T) {
files := map[string]string{
"kustomization.yaml": `generators:
- default.yaml
- explicit.yaml
`,
"default.yaml": `apiVersion: builtin
kind: HelmChartInflationGenerator
metadata:
name: no-explicit-references
name: minecraft
releaseName: moria
repo: https://itzg.github.io/minecraft-server-charts
version: 3.1.3
`,
"explicit.yaml": `additionalValuesFiles:
- time.yaml
- life.yaml
- light.yaml
apiVersion: builtin
chartHome: home
kind: HelmChartInflationGenerator
metadata:
name: explicit-references
name: mapleStory
valuesFile: mapleValues.yaml
`,
"time.yaml": valuesFile,
"life.yaml": valuesFile,
"light.yaml": valuesFile,
"mapleValues.yaml": valuesFile,
"home/mapleStory/values.yaml": valuesFile,
"charts/minecraft/values.yaml": valuesFile,
}
checkLocalizeInTargetSuccess(t, files)
}
func TestLocalizeGeneratorsNoHelm(t *testing.T) {
files := map[string]string{
"kustomization.yaml": `generators:
- configMap.yaml
`,
"configMap.yaml": `apiVersion: builtin
kind: ConfigMapGenerator
literals:
- APPLE=orange
metadata:
name: not-helm-shouldn't-copy-default-helm-chart-home
`,
"charts/minecraft/values.yaml": valuesFile,
}
expected, actual := makeFileSystems(t, "/a", files)
checkRun(t, actual, "/a", "/a", "/dst")
addFiles(t, expected, "/dst", map[string]string{
"kustomization.yaml": files["kustomization.yaml"],
"configMap.yaml": files["configMap.yaml"],
})
checkFSys(t, expected, actual)
}
func TestLocalizeEmpty(t *testing.T) {
for name, kustomization := range map[string]string{
"file": `configurations:

View File

@@ -6,6 +6,7 @@ package localizer_test
import (
"bytes"
"log"
"os"
"testing"
"github.com/stretchr/testify/require"
@@ -37,6 +38,9 @@ func TestLocalLoadNewAndCleanup(t *testing.T) {
var buf bytes.Buffer
log.SetOutput(&buf)
defer func() {
log.SetOutput(os.Stderr)
}()
// typical setup
ldr, args, err := NewLoader("a", "/", "/newDir", fSys)
req.NoError(err)
@@ -223,6 +227,9 @@ func TestNewLocLoaderFails(t *testing.T) {
t.Run(name, func(t *testing.T) {
var buf bytes.Buffer
log.SetOutput(&buf)
defer func() {
log.SetOutput(os.Stderr)
}()
_, _, err := NewLoader(params.target, params.scope, params.dest, makeMemoryFs(t))
require.Error(t, err)

View File

@@ -6,7 +6,6 @@ package krusty_test
import (
"testing"
"github.com/stretchr/testify/assert"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
)
@@ -229,6 +228,9 @@ type: Opaque
`)
}
// TODO: This should be an error instead. However, we can't strict unmarshal until we have a yaml
// lib that support case-insensitive keys and anchors.
// See https://github.com/kubernetes-sigs/kustomize/issues/5061
func TestGeneratorRepeatsInKustomization(t *testing.T) {
th := kusttest_test.MakeHarness(t)
th.WriteK(".", `
@@ -261,13 +263,24 @@ krypton
xenon
radon
`)
err := th.RunWithErr(".", th.MakeDefaultOptions())
if err == nil {
t.Fatalf("expected an error")
}
assert.Contains(t, err.Error(),
"invalid Kustomization: error converting YAML to JSON: yaml: unmarshal errors:\n"+
" line 13: key \"literals\" already set in map\n line 18: key \"files\" already set in map")
m := th.Run(".", th.MakeDefaultOptions())
th.AssertActualEqualsExpected(m, `
apiVersion: v1
data:
fruit: apple
nobles: |2
helium
neon
argon
krypton
xenon
radon
vegetable: broccoli
kind: ConfigMap
metadata:
name: blah-bob-db529cg5bk
`)
}
func TestIssue3393(t *testing.T) {

View File

@@ -4,9 +4,12 @@
package krusty_test
import (
"path/filepath"
"testing"
"github.com/stretchr/testify/require"
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
"sigs.k8s.io/kustomize/kyaml/copyutil"
)
const expectedHelm = `
@@ -233,3 +236,193 @@ spec:
type: ClusterIP
`)
}
func TestHelmChartInflationGeneratorMultipleValuesFiles(t *testing.T) {
th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t)
defer th.Reset()
if err := th.ErrIfNoHelm(); err != nil {
t.Skip("skipping: " + err.Error())
}
copyValuesFilesTestChartsIntoHarness(t, th)
th.WriteK(th.GetRoot(), `
helmCharts:
- name: test-chart
releaseName: test-chart
additionalValuesFiles:
- charts/valuesFiles/file1.yaml
- charts/valuesFiles/file2.yaml
`)
m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
asYaml, err := m.AsYaml()
require.NoError(t, err)
require.Equal(t, string(asYaml), `apiVersion: apps/v1
kind: Deployment
metadata:
labels:
chart: test-1.0.0
name: my-deploy
namespace: file-2
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
spec:
containers:
- image: test-image-file1:file1
imagePullPolicy: Never
---
apiVersion: apps/v1
kind: Pod
metadata:
annotations:
helm.sh/hook: test
name: test-chart
`)
}
func TestHelmChartInflationGeneratorApiVersions(t *testing.T) {
th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t)
defer th.Reset()
if err := th.ErrIfNoHelm(); err != nil {
t.Skip("skipping: " + err.Error())
}
copyValuesFilesTestChartsIntoHarness(t, th)
th.WriteK(th.GetRoot(), `
helmCharts:
- name: test-chart
releaseName: test-chart
apiVersions:
- foo/v1
`)
m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
asYaml, err := m.AsYaml()
require.NoError(t, err)
require.Equal(t, string(asYaml), `apiVersion: foo/v1
kind: Deployment
metadata:
labels:
chart: test-1.0.0
name: my-deploy
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
spec:
containers:
- image: test-image:v1.0.0
imagePullPolicy: Always
---
apiVersion: foo/v1
kind: Pod
metadata:
annotations:
helm.sh/hook: test
name: test-chart
`)
}
func TestHelmChartInflationGeneratorSkipTests(t *testing.T) {
th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t)
defer th.Reset()
if err := th.ErrIfNoHelm(); err != nil {
t.Skip("skipping: " + err.Error())
}
copyValuesFilesTestChartsIntoHarness(t, th)
th.WriteK(th.GetRoot(), `
helmCharts:
- name: test-chart
releaseName: test-chart
skipTests: true
`)
m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
asYaml, err := m.AsYaml()
require.NoError(t, err)
require.Equal(t, string(asYaml), `apiVersion: apps/v1
kind: Deployment
metadata:
labels:
chart: test-1.0.0
name: my-deploy
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
spec:
containers:
- image: test-image:v1.0.0
imagePullPolicy: Always
`)
}
func TestHelmChartInflationGeneratorNameTemplate(t *testing.T) {
th := kusttest_test.MakeEnhancedHarnessWithTmpRoot(t)
defer th.Reset()
if err := th.ErrIfNoHelm(); err != nil {
t.Skip("skipping: " + err.Error())
}
copyValuesFilesTestChartsIntoHarness(t, th)
th.WriteK(th.GetRoot(), `
helmCharts:
- name: test-chart
nameTemplate: name-template
`)
m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
asYaml, err := m.AsYaml()
require.NoError(t, err)
require.Equal(t, string(asYaml), `apiVersion: apps/v1
kind: Deployment
metadata:
labels:
chart: test-1.0.0
name: my-deploy
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
spec:
containers:
- image: test-image:v1.0.0
imagePullPolicy: Always
---
apiVersion: apps/v1
kind: Pod
metadata:
annotations:
helm.sh/hook: test
name: name-template
`)
}
func copyValuesFilesTestChartsIntoHarness(t *testing.T, th *kusttest_test.HarnessEnhanced) {
t.Helper()
thDir := filepath.Join(th.GetRoot(), "charts")
chartDir := "testdata/helmcharts"
fs := th.GetFSys()
require.NoError(t, fs.MkdirAll(filepath.Join(thDir, "templates")))
require.NoError(t, copyutil.CopyDir(th.GetFSys(), chartDir, thDir))
}

View File

@@ -9,7 +9,9 @@ import (
"sigs.k8s.io/kustomize/kyaml/filesys"
)
// Run `kustomize localize`s files referenced by kustomization target in scope to destination newDir on fSys.
func Run(fSys filesys.FileSystem, target, scope, newDir string) error {
return errors.Wrap(localizer.Run(target, scope, newDir, fSys))
// Run executes `kustomize localize` on fSys given the `localize` arguments and
// returns the path to the created newDir.
func Run(fSys filesys.FileSystem, target, scope, newDir string) (string, error) {
dst, err := localizer.Run(target, scope, newDir, fSys)
return dst, errors.Wrap(err)
}

View File

@@ -264,10 +264,11 @@ func TestWorkingDir(t *testing.T) {
fsExpected, fsActual, wd := PrepareFs(t, []string{"target", "base"}, files)
SetWorkingDir(t, wd.String())
err := localizer.Run(fsActual, "target", ".", "")
dst, err := localizer.Run(fsActual, "target", ".", "")
require.NoError(t, err)
require.Equal(t, wd.Join("localized-target"), dst)
SetupDir(t, fsExpected, wd.Join("localized-target"), files)
SetupDir(t, fsExpected, dst, files)
CheckFs(t, wd.String(), fsExpected, fsActual)
}
@@ -301,10 +302,10 @@ func TestLoaderSymlinks(t *testing.T) {
})
SetWorkingDir(t, testDir.String())
err := localizer.Run(fsActual, "target-link", "target", "")
dst, err := localizer.Run(fsActual, "target-link", "target", "")
require.NoError(t, err)
require.Equal(t, testDir.Join("localized-target"), dst)
dst := testDir.Join("localized-target")
SetupDir(t, fsExpected, dst, map[string]string{
"kustomization.yaml": fmt.Sprintf(`resources:
- %s
@@ -322,10 +323,10 @@ func TestRemoteTargetDefaultDst(t *testing.T) {
SetWorkingDir(t, testDir.String())
const target = simpleURL + urlQuery
err := localizer.Run(fsActual, target, "", "")
dst, err := localizer.Run(fsActual, target, "", "")
require.NoError(t, err)
require.Equal(t, testDir.Join("localized-simple-kustomize-v4.5.7"), dst)
dst := testDir.Join("localized-simple-kustomize-v4.5.7")
_, files := simplePathAndFiles(t)
SetupDir(t, fsExpected,
filepath.Join(dst, "api", "krusty", "testdata", "localize", "simple"),
@@ -364,7 +365,7 @@ func TestBadArgs(t *testing.T) {
fsExpected, fsActual, testDir := PrepareFs(t, nil, kust)
SetWorkingDir(t, testDir.String())
err := localizer.Run(fsActual, test.target, test.scope, test.dst)
_, err := localizer.Run(fsActual, test.target, test.scope, test.dst)
require.EqualError(t, err, test.err)
SetupDir(t, fsExpected, testDir.String(), kust)
@@ -383,9 +384,10 @@ openapi:
"kustomization.yaml": fmt.Sprintf(kustf, `https://raw.githubusercontent.com/kubernetes-sigs/kustomize/kustomize/v4.5.7/api/krusty/testdata/customschema.json`),
})
dst := testDir.Join("dst")
err := localizer.Run(fsActual, testDir.String(), "", dst)
newDir := testDir.Join("dst")
dst, err := localizer.Run(fsActual, testDir.String(), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
localizedPath := filepath.Join(LocalizeDir, "raw.githubusercontent.com",
"kubernetes-sigs", "kustomize", "kustomize", "v4.5.7", "api", "krusty",
@@ -404,9 +406,10 @@ func TestRemoteRoot(t *testing.T) {
`, simpleURL+urlQuery),
})
dst := testDir.Join("dst")
err := localizer.Run(fsActual, testDir.String(), "", dst)
newDir := testDir.Join("dst")
dst, err := localizer.Run(fsActual, testDir.String(), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
localizedPath, files := simplePathAndFiles(t)
SetupDir(t, fsExpected, dst, map[string]string{
@@ -427,9 +430,10 @@ func TestNestedRemoteRoots(t *testing.T) {
`,
})
dst := testDir.Join("dst")
err := localizer.Run(fsActual, testDir.String(), "", dst)
newDir := testDir.Join("dst")
dst, err := localizer.Run(fsActual, testDir.String(), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
localizedPath, files := remotePathAndFiles(t)
SetupDir(t, fsExpected, dst, map[string]string{
@@ -450,15 +454,13 @@ func TestResourcesRepoNotFile(t *testing.T) {
}
fsExpected, fsActual, testDir := PrepareFs(t, nil, kustomization)
err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))
_, err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))
const readmeErr = `mapping values are not allowed in this context`
fileErr := fmt.Sprintf(`invalid resource at file "%s": MalformedYAMLError:`, repo)
fileErr := fmt.Sprintf(`invalid resource at file "%s"`, repo)
rootErr := fmt.Sprintf(`unable to localize root "%s": unable to find one of 'kustomization.yaml', 'kustomization.yml' or 'Kustomization'`, repo)
var actualErr PathLocalizeError
require.ErrorAs(t, err, &actualErr)
require.Equal(t, repo, actualErr.Path)
require.ErrorContains(t, actualErr.FileError, readmeErr)
require.ErrorContains(t, actualErr.FileError, fileErr)
require.ErrorContains(t, actualErr.RootError, rootErr)
@@ -475,7 +477,7 @@ func TestRemoteRootNoRef(t *testing.T) {
}
fsExpected, fsActual, testDir := PrepareFs(t, nil, kustomization)
err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))
_, err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))
const fileErr = "invalid file reference: URL is a git repository"
rootErr := fmt.Sprintf(`localize remote root "%s" missing ref query string parameter`, root)
@@ -499,7 +501,7 @@ func TestExistingCacheDir(t *testing.T) {
}
fsExpected, fsActual, testDir := PrepareFs(t, []string{LocalizeDir}, file)
err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))
_, err := localizer.Run(fsActual, testDir.String(), "", testDir.Join("dst"))
require.ErrorContains(t, err, fmt.Sprintf(`already contains localized-files needed to store file "%s"`, remoteFile))
SetupDir(t, fsExpected, testDir.String(), file)
@@ -520,9 +522,10 @@ minecraftServer:
filepath.Join("nested", "dirs", "home", "name"),
}, files)
dst := testDir.Join("dst")
err := localizer.Run(fsActual, testDir.String(), "", dst)
newDir := testDir.Join("dst")
dst, err := localizer.Run(fsActual, testDir.String(), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
SetupDir(t, fsExpected, dst, files)
CheckFs(t, dst, fsExpected, fsActual)
@@ -555,9 +558,10 @@ helmGlobals:
filepath.Join("target", "home-link"): "home",
})
dst := scope.Join("dst")
err := localizer.Run(fsActual, scope.Join("target"), scope.String(), dst)
newDir := scope.Join("dst")
dst, err := localizer.Run(fsActual, scope.Join("target"), scope.String(), newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
SetupDir(t, fsExpected, dst, map[string]string{
filepath.Join("target", "Kustomization"): fmt.Sprintf(`helmCharts:
@@ -594,9 +598,10 @@ helmChartInflationGenerator:
})
link(t, target, map[string]string{"charts": "home"})
dst := target.Join("dst")
err := localizer.Run(fsActual, target.String(), "", dst)
newDir := target.Join("dst")
dst, err := localizer.Run(fsActual, target.String(), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
SetupDir(t, fsExpected, dst, map[string]string{
"kustomization.yaml": `helmChartInflationGenerator:
@@ -634,9 +639,10 @@ func TestHelmHomeEscapesScope(t *testing.T) {
filepath.Join("target", "home", "file-link"): "file",
})
dst := testDir.Join("dst")
err := localizer.Run(fsActual, testDir.Join("target"), "", dst)
newDir := testDir.Join("dst")
dst, err := localizer.Run(fsActual, testDir.Join("target"), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
SetupDir(t, fsExpected, dst, map[string]string{
"kustomization.yaml": `helmGlobals:
@@ -663,9 +669,10 @@ func TestSymlinkedFileSource(t *testing.T) {
"filename-used-as-key-in-configMap": "different-key",
})
dst := target.Join("dst")
err := localizer.Run(fsActual, target.String(), "", dst)
newDir := target.Join("dst")
dst, err := localizer.Run(fsActual, target.String(), "", newDir)
require.NoError(t, err)
require.Equal(t, newDir, dst)
SetupDir(t, fsExpected, dst, map[string]string{
"kustomization.yaml": `configMapGenerator:

View File

@@ -13,14 +13,14 @@ const expected = `apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/managed-by: kustomize-v444.333.222
app.kubernetes.io/managed-by: kustomize-(test)
name: myService
spec:
ports:
- port: 7002
`
// This test may failed when running on package tests using the go command because `v444.333.222` is set on makefile.
// This test may fail when running on package tests using the go command because `(test)` is set on makefile.
func TestAddManagedbyLabel(t *testing.T) {
tests := []struct {
kustFile string

View File

@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A simple test helm chart.
name: test
version: 1.0.0

View File

@@ -0,0 +1 @@
This is a simple test chart.

View File

@@ -0,0 +1,7 @@
{{- define "apiversion" -}}
{{- if .Capabilities.APIVersions.Has "foo/v1" -}}
foo/v1
{{- else -}}
apps/v1
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,18 @@
---
apiVersion: {{ template "apiversion" . }}
kind: Deployment
metadata:
labels:
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
name: my-deploy
namespace: {{ .Values.data.namespace }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
spec:
containers:
- image: "{{ .Values.data.image.name }}:{{ .Values.data.image.tag }}"
imagePullPolicy: {{ .Values.data.image.imagePullPolicy }}

View File

@@ -0,0 +1,6 @@
apiVersion: {{ template "apiversion" . }}
kind: Pod
metadata:
name: {{ .Release.Name }}
annotations:
"helm.sh/hook": test

View File

@@ -0,0 +1,6 @@
data:
namespace: default
image:
name: test-image
tag: v1.0.0
imagePullPolicy: Always

View File

@@ -0,0 +1,5 @@
data:
image:
name: test-image-file1
tag: file1
imagePullPolicy: Never

View File

@@ -0,0 +1,2 @@
data:
namespace: file-2

View File

@@ -6,47 +6,63 @@ package provenance
import (
"fmt"
"runtime"
"runtime/debug"
"strings"
)
// These variables are set at build time using ldflags.
//
//nolint:gochecknoglobals
var (
version = "unknown"
// sha1 from git, output of $(git rev-parse HEAD)
gitCommit = "$Format:%H$"
// During a release, this will be set to the release tag, e.g. "kustomize/v4.5.7"
version = developmentVersion
// build date in ISO8601 format, output of $(date -u +'%Y-%m-%dT%H:%M:%SZ')
buildDate = "1970-01-01T00:00:00Z"
goos = runtime.GOOS
goarch = runtime.GOARCH
buildDate = "unknown"
)
// This default value, (devel), matches
// the value debug.BuildInfo uses for an unset main module version.
const developmentVersion = "(devel)"
// Provenance holds information about the build of an executable.
type Provenance struct {
// Version of the kustomize binary.
Version string `json:"version,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
// GitCommit is a git commit
GitCommit string `json:"gitCommit,omitempty"`
GitCommit string `json:"gitCommit,omitempty" yaml:"gitCommit,omitempty"`
// BuildDate is date of the build.
BuildDate string `json:"buildDate,omitempty"`
BuildDate string `json:"buildDate,omitempty" yaml:"buildDate,omitempty"`
// GoOs holds OS name.
GoOs string `json:"goOs,omitempty"`
GoOs string `json:"goOs,omitempty" yaml:"goOs,omitempty"`
// GoArch holds architecture name.
GoArch string `json:"goArch,omitempty"`
GoArch string `json:"goArch,omitempty" yaml:"goArch,omitempty"`
// GoVersion holds Go version.
GoVersion string `json:"goVersion,omitempty" yaml:"goVersion,omitempty"`
}
// GetProvenance returns an instance of Provenance.
func GetProvenance() Provenance {
return Provenance{
version,
gitCommit,
buildDate,
goos,
goarch,
p := Provenance{
BuildDate: buildDate,
Version: version,
GitCommit: "unknown",
GoOs: runtime.GOOS,
GoArch: runtime.GOARCH,
GoVersion: runtime.Version(),
}
info, ok := debug.ReadBuildInfo()
if !ok {
return p
}
}
// Full returns the full provenance stamp.
func (v Provenance) Full() string {
return fmt.Sprintf("%+v", v)
for _, setting := range info.Settings {
// For now, the git commit is the only information of interest.
// We could consider adding other info such as the commit date in the future.
if setting.Key == "vcs.revision" {
p.GitCommit = setting.Value
}
}
return p
}
// Short returns the shortened provenance stamp.

View File

@@ -0,0 +1,47 @@
// Copyright 2022 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package provenance_test
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/api/provenance"
)
const expectedBuildDateFromLdFlag = "2023-01-31T23:38:41Z"
const expectedVersionFromLdFlag = "(test)"
func TestGetProvenance(t *testing.T) {
p := provenance.GetProvenance()
// These are set by ldflags in our Makefile
assert.Equal(t, expectedVersionFromLdFlag, p.Version)
assert.Equal(t, expectedBuildDateFromLdFlag, p.BuildDate)
// This comes from BuildInfo, which is not set during go test: https://github.com/golang/go/issues/33976
assert.Equal(t, "unknown", p.GitCommit)
// These are set properly during go test
assert.NotEmpty(t, p.GoArch)
assert.NotEmpty(t, p.GoOs)
assert.Contains(t, p.GoVersion, "go1.")
}
func TestProvenance_Short(t *testing.T) {
p := provenance.GetProvenance()
// The version not set during go test, so this comes from an ldflag: https://github.com/golang/go/issues/33976
assert.Equal(t, fmt.Sprintf("{%s %s }", expectedVersionFromLdFlag, expectedBuildDateFromLdFlag), p.Short())
p.Version = "kustomize/v4.11.12"
assert.Equal(t, fmt.Sprintf("{kustomize/v4.11.12 %s }", expectedBuildDateFromLdFlag), p.Short())
}
func TestProvenance_Semver(t *testing.T) {
p := provenance.GetProvenance()
// The version not set during go test
assert.Equal(t, "(test)", p.Semver())
p.Version = "kustomize/v4.11.12"
assert.Equal(t, "v4.11.12", p.Semver())
}

View File

@@ -3,6 +3,8 @@
package types
import "path/filepath"
const HelmDefaultHome = "charts"
type HelmGlobals struct {
@@ -57,7 +59,11 @@ type HelmChart struct {
// in the helm template
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
// ValuesFile is local file path to a values file to use _instead of_
// AdditionalValuesFiles are local file paths to values files to be used in
// addition to either the default values file or the values specified in ValuesFile.
AdditionalValuesFiles []string `json:"additionalValuesFiles,omitempty" yaml:"additionalValuesFiles,omitempty"`
// ValuesFile is a local file path to a values file to use _instead of_
// the default values that accompanied the chart.
// The default values are in '{ChartHome}/{Name}/values.yaml'.
ValuesFile string `json:"valuesFile,omitempty" yaml:"valuesFile,omitempty"`
@@ -78,6 +84,15 @@ type HelmChart struct {
// SkipHooks sets the --no-hooks flag when calling helm template. This prevents
// helm from erroneously rendering test templates.
SkipHooks bool `json:"skipHooks,omitempty" yaml:"skipHooks,omitempty"`
// ApiVersions is the kubernetes apiversions used for Capabilities.APIVersions
ApiVersions []string `json:"apiVersions,omitempty" yaml:"apiVersions,omitempty"`
// NameTemplate is for specifying the name template used to name the release.
NameTemplate string `json:"nameTemplate,omitempty" yaml:"nameTemplate,omitempty"`
// SkipTests skips tests from templated output.
SkipTests bool `json:"skipTests,omitempty" yaml:"skipTests,omitempty"`
}
// HelmChartArgs contains arguments to helm.
@@ -126,3 +141,45 @@ func makeHelmChartFromHca(old *HelmChartArgs) (c HelmChart) {
c.ReleaseName = old.ReleaseName
return
}
func (h HelmChart) AsHelmArgs(absChartHome string) []string {
args := []string{"template"}
if h.ReleaseName != "" {
args = append(args, h.ReleaseName)
} else {
// AFAICT, this doesn't work as intended due to a bug in helm.
// See https://github.com/helm/helm/issues/6019
// I've tried placing the flag before and after the name argument.
args = append(args, "--generate-name")
}
if h.Name != "" {
args = append(args, filepath.Join(absChartHome, h.Name))
}
if h.Namespace != "" {
args = append(args, "--namespace", h.Namespace)
}
if h.NameTemplate != "" {
args = append(args, "--name-template", h.NameTemplate)
}
if h.ValuesFile != "" {
args = append(args, "-f", h.ValuesFile)
}
for _, valuesFile := range h.AdditionalValuesFiles {
args = append(args, "-f", valuesFile)
}
for _, apiVer := range h.ApiVersions {
args = append(args, "--api-versions", apiVer)
}
if h.IncludeCRDs {
args = append(args, "--include-crds")
}
if h.SkipTests {
args = append(args, "--skip-tests")
}
if h.SkipHooks {
args = append(args, "--no-hooks")
}
return args
}

View File

@@ -0,0 +1,61 @@
// Copyright 2019 The Kubernetes Authors.
// SPDX-License-Identifier: Apache-2.0
package types_test
import (
"testing"
"github.com/stretchr/testify/require"
"sigs.k8s.io/kustomize/api/types"
)
func TestAsHelmArgs(t *testing.T) {
t.Run("use generate-name", func(t *testing.T) {
p := types.HelmChart{
Name: "chart-name",
Version: "1.0.0",
Repo: "https://helm.releases.hashicorp.com",
ApiVersions: []string{"foo", "bar"},
NameTemplate: "template",
SkipTests: true,
IncludeCRDs: true,
SkipHooks: true,
ValuesFile: "values",
AdditionalValuesFiles: []string{"values1", "values2"},
Namespace: "my-ns",
}
require.Equal(t, p.AsHelmArgs("/home/charts"),
[]string{"template", "--generate-name",
"/home/charts/chart-name",
"--namespace", "my-ns",
"--name-template", "template",
"-f", "values",
"-f", "values1", "-f", "values2",
"--api-versions", "foo", "--api-versions", "bar",
"--include-crds",
"--skip-tests",
"--no-hooks"})
})
t.Run("use release-name", func(t *testing.T) {
p := types.HelmChart{
Name: "chart-name",
Version: "1.0.0",
Repo: "https://helm.releases.hashicorp.com",
ApiVersions: []string{"foo", "bar"},
NameTemplate: "template",
ValuesFile: "values",
AdditionalValuesFiles: []string{"values1", "values2"},
Namespace: "my-ns",
ReleaseName: "test",
}
require.Equal(t, p.AsHelmArgs("/home/charts"),
[]string{"template", "test", "/home/charts/chart-name",
"--namespace", "my-ns",
"--name-template", "template",
"-f", "values",
"-f", "values1", "-f", "values2",
"--api-versions", "foo", "--api-versions", "bar"})
})
}

View File

@@ -4,6 +4,8 @@
package types
import (
"bytes"
"encoding/json"
"fmt"
"sigs.k8s.io/kustomize/kyaml/errors"
@@ -313,8 +315,20 @@ func (k *Kustomization) EnforceFields() []string {
// Unmarshal replace k with the content in YAML input y
func (k *Kustomization) Unmarshal(y []byte) error {
if err := yaml.UnmarshalStrict(y, &k); err != nil {
// TODO: switch to strict decoding to catch duplicate keys.
// We can't do so until there is a yaml decoder that supports anchors AND case-insensitive keys.
// See https://github.com/kubernetes-sigs/kustomize/issues/5061
j, err := yaml.YAMLToJSON(y)
if err != nil {
return errors.WrapPrefixf(err, "invalid Kustomization")
}
dec := json.NewDecoder(bytes.NewReader(j))
dec.DisallowUnknownFields()
var nk Kustomization
err = dec.Decode(&nk)
if err != nil {
return errors.WrapPrefixf(err, "invalid Kustomization")
}
*k = nk
return nil
}

View File

@@ -278,7 +278,7 @@ unknown: foo`)
if err == nil {
t.Fatalf("expect an error")
}
expect := "invalid Kustomization: error unmarshaling JSON: while decoding JSON: json: unknown field \"unknown\""
expect := "invalid Kustomization: json: unknown field \"unknown\""
if err.Error() != expect {
t.Fatalf("expect %v but got: %v", expect, err.Error())
}

View File

@@ -7,7 +7,7 @@ require (
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.8.1
gopkg.in/inf.v0 v0.9.1
sigs.k8s.io/kustomize/kyaml v0.13.9
sigs.k8s.io/kustomize/kyaml v0.14.1
)
require (
@@ -23,7 +23,6 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect

View File

@@ -60,8 +60,6 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -153,7 +151,7 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596 h1:8cNCQs+WqqnSpZ7y0LMQPKD+RZUHU17VqLPMW3qxnxc=
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
sigs.k8s.io/kustomize/kyaml v0.13.9 h1:Qz53EAaFFANyNgyOEJbT/yoIHygK40/ZcvU3rgry2Tk=
sigs.k8s.io/kustomize/kyaml v0.13.9/go.mod h1:QsRbD0/KcU+wdk0/L0fIp2KLnohkVzs6fQ85/nOXac4=
sigs.k8s.io/kustomize/kyaml v0.14.1 h1:c8iibius7l24G2wVAGZn/Va2wNys03GXLjYVIcFVxKA=
sigs.k8s.io/kustomize/kyaml v0.14.1/go.mod h1:AN1/IpawKilWD7V+YvQwRGUvuUOOWpjsHu6uHwonSF4=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

View File

@@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/cmd/config/internal/commands"
"sigs.k8s.io/kustomize/kyaml/copyutil"
"sigs.k8s.io/kustomize/kyaml/filesys"
"sigs.k8s.io/kustomize/kyaml/openapi"
)
@@ -614,7 +615,7 @@ spec:
defer openapi.ResetOpenAPI()
sourceDir := filepath.Join("test", "testdata", test.dataset)
baseDir := t.TempDir()
copyutil.CopyDir(sourceDir, baseDir)
assert.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
runner := commands.GetCatRunner("")
actual := &bytes.Buffer{}
runner.Command.SetOut(actual)

View File

@@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/cmd/config/internal/commands"
"sigs.k8s.io/kustomize/kyaml/copyutil"
"sigs.k8s.io/kustomize/kyaml/filesys"
"sigs.k8s.io/kustomize/kyaml/openapi"
)
@@ -117,7 +118,7 @@ Deployment: 1
defer openapi.ResetOpenAPI()
sourceDir := filepath.Join("test", "testdata", test.dataset)
baseDir := t.TempDir()
copyutil.CopyDir(sourceDir, baseDir)
assert.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
runner := commands.GetCountRunner("")
actual := &bytes.Buffer{}
runner.Command.SetOut(actual)

View File

@@ -13,6 +13,7 @@ import (
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/cmd/config/internal/commands"
"sigs.k8s.io/kustomize/kyaml/copyutil"
"sigs.k8s.io/kustomize/kyaml/filesys"
)
// TestGrepCommand_files verifies grep reads the files and filters them
@@ -396,7 +397,7 @@ spec:
t.Run(test.name, func(t *testing.T) {
sourceDir := filepath.Join("test", "testdata", test.dataset)
baseDir := t.TempDir()
copyutil.CopyDir(sourceDir, baseDir)
assert.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
runner := commands.GetGrepRunner("")
actual := &bytes.Buffer{}
runner.Command.SetOut(actual)

View File

@@ -40,12 +40,12 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/spf13/cobra v1.4.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect

View File

@@ -376,8 +376,8 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -443,8 +443,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -496,18 +496,18 @@ golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@@ -36,7 +36,6 @@ var (
"docs",
"examples",
"hack",
"plugin",
"releasing",
"site",
}

View File

@@ -34,7 +34,7 @@ func (e *Editor) run(args ...string) error {
if e.doIt {
out, err := c.CombinedOutput()
if err != nil {
return fmt.Errorf("%s out=%q", err.Error(), out)
return fmt.Errorf("failed to run go mod command in %s: %w (stdout=%q)", e.module.ShortName(), err, out)
}
} else {
fmt.Printf("in %-60s; %s\n", c.Dir, c.String())
@@ -57,6 +57,8 @@ func (e *Editor) Tidy() error {
func (e *Editor) Pin(target misc.LaModule, oldV, newV semver.SemVer) error {
err := e.run(
"edit",
"-dropreplace="+target.ImportPath(),
"-dropreplace="+target.ImportPath()+"@"+oldV.String(),
"-require="+target.ImportPath()+"@"+newV.String(),
)
if err != nil {

View File

@@ -45,8 +45,9 @@ func (dg *DotGitData) AbsPath() string {
// NewDotGitDataFromPath wants the incoming path to hold dotGit
// E.g.
// ~/gopath/src/sigs.k8s.io/kustomize
// ~/gopath/src/github.com/monopole/gorepomod
//
// ~/gopath/src/sigs.k8s.io/kustomize
// ~/gopath/src/github.com/monopole/gorepomod
func NewDotGitDataFromPath(path string) (*DotGitData, error) {
if !utils.DirExists(filepath.Join(path, dotGitFileName)) {
return nil, fmt.Errorf(

View File

@@ -5,8 +5,8 @@ go 1.19
require (
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.8.1
sigs.k8s.io/kustomize/api v0.12.1
sigs.k8s.io/kustomize/kyaml v0.13.9
sigs.k8s.io/kustomize/api v0.13.1
sigs.k8s.io/kustomize/kyaml v0.14.1
)
require (
@@ -25,7 +25,6 @@ require (
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.4.1 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
@@ -37,3 +36,5 @@ require (
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
replace sigs.k8s.io/kustomize/api => ../../api

View File

@@ -66,7 +66,6 @@ github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/2gBQ3RWajuToeY6ZtZTIKv2v7ThUy5KKusIT0yc0=
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00/go.mod h1:Pm3mSP3c5uWn86xMLZ5Sa7JB9GsEZySvHYXCTK4E9q4=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -156,9 +155,7 @@ k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596 h1:8cNCQs+WqqnSpZ7y0LMQPK
k8s.io/kube-openapi v0.0.0-20230109183929-3758b55a6596/go.mod h1:/BYxry62FuDzmI+i9B+X2pqfySRmSOW2ARmj5Zbqhj0=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9 h1:HNSDgDCrr/6Ly3WEGKZftiE7IY19Vz2GdbOCyI4qqhc=
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
sigs.k8s.io/kustomize/api v0.12.1 h1:7YM7gW3kYBwtKvoY216ZzY+8hM+lV53LUayghNRJ0vM=
sigs.k8s.io/kustomize/api v0.12.1/go.mod h1:y3JUhimkZkR6sbLNwfJHxvo1TCLwuwm14sCYnkH6S1s=
sigs.k8s.io/kustomize/kyaml v0.13.9 h1:Qz53EAaFFANyNgyOEJbT/yoIHygK40/ZcvU3rgry2Tk=
sigs.k8s.io/kustomize/kyaml v0.13.9/go.mod h1:QsRbD0/KcU+wdk0/L0fIp2KLnohkVzs6fQ85/nOXac4=
sigs.k8s.io/kustomize/kyaml v0.14.1 h1:c8iibius7l24G2wVAGZn/Va2wNys03GXLjYVIcFVxKA=
sigs.k8s.io/kustomize/kyaml v0.14.1/go.mod h1:AN1/IpawKilWD7V+YvQwRGUvuUOOWpjsHu6uHwonSF4=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=

View File

@@ -31,9 +31,9 @@ require (
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect

View File

@@ -551,8 +551,8 @@ golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -638,8 +638,8 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -720,9 +720,9 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -733,8 +733,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@@ -47,6 +47,7 @@ k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2R
sigs.k8s.io/kustomize/api v0.8.9/go.mod h1:OTaWCS8krICmepGNRxSdhOuywXAl7AieML4y2gLk9Aw=
sigs.k8s.io/kustomize/api v0.11.4/go.mod h1:k+8RsqYbgpkIrJ4p9jcdPqe8DprLxFUUO0yNOq8C+xI=
sigs.k8s.io/kustomize/cmd/config v0.10.7/go.mod h1:ZTbW6xLlf2ohaOzyWbaRj+fxLbSRjsExCfXGijY4Xt4=
sigs.k8s.io/kustomize/cmd/config v0.11.0/go.mod h1:vsC4WPJub39YAH1aMeuU5dzCwe2zY6EbEKDo0PddiIc=
sigs.k8s.io/kustomize/kyaml v0.7.1/go.mod h1:ne3F9JPhW2wrVaLslxBsEe6MQJQ9YK5rUutrdhBWXwI=
sigs.k8s.io/kustomize/kyaml v0.10.18/go.mod h1:h94DSoDbmnN4BTc6VTX7tGNGXZy29rbPo+R4jGMvA8U=
sigs.k8s.io/kustomize/kyaml v0.13.6/go.mod h1:yHP031rn1QX1lr/Xd934Ri/xdVNG8BE2ECa78Ht/kEg=

View File

@@ -134,7 +134,12 @@ s390x)
;;
esac
releases=$(curl -s "$release_url")
# You can authenticate by exporting the GITHUB_TOKEN in the environment
if [[ -z "${GITHUB_TOKEN}" ]]; then
releases=$(curl -s "$release_url")
else
releases=$(curl -s "$release_url" --header "Authorization: Bearer ${GITHUB_TOKEN}")
fi
if [[ $releases == *"API rate limit exceeded"* ]]; then
echo "Github rate-limiter failed the request. Either authenticate or wait a couple of minutes."

50
hack/with-unpinned-kust-dev.sh Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Copyright 2023 The Kubernetes Authors.
# SPDX-License-Identifier: Apache-2.0
set -x
set -e
set -o pipefail
set -o nounset
# This script uses 'replace' statements to 'unpin' local modules from module versions go.mod normally
# requires, so that the local version will be used instead. With the advent of Workspace mode, we no longer
# need to do this in general in between releases. However, some key commands like `go mod tidy` are not
# Workspace-aware and thus will fail if API changes between modules exist on master. This script allows us to
# test those commands without requiring unpin operations in our release workflow.
if [[ -z "${1-}" ]] ; then
echo "Usage: $0 <cmd>"
echo "Example: $0 'go mod tidy -v'"
exit 1
fi
cmd=$1
# First we read in the list of all kustomize modules and their local locations. The data looks like:
# sigs.k8s.io/kustomize/api /Users/you/src/sigs.k8s.io/kustomize/api
# sigs.k8s.io/kustomize/cmd/config /Users/you/src/sigs.k8s.io/kustomize/cmd/config
IFS=$'\n'
modules=($(go list -m -f "{{.Path}} {{.Dir}}"))
# Next we iterate over the lines, split apart the module name and local absolute path,
# and add a relative-path replace statement to the go.mod. A replace statement will be added
# for each Kustomize module, whether or not the current module uses it.
IFS=" "
replace_args=""
for module in "${modules[@]}"; do
read -a module_data <<< $module
replace_path=$(realpath --relative-to=$(pwd) ${module_data[1]})
if [ $replace_path == . ] || [[ $replace_path == internal/* ]]; then
continue
fi
replace_args+=" -replace=${module_data[0]}=$replace_path"
done
go mod edit $replace_args
# Now that the modules are pinned, we run the command passed to this script.
bash -c "$cmd"
# Finally we clean up by dropping the replace statements we added above.
go mod edit $(sed 's/-replace/-dropreplace/g' <<< "$replace_args" | sed -E 's/=\.\.[^[:space:]]*//g')

View File

@@ -12,7 +12,6 @@ ADD . /build/
WORKDIR /build/kustomize
RUN CGO_ENABLED=0 GO111MODULE=on go build \
-ldflags="-s -X sigs.k8s.io/kustomize/api/provenance.version=${VERSION} \
-X sigs.k8s.io/kustomize/api/provenance.gitCommit=${COMMIT} \
-X sigs.k8s.io/kustomize/api/provenance.buildDate=${DATE}"
# only copy binary

View File

@@ -11,7 +11,7 @@ import (
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/api/provenance"
. "sigs.k8s.io/kustomize/kustomize/v4/commands/build"
. "sigs.k8s.io/kustomize/kustomize/v5/commands/build"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -14,11 +14,12 @@ import (
"sigs.k8s.io/kustomize/api/provider"
"sigs.k8s.io/kustomize/cmd/config/completion"
"sigs.k8s.io/kustomize/cmd/config/configcobra"
"sigs.k8s.io/kustomize/kustomize/v4/commands/build"
"sigs.k8s.io/kustomize/kustomize/v4/commands/create"
"sigs.k8s.io/kustomize/kustomize/v4/commands/edit"
"sigs.k8s.io/kustomize/kustomize/v4/commands/openapi"
"sigs.k8s.io/kustomize/kustomize/v4/commands/version"
"sigs.k8s.io/kustomize/kustomize/v5/commands/build"
"sigs.k8s.io/kustomize/kustomize/v5/commands/create"
"sigs.k8s.io/kustomize/kustomize/v5/commands/edit"
"sigs.k8s.io/kustomize/kustomize/v5/commands/localize"
"sigs.k8s.io/kustomize/kustomize/v5/commands/openapi"
"sigs.k8s.io/kustomize/kustomize/v5/commands/version"
"sigs.k8s.io/kustomize/kyaml/filesys"
)
@@ -53,6 +54,7 @@ See https://sigs.k8s.io/kustomize
create.NewCmdCreate(fSys, pvd.GetResourceFactory()),
version.NewCmdVersion(stdOut),
openapi.NewCmdOpenAPI(stdOut),
localize.NewCmdLocalize(fSys),
)
configcobra.AddCommands(c, konfig.ProgramName)

View File

@@ -13,8 +13,8 @@ import (
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"sigs.k8s.io/kustomize/api/provider"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"strings"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,8 +9,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -7,8 +7,8 @@ import (
"fmt"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/api/types"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,8 +9,8 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,8 +8,8 @@ import (
"log"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,8 +9,8 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -10,8 +10,8 @@ import (
"github.com/stretchr/testify/require"
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,8 +9,8 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,8 +8,8 @@ import (
"log"
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,8 +8,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,7 +8,7 @@ import (
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,7 +8,7 @@ import (
"sigs.k8s.io/kustomize/api/ifc"
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -11,11 +11,11 @@ import (
"sigs.k8s.io/kustomize/api/kv"
"sigs.k8s.io/kustomize/api/loader"
"sigs.k8s.io/kustomize/api/resource"
"sigs.k8s.io/kustomize/kustomize/v4/commands/edit/add"
"sigs.k8s.io/kustomize/kustomize/v4/commands/edit/fix"
"sigs.k8s.io/kustomize/kustomize/v4/commands/edit/listbuiltin"
"sigs.k8s.io/kustomize/kustomize/v4/commands/edit/remove"
"sigs.k8s.io/kustomize/kustomize/v4/commands/edit/set"
"sigs.k8s.io/kustomize/kustomize/v5/commands/edit/add"
"sigs.k8s.io/kustomize/kustomize/v5/commands/edit/fix"
"sigs.k8s.io/kustomize/kustomize/v5/commands/edit/listbuiltin"
"sigs.k8s.io/kustomize/kustomize/v5/commands/edit/remove"
"sigs.k8s.io/kustomize/kustomize/v5/commands/edit/set"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -8,7 +8,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -11,8 +11,8 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/kustomize/v4/commands/build"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/build"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -10,7 +10,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -5,8 +5,8 @@ package remove
import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/util"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/assert"
"sigs.k8s.io/kustomize/api/types"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -10,8 +10,8 @@ import (
valtest_test "sigs.k8s.io/kustomize/api/testutils/valtest"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v4/commands/internal/testutils"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

View File

@@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra"
"sigs.k8s.io/kustomize/api/konfig"
"sigs.k8s.io/kustomize/api/types"
"sigs.k8s.io/kustomize/kustomize/v4/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
"sigs.k8s.io/kustomize/kyaml/errors"
"sigs.k8s.io/kustomize/kyaml/filesys"
)

Some files were not shown because too many files have changed in this diff Show More