mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-14 10:30:59 +00:00
Compare commits
224 Commits
release-cm
...
release-ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42873c8d2a | ||
|
|
277da9ed21 | ||
|
|
2b00d887fd | ||
|
|
08d0593c3e | ||
|
|
31706fd7fd | ||
|
|
e862612703 | ||
|
|
1b449768b5 | ||
|
|
a9f7a0427a | ||
|
|
cd954ce6fe | ||
|
|
10c292f501 | ||
|
|
a9bfabc771 | ||
|
|
398aa3666f | ||
|
|
8f2d2436ec | ||
|
|
fd06780f3e | ||
|
|
562cbc132d | ||
|
|
d5f3c4fad9 | ||
|
|
f1599f6498 | ||
|
|
c0b3801c7a | ||
|
|
f0681429ea | ||
|
|
a6bbbe843c | ||
|
|
2c68a4d2d4 | ||
|
|
b3d1df2644 | ||
|
|
8d21d43cf7 | ||
|
|
eabf2d41d3 | ||
|
|
ed2ca23400 | ||
|
|
6145a4be44 | ||
|
|
8fef99fa35 | ||
|
|
a6149b1c88 | ||
|
|
91b92b52c1 | ||
|
|
d7e60b8451 | ||
|
|
9db92fd28d | ||
|
|
d514df3db0 | ||
|
|
22ce9c02bf | ||
|
|
43868688d5 | ||
|
|
434a55a244 | ||
|
|
a6ea3e2bb6 | ||
|
|
72f0a3cfb1 | ||
|
|
1eccd8f4b7 | ||
|
|
4dbc0d22e1 | ||
|
|
e9fc57abd6 | ||
|
|
d35edbf80d | ||
|
|
da3985c284 | ||
|
|
14a9a9849f | ||
|
|
8aafbacd17 | ||
|
|
4da880d6cb | ||
|
|
62eca858f3 | ||
|
|
11704312be | ||
|
|
74ba2fb141 | ||
|
|
cc410bc23a | ||
|
|
2252fd951a | ||
|
|
33caee50cb | ||
|
|
28ef9da0d9 | ||
|
|
db2240c9c1 | ||
|
|
d3329453a2 | ||
|
|
6ffcc08591 | ||
|
|
facabded61 | ||
|
|
9d66eb16c8 | ||
|
|
6088692165 | ||
|
|
9e68399e04 | ||
|
|
e25f99ee02 | ||
|
|
37715863f0 | ||
|
|
3e69c2e36a | ||
|
|
17eab513e9 | ||
|
|
800e12b5ae | ||
|
|
96c6bbad2c | ||
|
|
1fa02e729d | ||
|
|
f93b0ead3c | ||
|
|
f80650e8ce | ||
|
|
bcf100f592 | ||
|
|
9546529f1d | ||
|
|
91ccf00ac8 | ||
|
|
f8f4203fb7 | ||
|
|
537c4fa5c2 | ||
|
|
dc7ebef925 | ||
|
|
b154361c00 | ||
|
|
3bb9a6d414 | ||
|
|
14c091aec7 | ||
|
|
6c1fea79ed | ||
|
|
ca8d629230 | ||
|
|
fd09a6ed50 | ||
|
|
23fbdd2ab5 | ||
|
|
27a8ff9d23 | ||
|
|
cf01ceb2f6 | ||
|
|
3bd9ea8ee7 | ||
|
|
d223b9d55e | ||
|
|
31b852c7bc | ||
|
|
add367bf2e | ||
|
|
b1b61ad4cf | ||
|
|
d73f0fd097 | ||
|
|
bf286dce76 | ||
|
|
d768fc371c | ||
|
|
7e392f9117 | ||
|
|
4675bec08a | ||
|
|
26165a86b7 | ||
|
|
69826668a7 | ||
|
|
a85dfd4141 | ||
|
|
abdcae870c | ||
|
|
dd49bd4c6d | ||
|
|
4adb7f9604 | ||
|
|
40ce15cca3 | ||
|
|
4e93959754 | ||
|
|
ab519fdc13 | ||
|
|
f3fedac429 | ||
|
|
872968c420 | ||
|
|
f72db33d5e | ||
|
|
cfa2c41b44 | ||
|
|
0c461d61df | ||
|
|
27ae0693b4 | ||
|
|
42d5870546 | ||
|
|
f814039f99 | ||
|
|
b28e0445a2 | ||
|
|
7db7de65c1 | ||
|
|
a34dd1fc3f | ||
|
|
cd886102a9 | ||
|
|
2831689a1b | ||
|
|
069c5fd5d7 | ||
|
|
504e805da0 | ||
|
|
3cf12635d4 | ||
|
|
9adb7535fa | ||
|
|
c87c7a139c | ||
|
|
50583c4b0e | ||
|
|
9a7014cc14 | ||
|
|
32a78f3915 | ||
|
|
f866701088 | ||
|
|
49e911fcef | ||
|
|
665bfbc32d | ||
|
|
a0a9bdfe05 | ||
|
|
16f7e42392 | ||
|
|
bf485f66d3 | ||
|
|
557d6cba2d | ||
|
|
8eee90d2c6 | ||
|
|
9da0cf8b4c | ||
|
|
c259c478e5 | ||
|
|
c2ec4bb482 | ||
|
|
29d0214cbd | ||
|
|
faf93bb71d | ||
|
|
71f6f4c7d7 | ||
|
|
b22dbc7db9 | ||
|
|
bfe18b8198 | ||
|
|
82bd395289 | ||
|
|
e3031f3a7b | ||
|
|
6f47203e3f | ||
|
|
afc2357d5f | ||
|
|
c1ae80d25d | ||
|
|
f23d45fcb4 | ||
|
|
0b4974eb1c | ||
|
|
228d22cff0 | ||
|
|
bfb00ecb27 | ||
|
|
fefa21fa01 | ||
|
|
bb7003e557 | ||
|
|
0122aa82ef | ||
|
|
7db6c203d5 | ||
|
|
42394090df | ||
|
|
447d433457 | ||
|
|
9b54286933 | ||
|
|
d2549312d6 | ||
|
|
fdf8f44c90 | ||
|
|
30893b0184 | ||
|
|
eb7f91ffcd | ||
|
|
413e01e52c | ||
|
|
b57b3abc49 | ||
|
|
4ae9f53593 | ||
|
|
265195ca80 | ||
|
|
8b52e04c3a | ||
|
|
572a096e60 | ||
|
|
4d7b8efc3e | ||
|
|
fa32631993 | ||
|
|
ec3be81217 | ||
|
|
53c86258a6 | ||
|
|
7226ba5086 | ||
|
|
e219b8864e | ||
|
|
863ca93f0b | ||
|
|
68e0997dc9 | ||
|
|
dc29923a08 | ||
|
|
f7bc0aced8 | ||
|
|
e7c8ed1899 | ||
|
|
b8443683f9 | ||
|
|
2fda12d220 | ||
|
|
790ca0e7b6 | ||
|
|
d5dd5f4567 | ||
|
|
5b51722720 | ||
|
|
6640f8799e | ||
|
|
790dbf0fdf | ||
|
|
b7b85b10fc | ||
|
|
5505af439a | ||
|
|
cc35d3c4e5 | ||
|
|
a0f131cf86 | ||
|
|
f87942ec76 | ||
|
|
af7c088053 | ||
|
|
7af4e772bd | ||
|
|
67a0b43c81 | ||
|
|
2bff0d6882 | ||
|
|
2ab117166f | ||
|
|
8effd35d3f | ||
|
|
b1f100e3da | ||
|
|
e002b49244 | ||
|
|
bd435d4154 | ||
|
|
a869386996 | ||
|
|
a40379782e | ||
|
|
761893d1fc | ||
|
|
9f4f9b323c | ||
|
|
48fd585620 | ||
|
|
96ad106ee1 | ||
|
|
e2b0297d18 | ||
|
|
d6fa69d26e | ||
|
|
cba3f1115f | ||
|
|
5568521cd1 | ||
|
|
a5a2db577f | ||
|
|
b6387b9eaf | ||
|
|
0f2618b21d | ||
|
|
0465637335 | ||
|
|
e71072b90b | ||
|
|
289e78c136 | ||
|
|
001ab61b37 | ||
|
|
16395012d1 | ||
|
|
5497967665 | ||
|
|
0115ae6da4 | ||
|
|
50159d47c2 | ||
|
|
f910219c7a | ||
|
|
a7e065ddb4 | ||
|
|
d20a7c4996 | ||
|
|
7b9880aaab | ||
|
|
9966387002 | ||
|
|
d37c0eb477 |
@@ -1,7 +1,5 @@
|
||||
.github
|
||||
docs
|
||||
examples
|
||||
hack
|
||||
site
|
||||
travis
|
||||
*.md
|
||||
|
||||
8
.github/dependabot.yml
vendored
8
.github/dependabot.yml
vendored
@@ -4,3 +4,11 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
- package-ecosystem: gomod
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
open-pull-requests-limit: 10
|
||||
vulnerability-alerts:
|
||||
enabled: true
|
||||
6
.github/workflows/apidiff.yml
vendored
6
.github/workflows/apidiff.yml
vendored
@@ -13,15 +13,15 @@ jobs:
|
||||
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository)
|
||||
steps:
|
||||
- name: Clone the code
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.work
|
||||
- name: Execute go-apidiff
|
||||
uses: joelanford/go-apidiff@v0.6.0
|
||||
uses: joelanford/go-apidiff@v0.8.2
|
||||
with:
|
||||
compare-imports: true
|
||||
print-compatible: true
|
||||
|
||||
39
.github/workflows/go.yml
vendored
39
.github/workflows/go.yml
vendored
@@ -10,16 +10,33 @@ permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
conditional-changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
doc: ${{ steps.filter.outputs.doc }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
doc:
|
||||
- 'site/**'
|
||||
|
||||
lint:
|
||||
name: Lint
|
||||
needs: conditional-changes
|
||||
if: needs.conditional-changes.outputs.doc == 'false'
|
||||
runs-on: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.work
|
||||
id: go
|
||||
@@ -30,12 +47,14 @@ jobs:
|
||||
|
||||
test-linux:
|
||||
name: Test Linux
|
||||
needs: conditional-changes
|
||||
if: needs.conditional-changes.outputs.doc == 'false'
|
||||
runs-on: [ubuntu-latest]
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.work
|
||||
id: go
|
||||
@@ -46,12 +65,14 @@ jobs:
|
||||
|
||||
test-macos:
|
||||
name: Test MacOS
|
||||
needs: conditional-changes
|
||||
if: needs.conditional-changes.outputs.doc == 'false'
|
||||
runs-on: [macos-latest]
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.work
|
||||
id: go
|
||||
@@ -62,12 +83,14 @@ jobs:
|
||||
|
||||
test-windows:
|
||||
name: Test Windows
|
||||
needs: conditional-changes
|
||||
if: needs.conditional-changes.outputs.doc == 'false'
|
||||
runs-on: [windows-latest]
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.work
|
||||
id: go
|
||||
|
||||
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -13,11 +13,11 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Go 1.x
|
||||
uses: actions/setup-go@v3
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.work
|
||||
id: go
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
run:
|
||||
deadline: 5m
|
||||
go: '1.20'
|
||||
go: '1.21'
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
@@ -34,6 +34,11 @@ linters:
|
||||
- golint
|
||||
- maintidx
|
||||
- nosnakecase
|
||||
- testpackage # it's better to keep tests in the same package for now because kustomize does open box testing
|
||||
- structcheck # abandoned by author
|
||||
- varcheck # abandoned by author
|
||||
- maligned # abandoned by author
|
||||
- interfacer # archived by author
|
||||
|
||||
linters-settings:
|
||||
dupl:
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
[CNCF Code of Conduct]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md
|
||||
[Kubernetes Community Membership]: https://github.com/kubernetes/community/blob/master/community-membership.md
|
||||
|
||||
[Kustomize Architecture]: ARCHITECTURE.md
|
||||
[Contribution Guide]: https://kubectl.docs.kubernetes.io/contributing/kustomize/
|
||||
[MacOS Dev Guide]: https://kubectl.docs.kubernetes.io/contributing/kustomize/mac/
|
||||
[Windows Dev Guide]: https://kubectl.docs.kubernetes.io/contributing/kustomize/windows/
|
||||
@@ -25,13 +26,88 @@ _As contributors and maintainers of this project, and in the interest of fosteri
|
||||
|
||||
## Getting Started
|
||||
|
||||
Dev guides:
|
||||
### Forking Kustomize and Working Locally
|
||||
The Kustomize project uses a "Fork and Pull" workflow that is standard to GitHub. In git terms, your personal fork is referred to as the "origin" and the actual project's git repository is called "upstream". To keep your personal branch (origin) up to date with the project (upstream), it must be configured within your local working copy.
|
||||
|
||||
- [Contribution Guide]
|
||||
- [MacOS Dev Guide]
|
||||
- [Windows Dev Guide]
|
||||
### Create a fork in GitHub
|
||||
1. Visit https://github.com/kubernetes-sigs/kustomize
|
||||
2. Click the `Fork` button on the top right
|
||||
|
||||
General resources for contributors:
|
||||
### Clone the repository
|
||||
```bash
|
||||
# Clone your repository fork from the previous step
|
||||
git clone --recurse-submodules git@github.com:<your github username>/kustomize.git
|
||||
cd kustomize
|
||||
|
||||
# Configure upstream
|
||||
git remote add upstream https://github.com/kubernetes-sigs/kustomize
|
||||
git remote set-url --push upstream no_push
|
||||
|
||||
# Review git configuration
|
||||
git remote -v
|
||||
```
|
||||
|
||||
### Create a working branch
|
||||
```bash
|
||||
# Fetch changes from upstream master
|
||||
cd kustomize
|
||||
git fetch upstream
|
||||
git checkout master
|
||||
git rebase upstream/master
|
||||
|
||||
# Create your working branch
|
||||
git checkout -b myfeature
|
||||
```
|
||||
|
||||
### Sync your working branch
|
||||
You will need to periodically fetch changes from the `upstream` repository to keep your working branch in sync.
|
||||
```bash
|
||||
cd kustomize
|
||||
git fetch upstream
|
||||
git checkout myfeature
|
||||
git rebase upstream/master
|
||||
```
|
||||
|
||||
### Push to GitHub
|
||||
When your changes are ready for review, push your working branch to your fork on GitHub.
|
||||
```bash
|
||||
cd kustomize
|
||||
git push origin myfeature
|
||||
```
|
||||
|
||||
### Create a Pull Request
|
||||
1. Visit your fork at `https://github.com/<user>/kustomize`
|
||||
2. Click the **Compare & Pull Request** button next to your `myfeature` branch.
|
||||
3. Check out the pull request [process](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md) for more details and advice.
|
||||
|
||||
If you ran `git push` in the previous step, GitHub will return a useful link to create a Pull Request.
|
||||
|
||||
|
||||
### Build Kustomize
|
||||
The [Kustomize Architecture] document describes the respository organization and the kustomize build process.
|
||||
```bash
|
||||
# For go version >= 1.13
|
||||
unset GOPATH
|
||||
unset GO111MODULES
|
||||
|
||||
# Build kustomize binary and install in go bin path
|
||||
cd kustomize
|
||||
make kustomize
|
||||
|
||||
# Run unit tests
|
||||
make test-unit-all
|
||||
|
||||
# Run linter
|
||||
make lint
|
||||
|
||||
# Test examples against HEAD
|
||||
make test-examples-kustomize-against-HEAD
|
||||
|
||||
# Run your development version
|
||||
~/go/bin/kustomize version
|
||||
```
|
||||
|
||||
### General resources for contributors
|
||||
|
||||
- [Contributor License Agreement] - Kubernetes projects require that you sign a Contributor License Agreement (CLA) before we can accept your pull requests.
|
||||
- [Kubernetes Contributor Guide] - Main contributor documentation.
|
||||
@@ -166,10 +242,8 @@ behavior, do your best to explain to the user why this is the case.
|
||||
- If it seems to be a genuine bug, you can /triage accept the issue. In addition, investigate if there are workarounds or
|
||||
alternative solutions for the user that they can try until the issue gets resolved.
|
||||
|
||||
Administrative notes:
|
||||
|
||||
- The [OWNERS file spec] is a useful resources in making changes.
|
||||
- Maintainers and admins must be added to the appropriate lists in both [Kustomize OWNERS_ALIASES] and [SIG-CLI Teams]. If this isn't done, the individual in question will lack either PR approval rights (Kustomize list) or the appropriate Github repository permissions (community list).
|
||||
The triage party for kustomize is here https://cli.triage.k8s.io/s/kustomize and can be a easy way to
|
||||
find issues that have not been triaged yet.
|
||||
|
||||
## Project/Product Managers
|
||||
|
||||
@@ -194,6 +268,11 @@ You will also be asked to help with roadmap planning, deprecation communication,
|
||||
and doing research on kustomize usage when appropriate, though these responsibilities will occur less
|
||||
frequently.
|
||||
|
||||
## Administrative notes:
|
||||
|
||||
- The [OWNERS file spec] is a useful resources in making changes.
|
||||
- Maintainers and admins must be added to the appropriate lists in both [Kustomize OWNERS_ALIASES] and [SIG-CLI Teams]. If this isn't done, the individual in question will lack either PR approval rights (Kustomize list) or the appropriate Github repository permissions (community list).
|
||||
|
||||
## Contact Information
|
||||
|
||||
- [Slack channel]
|
||||
|
||||
34
Makefile
34
Makefile
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Makefile for kustomize CLI and API.
|
||||
|
||||
LATEST_RELEASE=v5.1.1
|
||||
LATEST_RELEASE=v5.3.0
|
||||
|
||||
SHELL := /usr/bin/env bash
|
||||
GOOS = $(shell go env GOOS)
|
||||
@@ -56,26 +56,24 @@ uninstall-local-tools:
|
||||
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/gorepomod:
|
||||
cd cmd/gorepomod; \
|
||||
go install .
|
||||
cd cmd/gorepomod && go install .
|
||||
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/k8scopy:
|
||||
cd cmd/k8scopy; \
|
||||
go install .
|
||||
cd cmd/k8scopy && go install .
|
||||
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/pluginator:
|
||||
cd cmd/pluginator; \
|
||||
go install .
|
||||
cd cmd/pluginator && go install .
|
||||
|
||||
|
||||
# --- Build targets ---
|
||||
|
||||
# Build from local source.
|
||||
$(MYGOBIN)/kustomize: build-kustomize-api
|
||||
cd kustomize; \
|
||||
go install -ldflags "-X sigs.k8s.io/kustomize/api/provenance.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" \
|
||||
cd kustomize && go install -ldflags \
|
||||
"-X sigs.k8s.io/kustomize/api/provenance.buildDate=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
||||
-X sigs.k8s.io/kustomize/api/provenance.version=$(shell git describe --tags --always --dirty)" \
|
||||
.
|
||||
|
||||
kustomize: $(MYGOBIN)/kustomize
|
||||
@@ -84,11 +82,11 @@ kustomize: $(MYGOBIN)/kustomize
|
||||
# plugin-to-api compatibility checks.
|
||||
.PHONY: build-kustomize-api
|
||||
build-kustomize-api: $(MYGOBIN)/goimports $(builtinplugins)
|
||||
cd api; $(MAKE) build
|
||||
cd api && $(MAKE) build
|
||||
|
||||
.PHONY: generate-kustomize-api
|
||||
generate-kustomize-api:
|
||||
cd api; $(MAKE) generate
|
||||
cd api && $(MAKE) generate
|
||||
|
||||
|
||||
# --- Verification targets ---
|
||||
@@ -130,12 +128,8 @@ lint: $(MYGOBIN)/golangci-lint $(MYGOBIN)/goimports $(builtinplugins)
|
||||
./hack/for-each-module.sh "make lint"
|
||||
|
||||
.PHONY: apidiff
|
||||
apidiff: go-apidiff ## Run the go-apidiff to verify any API differences compared with origin/master
|
||||
$(GOBIN)/go-apidiff master --compare-imports --print-compatible --repo-path=.
|
||||
|
||||
.PHONY: go-apidiff
|
||||
go-apidiff:
|
||||
go install github.com/joelanford/go-apidiff@v0.6.0
|
||||
apidiff: $(MYGOBIN)/go-apidiff ## Run the go-apidiff to verify any API differences compared with origin/master
|
||||
go-apidiff master --compare-imports --print-compatible --repo-path=.
|
||||
|
||||
.PHONY: test-unit-all
|
||||
test-unit-all: \
|
||||
@@ -145,14 +139,14 @@ test-unit-all: \
|
||||
# This target is used by our Github Actions CI to run unit tests for all non-plugin modules in multiple GOOS environments.
|
||||
.PHONY: test-unit-non-plugin
|
||||
test-unit-non-plugin:
|
||||
./hack/for-each-module.sh "make test" "./plugin/*" 16
|
||||
./hack/for-each-module.sh "make test" "./plugin/*" 20
|
||||
|
||||
.PHONY: build-non-plugin-all
|
||||
build-non-plugin-all:
|
||||
./hack/for-each-module.sh "make build" "./plugin/*" 16
|
||||
./hack/for-each-module.sh "make build" "./plugin/*" 20
|
||||
|
||||
.PHONY: test-unit-kustomize-plugins
|
||||
test-unit-kustomize-plugins:
|
||||
test-unit-kustomize-plugins: build-kustomize-external-go-plugin
|
||||
./hack/testUnitKustomizePlugins.sh
|
||||
|
||||
.PHONY: functions-examples-all
|
||||
|
||||
@@ -96,7 +96,7 @@ generate-kustomize-builtin-plugins: $(builtplugins)
|
||||
echo "generating $${plugin} ..."; \
|
||||
set -e; \
|
||||
cd $${plugin}; \
|
||||
go generate pluginator .; \
|
||||
go generate .; \
|
||||
done
|
||||
|
||||
# Check for diff by comparing current revision of generated plugins on HEAD and newly generated plugins on local branch,
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
# Copyright 2022 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
GOLANGCI_LINT_VERSION=v1.51.2
|
||||
|
||||
GOOS = $(shell go env GOOS)
|
||||
GOARCH = $(shell go env GOARCH)
|
||||
MYGOBIN = $(shell go env GOBIN)
|
||||
ifeq ($(MYGOBIN),)
|
||||
MYGOBIN = $(shell go env GOPATH)/bin
|
||||
endif
|
||||
export PATH := $(MYGOBIN):$(PATH)
|
||||
|
||||
REPO_ROOT=$(shell git rev-parse --show-toplevel)
|
||||
|
||||
# determines whether to run tests that only behave locally; can be overridden by override variable
|
||||
export IS_LOCAL = false
|
||||
|
||||
@@ -18,8 +20,7 @@ install-out-of-tree-tools: \
|
||||
$(MYGOBIN)/golangci-lint \
|
||||
$(MYGOBIN)/helmV3 \
|
||||
$(MYGOBIN)/mdrip \
|
||||
$(MYGOBIN)/stringer \
|
||||
$(MYGOBIN)/goimports
|
||||
$(MYGOBIN)/stringer
|
||||
|
||||
.PHONY: uninstall-out-of-tree-tools
|
||||
uninstall-out-of-tree-tools:
|
||||
@@ -29,67 +30,61 @@ uninstall-out-of-tree-tools:
|
||||
rm -f $(MYGOBIN)/mdrip
|
||||
rm -f $(MYGOBIN)/stringer
|
||||
|
||||
.PHONY: $(MYGOBIN)/golangci-lint
|
||||
$(MYGOBIN)/golangci-lint:
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
|
||||
cd $(REPO_ROOT)/hack && go install github.com/golangci/golangci-lint/cmd/golangci-lint
|
||||
|
||||
.PHONY: $(MYGOBIN)/mdrip
|
||||
$(MYGOBIN)/mdrip:
|
||||
go install github.com/monopole/mdrip@v1.0.2
|
||||
cd $(REPO_ROOT)/hack && go install github.com/monopole/mdrip
|
||||
|
||||
.PHONY: $(MYGOBIN)/stringer
|
||||
$(MYGOBIN)/stringer:
|
||||
go install golang.org/x/tools/cmd/stringer@latest
|
||||
cd $(REPO_ROOT)/hack && go install golang.org/x/tools/cmd/stringer
|
||||
|
||||
.PHONY: $(MYGOBIN)/goimports
|
||||
$(MYGOBIN)/goimports:
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
cd $(REPO_ROOT)/hack && go install golang.org/x/tools/cmd/goimports
|
||||
|
||||
.PHONY: $(MYGOBIN)/mdtogo
|
||||
$(MYGOBIN)/mdtogo:
|
||||
go install sigs.k8s.io/kustomize/cmd/mdtogo@latest
|
||||
cd $(REPO_ROOT)/hack && go install sigs.k8s.io/kustomize/cmd/mdtogo
|
||||
|
||||
.PHONY: $(MYGOBIN)/addlicense
|
||||
$(MYGOBIN)/addlicense:
|
||||
go install github.com/google/addlicense@latest
|
||||
|
||||
$(MYGOBIN)/goreleaser:
|
||||
go install github.com/goreleaser/goreleaser@v0.179.0 # https://github.com/kubernetes-sigs/kustomize/issues/4542
|
||||
cd $(REPO_ROOT)/hack && go install github.com/google/addlicense
|
||||
|
||||
.PHONY: $(MYGOBIN)/kind
|
||||
$(MYGOBIN)/kind:
|
||||
( \
|
||||
set -e; \
|
||||
d=$(shell mktemp -d); cd $$d; \
|
||||
wget -O ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(GOOS)-$(GOARCH); \
|
||||
chmod +x ./kind; \
|
||||
mv ./kind $(MYGOBIN); \
|
||||
rm -rf $$d; \
|
||||
)
|
||||
cd $(REPO_ROOT)/hack && go install sigs.k8s.io/kind
|
||||
|
||||
# linux only.
|
||||
.PHONY: $(MYGOBIN)/controller-gen
|
||||
$(MYGOBIN)/controller-gen:
|
||||
cd $(REPO_ROOT)/hack && go install sigs.k8s.io/controller-tools/cmd/controller-gen
|
||||
|
||||
.PHONY: $(MYGOBIN)/embedmd
|
||||
$(MYGOBIN)/embedmd:
|
||||
cd $(REPO_ROOT)/hack && go install github.com/campoy/embedmd
|
||||
|
||||
.PHONY: $(MYGOBIN)/go-bindata
|
||||
$(MYGOBIN)/go-bindata:
|
||||
cd $(REPO_ROOT)/hack && go install github.com/go-bindata/go-bindata/v3/go-bindata
|
||||
|
||||
.PHONY: $(MYGOBIN)/go-apidiff
|
||||
$(MYGOBIN)/go-apidiff:
|
||||
cd $(REPO_ROOT)/hack && go install github.com/joelanford/go-apidiff
|
||||
|
||||
.PHONY: $(MYGOBIN)/gh
|
||||
$(MYGOBIN)/gh:
|
||||
( \
|
||||
set -e; \
|
||||
d=$(shell mktemp -d); cd $$d; \
|
||||
tgzFile=gh_1.0.0_$(GOOS)_$(GOARCH).tar.gz; \
|
||||
wget https://github.com/cli/cli/releases/download/v1.0.0/$$tgzFile; \
|
||||
tar -xvzf $$tgzFile; \
|
||||
mv gh_1.0.0_$(GOOS)_$(GOARCH)/bin/gh $(MYGOBIN)/gh; \
|
||||
rm -rf $$d \
|
||||
)
|
||||
cd $(REPO_ROOT)/hack && go install github.com/cli/cli/cmd/gh
|
||||
|
||||
# linux only.
|
||||
# This is for testing an example plugin that
|
||||
# uses kubeval for validation.
|
||||
# Don't want to add a hard dependence in go.mod file
|
||||
# to github.com/instrumenta/kubeval.
|
||||
# Instead, download the binary.
|
||||
.PHONY: $(MYGOBIN)/kubeval
|
||||
$(MYGOBIN)/kubeval:
|
||||
( \
|
||||
set -e; \
|
||||
d=$(shell mktemp -d); cd $$d; \
|
||||
wget https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-$(GOOS)-$(GOARCH).tar.gz; \
|
||||
tar xf kubeval-$(GOOS)-$(GOARCH).tar.gz; \
|
||||
mv kubeval $(MYGOBIN); \
|
||||
rm -rf $$d; \
|
||||
)
|
||||
cd $(REPO_ROOT)/hack && go install github.com/instrumenta/kubeval
|
||||
|
||||
# Helm V3 differs from helm V2; downloading it to provide coverage for the
|
||||
# chart inflator plugin under helm v3.
|
||||
.PHONY: $(MYGOBIN)/helmV3
|
||||
$(MYGOBIN)/helmV3:
|
||||
( \
|
||||
set -e; \
|
||||
|
||||
@@ -3,18 +3,28 @@
|
||||
aliases:
|
||||
kustomize-owners:
|
||||
- knverey
|
||||
- natasha41575
|
||||
- koba1t
|
||||
kustomize-approvers:
|
||||
- knverey
|
||||
- natasha41575
|
||||
- annasong20
|
||||
- koba1t
|
||||
- varshaprasad96
|
||||
kustomize-reviewers:
|
||||
- knverey
|
||||
- natasha41575
|
||||
- yuwenma
|
||||
- annasong20
|
||||
- koba1t
|
||||
- stormqueen1990
|
||||
- varshaprasad96
|
||||
- ncapps
|
||||
|
||||
docs-approvers:
|
||||
- ncapps
|
||||
docs-reviewers:
|
||||
- ncapps
|
||||
|
||||
commands-approvers:
|
||||
- stormqueen1990
|
||||
commands-reviewers:
|
||||
- stormqueen1990
|
||||
|
||||
# emeritus:
|
||||
# - liujingfang1
|
||||
# - Shell32-Natsu
|
||||
@@ -24,3 +34,6 @@ aliases:
|
||||
# - mengqiy
|
||||
# - mortent
|
||||
# - phanimarupaka
|
||||
# - natasha41575
|
||||
# - annasong20
|
||||
# - yuwenma
|
||||
|
||||
@@ -76,7 +76,7 @@ kustomization.yaml deployment.yaml
|
||||
+---------------------------------------------+ +-------------------------------------------------------+ +-----------------------------------+
|
||||
| apiVersion: kustomize.config.k8s.io/v1beta1 | | apiVersion: apps/v1 | | apiVersion: v1 |
|
||||
| kind: Kustomization | | kind: Deployment | | kind: Service |
|
||||
|.commonLabels: | | metadata: | | metadata: |
|
||||
| commonLabels: | | metadata: | | metadata: |
|
||||
| app: myapp | | name: myapp | | name: myapp |
|
||||
| resources: | | spec: | | spec: |
|
||||
| - deployment.yaml | | selector: | | selector: |
|
||||
|
||||
241
ROADMAP.md
241
ROADMAP.md
@@ -1,112 +1,185 @@
|
||||
# Kustomize roadmap 2022
|
||||
# Kustomize roadmap 2023-2024
|
||||
|
||||
Presented at the [January 26, 2022, SIG-CLI meeting](https://youtu.be/l2plzJ9MRlk?t=1321)
|
||||
This document describes the items that we hope to make progress on over the next
|
||||
1 year (H2 2023 and H1 2024). Take this roadmap as more of what we hope to achieve
|
||||
rather than what we promise to achieve, as some items in this doc are highly dependent
|
||||
on the success that we have on-ramping new contributors to the project, and other
|
||||
items will depend on external contributions, which can vary.
|
||||
|
||||
kustomize maintainers: @knverey, @natasha41575
|
||||
If you are interested in contributing to a particular area, you can look through
|
||||
the project board for that area and assign yourself to one of the issues. It is
|
||||
recommended to start with smaller issues to ramp up on the project before starting
|
||||
to tackle larger issues.
|
||||
|
||||
[Objective: Improve contributor community](#objective-improve-contributor-community)
|
||||
Project boards:
|
||||
https://github.com/orgs/kubernetes-sigs/projects/50
|
||||
https://github.com/orgs/kubernetes-sigs/projects/51
|
||||
https://github.com/orgs/kubernetes-sigs/projects/52
|
||||
https://github.com/orgs/kubernetes-sigs/projects/53
|
||||
https://github.com/orgs/kubernetes-sigs/projects/54
|
||||
|
||||
[Objective: Improve end-user experience](#objective-improve-end-user-experience)
|
||||
## Kustomize contributors (at time of writing):
|
||||
|
||||
[Objective: Improve extension experience](#objective-improve-extension-experience)
|
||||
kustomize owner: @natasha41575
|
||||
|
||||
## Objective: Improve contributor community
|
||||
kustomize maintainers: @annasong20, @koba1t
|
||||
|
||||
**_WHO: End user who also contributes source code._**
|
||||
|
||||
Top priority:
|
||||
|
||||
- Kustomization v1 (also end-user impact) ([PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/12))
|
||||
- Remove the following fields:
|
||||
- [vars](https://github.com/kubernetes-sigs/kustomize/issues/2052)
|
||||
- [patchesJson6902, patchesStrategicMerge (consolidate on \`patches)](https://github.com/kubernetes-sigs/kustomize/issues/4376)
|
||||
- [helmChartInflationGenerator, helmCharts, helmGlobals](https://github.com/kubernetes-sigs/kustomize/issues/4401)
|
||||
- all long-deprecated fields in Kustomization v1 such as \`bases\` and those being accommodate by kustomize edit \[[see code snippet](https://github.com/kubernetes-sigs/kustomize/blob/ee4b7847f0beb6c0d2070673b10f23f7b3e92e82/api/types/fix.go#L15)\]
|
||||
- Ensure that \`kustomize edit fix\` handles migrations for all those, and that anything it changes is not still present in v1.
|
||||
- [Add reorder field](https://github.com/kubernetes-sigs/kustomize/issues/3913). Default should be FIFO and legacy should also be supported (could add alphabetic and custom sort support eventually). Replaces -reorder flag.
|
||||
- [Reconcile openapi and crds field](https://github.com/kubernetes-sigs/kustomize/issues/3944)
|
||||
- [Consider deprecating configurations field](https://github.com/kubernetes-sigs/kustomize/issues/3945) (old, pre-plugin, pre-openapi global configuration)
|
||||
- [Add a field to enable the managedby label](https://github.com/kubernetes-sigs/kustomize/issues/4047)
|
||||
|
||||
Second priority:
|
||||
|
||||
- Improve contributor documentation
|
||||
- [Instructions to upgrade kustomize-in-kubectl](https://github.com/kubernetes-sigs/kustomize/issues/3951)
|
||||
|
||||
Also very valuable to the project:
|
||||
|
||||
- [Improve the release process](https://github.com/kubernetes-sigs/kustomize/issues/3952) to support regular biweekly releases [PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/7)
|
||||
- Release sigs.k8s.io/kustomize/api v1.0.0 [PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/5)
|
||||
- [Reduce the public surface of the API module](https://github.com/kubernetes-sigs/kustomize/issues/3942)
|
||||
- [Vendor all transitive deps](https://github.com/kubernetes-sigs/kustomize/issues/3706). Since kustomize is in kubectl, we must do as kubectl does to manage deps, exposing new transitive deps in code review.
|
||||
- Project administration
|
||||
- [Rename master branch to main](https://github.com/kubernetes-sigs/kustomize/issues/3954)
|
||||
kustomize contributors: @varshaprasad96
|
||||
|
||||
|
||||
# H2 2023
|
||||
|
||||
## Objective: Improve end-user experience
|
||||
## Goal: Create kustomize leadership and contributor playbooks
|
||||
|
||||
**_WHO: End user that wants kustomize build artifacts (binaries, containers)._**
|
||||
Contributors: natasha41575, annasong20
|
||||
|
||||
Top priorities:
|
||||
Priority: High
|
||||
|
||||
- Bug fixes:
|
||||
- Fix bugs in basic anchor support: [issue query](https://github.com/kubernetes-sigs/kustomize/issues?q=is%3Aopen+is%3Aissue+label%3Aarea%2Fanchors)
|
||||
- integer keys support: [#3446](https://github.com/kubernetes-sigs/kustomize/issues/3446)
|
||||
- kyaml not respecting \`$patch replace|retainKeys\`: [#2037](https://github.com/kubernetes-sigs/kustomize/issues/2037)
|
||||
- kustomize removing quotes from namespace field values: [#4146](https://github.com/kubernetes-sigs/kustomize/issues/4146)
|
||||
- Kustomize doesn’t support metadata.generateName: [#641](https://github.com/kubernetes-sigs/kustomize/issues/641)
|
||||
- Send kustomize CLI version number into kubectl ([kubectl issue](https://github.com/kubernetes/kubectl/issues/797) / [kustomize issue](https://github.com/kubernetes-sigs/kustomize/issues/1424))
|
||||
- Kustomize performance investigations/improvements [PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/13)
|
||||
- [Support generic resource references in name reference tracking](https://github.com/kubernetes-sigs/kustomize/issues/3418)
|
||||
- [KEP 4267: retain the resource origin and transformer data in annotations](https://github.com/kubernetes-sigs/kustomize/pull/4267)
|
||||
Effort: Medium
|
||||
|
||||
Secondary priorities:
|
||||
In the past, when the leads stopped contributing (for various reasons, not covered here)
|
||||
in various kubernetes projects, it left a wide hole that few could easily fill,
|
||||
leaving the remaining leads in a bad position and the project understaffed. We should assume
|
||||
that we will need to onboard new maintainers in the future, and should have playbooks
|
||||
for doing so. As we grow the contributor base in kustomize, we will build these playbooks for
|
||||
those who are contributing and those who are looking to grow into kustomize leaders.
|
||||
To ensure the long term health and stability of the project, we should have:
|
||||
|
||||
- kustomize cli v5 ([PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/14))
|
||||
- [Drop the --reorder flag](https://github.com/kubernetes-sigs/kustomize/issues/3947)
|
||||
- [Graduate cfg read-only commands out of alpha](https://github.com/kubernetes-sigs/kustomize/issues/4090).
|
||||
- [Drop the –enable-managedby-label](https://github.com/kubernetes-sigs/kustomize/issues/4047)
|
||||
- Drop old plugin-related fields in favor of [the Catalog-style fields](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2906-kustomize-function-catalog).
|
||||
- [Drop the helm flags](https://github.com/kubernetes-sigs/kustomize/issues/4401)
|
||||
- [Confusion around namespace replacement](https://github.com/kubernetes-sigs/kustomize/issues/880).
|
||||
- On-boarding guides for new contributors
|
||||
- Clear guidelines for how to climb the kustomize ladder from contributor to approver to owner
|
||||
- A plan (maybe a schedule) for future kustomize cohorts
|
||||
- A succession plan, in case the current kustomize leads ever decide to step down
|
||||
|
||||
Also very valuable to the project:
|
||||
## Goal: Onboard 2-5 new contributors to kustomize
|
||||
|
||||
- [Overinclusion of root directory error in error messages](https://github.com/kubernetes-sigs/kustomize/issues/4348)
|
||||
- [Add kustomize localize command](https://github.com/kubernetes-sigs/kustomize/issues/3980)
|
||||
- [Fix Windows support in test suite](https://github.com/kubernetes-sigs/kustomize/issues/4001)
|
||||
- Improve end-user documentation [PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/9)
|
||||
Contributors: natasha41575, annasong20, koba1t
|
||||
|
||||
Priority: High
|
||||
|
||||
## Objective: Improve extension experience
|
||||
Effort: High
|
||||
|
||||
**_WHO: Plugin developers: end users who extend kustomize, but don’t think about internals._**
|
||||
In order to make progress on kustomize goals in the future, we need to increase the
|
||||
level of staffing on kustomize. We should leverage community contributions to keep kustomize
|
||||
healthy and making progress.
|
||||
|
||||
This objective is described in detail in the [Kustomize Plugin Graduation KEP](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2953-kustomize-plugin-graduation) / [PROJECT](https://github.com/kubernetes-sigs/kustomize/projects/15) .
|
||||
The primary means in which we will try to find new kustomize contributors is through the new kustomize
|
||||
maintainer training cohort. We will lead a group of ~20 kubernetes community members through a 3-6 month
|
||||
training program, involving talk sessions, bug scrubs, issue triage, PR reviews, and coding projects for
|
||||
each member.
|
||||
|
||||
Top priorities:
|
||||
See [our call for help](https://groups.google.com/a/kubernetes.io/g/dev/c/M5OphEVsv5o/m/zc6G4H15AAAJ) for more
|
||||
specific details about the program.
|
||||
|
||||
- Fix core usability issues with KRM Function extensions:
|
||||
- [Better errors for function config failures](https://github.com/kubernetes-sigs/kustomize/issues/4398)
|
||||
- [Container KRM Mounts are not mounting via function parameters](https://github.com/kubernetes-sigs/kustomize/issues/4290)
|
||||
- [Resolution of local file references in extensions transformer configuration](https://github.com/kubernetes-sigs/kustomize/issues/4154)
|
||||
- [Do not silently ignore plugins when config has typo](https://github.com/kubernetes-sigs/kustomize/issues/4399)
|
||||
- [KRM Exec Function can't locate executable when referencing a base](https://github.com/kubernetes-sigs/kustomize/issues/4347)
|
||||
- Once core usability issues are fixed, [deprecate legacy exec and Go plugin support](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2953-kustomize-plugin-graduation)
|
||||
- [Catalog KEP](https://github.com/kubernetes/enhancements/tree/master/keps/sig-cli/2906-kustomize-function-catalog)
|
||||
The effort from existing kustomize maintainers here will be to:
|
||||
- Organize the cohort, so that each cohort member feels productive and understands what they should work on
|
||||
- Align motivation of the cohort members with the work that we assign to them.
|
||||
- Review PRs from cohort members in a timely manner.
|
||||
- Be the point(s) of contact for questions/escalations
|
||||
- Lead weekly stand-ups and monthly bug scrubs
|
||||
|
||||
Secondary priorities:
|
||||
At the end of all this, if we have a small team of contributors to kustomize, who understand its founding
|
||||
philosophy and intentions, we should be able to keep the project up to date.
|
||||
|
||||
- [Remove Starlark support](https://github.com/kubernetes-sigs/kustomize/issues/4349)
|
||||
- [Composition KEP](https://github.com/kubernetes/enhancements/pull/2300). The implementation is complete in [#4223](https://github.com/kubernetes-sigs/kustomize/pull/4323), but depends on:
|
||||
- [Convert resources and components to be backed by a reusable generator](https://github.com/kubernetes-sigs/kustomize/issues/4402)
|
||||
- [Enable explicitly invoked transformers to use default fieldSpecs](https://github.com/kubernetes-sigs/kustomize/issues/4404)
|
||||
- [Enable built-in generators to be used in the transformers field ](https://github.com/kubernetes-sigs/kustomize/issues/4403)
|
||||
## Goal: Improve kustomize extensibility through KRM functions and CRD support
|
||||
|
||||
Contributors: koba1t, varshaprasad96, external contributors
|
||||
|
||||
Also very valuable to the project:
|
||||
Priority: High
|
||||
|
||||
- [Improve docs for kyaml libraries](https://github.com/kubernetes-sigs/kustomize/issues/3950), especially by adding examples.
|
||||
- [Create a reserved field for plugin runtime information](https://github.com/kubernetes-sigs/kustomize/issues/4405)
|
||||
- [Develop new standard process for implementing builtin transformers](https://github.com/kubernetes-sigs/kustomize/issues/4400)
|
||||
Effort: High
|
||||
|
||||
Project board: https://github.com/orgs/kubernetes-sigs/projects/53/views/1
|
||||
|
||||
For a long time, we have supported KRM functions as the proper way to implement custom generators and transformers.
|
||||
However, due to limited staffing, we have been unable to drive this feature out of alpha in kustomize. The two
|
||||
main features which we hope to make progress on are Composition and Catalog, two long-standing proposals for which
|
||||
numerous users have been waiting for a long time. There are several open issues
|
||||
regarding KRM functions where our long-term answer has been these two features, but users have been hearing about them
|
||||
for over a year without seeing any progress. If we can implement them, they will vastly improve usability and security
|
||||
of KRM functions.
|
||||
|
||||
One item that falls under this category that does not currently have a contributor is improving CRD support.
|
||||
Currently, it is difficult to use CRDs properly, as there are three different fields (configurations, openapi, and crds)
|
||||
where users have to input their CRD configuration. We need to consolidate these fields into one easy to use feature to
|
||||
support CRDs. If you are interested in putting together a design proposal for how to tackle this task, please reach
|
||||
out to the kustomize maintainers.
|
||||
|
||||
# H1 2024
|
||||
|
||||
## Goal: Improve the kustomize documentation
|
||||
|
||||
Contributors: annasong20, external contributions
|
||||
|
||||
Priority: High
|
||||
|
||||
Effort: High
|
||||
|
||||
Project board: https://github.com/orgs/kubernetes-sigs/projects/50
|
||||
|
||||
The kustomize documentation is currently fragmented, out of date, and lacks examples to fully understand its value.
|
||||
We have had a "docs project" for a long time; we need to prioritize implementing it so that the documentation is in
|
||||
one place, easy to find, and helps new users get started more easily. Some outcomes from this project should be:
|
||||
|
||||
- A single, unified website hosted on kustomize.io
|
||||
- Updated information architecture, and a plan to keep it up to date
|
||||
- End to end examples of using kustomize, including complex use cases
|
||||
|
||||
## Goal: Fix core usability bugs in kustomize
|
||||
|
||||
Contributors: external contributions
|
||||
|
||||
Priority: High
|
||||
|
||||
Effort: High
|
||||
|
||||
Project board: https://github.com/orgs/kubernetes-sigs/projects/51
|
||||
|
||||
There are several core usability issues that block some users from adopting kustomize features or in
|
||||
some base block users from using kustomize entirely. These issues range from small bugs with workable but
|
||||
inconvenient workarounds, to enormous feature gaps.
|
||||
|
||||
As part of this goal, we should work toward reducing the number of such issues that we have, making
|
||||
kustomize work more smoothly and predictably, and be usable for a larger range of users.
|
||||
|
||||
There are a lot of important issues in this project, but the biggest and highest priority one is that
|
||||
kustomize doesn't currently support metadata.GenerateName. Unfortunately, we don't currently have anyone
|
||||
actively working on this issue, we would need an external contributor to reach out to the kustomize
|
||||
maintainers to pick it up.
|
||||
|
||||
## Goal: Improve kustomize CI, release, & security patch processes
|
||||
|
||||
Contributors: external contributions
|
||||
|
||||
Priority: Medium
|
||||
|
||||
Effort: High
|
||||
|
||||
Project board: https://github.com/orgs/kubernetes-sigs/projects/54
|
||||
|
||||
The kustomize release process is currently done on-demand and is strictly linear. This means that if we find a CVE,
|
||||
we are forced to release the next version of kustomize ASAP, and we are required to release every PR that has merged
|
||||
since the last release. This can put us in a sticky situation if we have a breaking change that we are
|
||||
not ready to release yet, but we need a patch quickly.
|
||||
|
||||
We should try to improve the kustomize release process so that we can release frequently, reliably, and with some
|
||||
flexibility. The outcome of this effort should be:
|
||||
|
||||
- kustomize is released on a regular cadence (biweekly or monthly)
|
||||
- kustomize is able to separate patch and feature releases, so that we can fix CVEs without needing to release
|
||||
everything that we have in flight
|
||||
- We can detect and fix CVEs early
|
||||
|
||||
## Goal: Take long-standing alpha commands out of alpha
|
||||
|
||||
Contributors: external contributions
|
||||
|
||||
Priority: Medium
|
||||
|
||||
Effort: Medium
|
||||
|
||||
Project board: https://github.com/orgs/kubernetes-sigs/projects/52
|
||||
|
||||
There are several commands in kustomize that have been alpha for a long time, including the cfg command group and
|
||||
localize. Moving them forward can indicate good health of a project and these commands are useful to many users.
|
||||
Some of these projects can be good starter issues for new contributors to have an easier onramp while others will
|
||||
require more effort and thought.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#
|
||||
# DO NOT REPORT SECURITY VULNERABILITIES DIRECTLY TO THESE NAMES, FOLLOW THE
|
||||
# INSTRUCTIONS AT https://kubernetes.io/security/
|
||||
|
||||
monopole
|
||||
Liujingfang1
|
||||
pwittrock
|
||||
eddiezane
|
||||
KnVerey
|
||||
natasha41575
|
||||
soltysh
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/filters/fieldspec"
|
||||
"sigs.k8s.io/kustomize/api/filters/filtersutil"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
@@ -621,7 +622,7 @@ kind: Pod
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
err := yaml.Unmarshal([]byte(tc.fieldSpec), &filter.FieldSpec)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
rw := &kio.ByteReadWriter{
|
||||
Reader: bytes.NewBufferString(tc.input),
|
||||
Writer: &bytes.Buffer{},
|
||||
@@ -635,7 +636,7 @@ kind: Pod
|
||||
Outputs: []kio.Writer{rw},
|
||||
}.Execute()
|
||||
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tc.expected, fieldPaths)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -284,9 +284,9 @@ func (f Filter) roleRefFilter() sieveFunc {
|
||||
return previousIdSelectedByGvk(roleRefGvk)
|
||||
}
|
||||
|
||||
func prefixSuffixEquals(other resource.ResCtx) sieveFunc {
|
||||
func prefixSuffixEquals(other resource.ResCtx, allowEmpty bool) sieveFunc {
|
||||
return func(r *resource.Resource) bool {
|
||||
return r.PrefixesSuffixesEquals(other)
|
||||
return r.PrefixesSuffixesEquals(other, allowEmpty)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,7 +325,10 @@ func (f Filter) selectReferral(
|
||||
if len(candidates) == 1 {
|
||||
return candidates[0], nil
|
||||
}
|
||||
candidates = doSieve(candidates, prefixSuffixEquals(f.Referrer))
|
||||
candidates = doSieve(candidates, prefixSuffixEquals(f.Referrer, true))
|
||||
if len(candidates) > 1 {
|
||||
candidates = doSieve(candidates, prefixSuffixEquals(f.Referrer, false))
|
||||
}
|
||||
if len(candidates) == 1 {
|
||||
return candidates[0], nil
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package patchjson6902
|
||||
import (
|
||||
"strings"
|
||||
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v5"
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v4"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
k8syaml "sigs.k8s.io/yaml"
|
||||
|
||||
30
api/go.mod
30
api/go.mod
@@ -1,37 +1,35 @@
|
||||
module sigs.k8s.io/kustomize/api
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/blang/semver/v4 v4.0.0
|
||||
github.com/go-errors/errors v1.4.2
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
github.com/imdario/mergo v0.3.13
|
||||
github.com/stretchr/testify v1.8.1
|
||||
gopkg.in/evanphx/json-patch.v5 v5.6.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
go.uber.org/goleak v1.3.0
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
|
||||
sigs.k8s.io/kustomize/kyaml v0.17.0
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
59
api/go.sum
59
api/go.sum
@@ -1,37 +1,41 @@
|
||||
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
|
||||
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
|
||||
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
|
||||
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
|
||||
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.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -42,11 +46,13 @@ github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 h1:n6/
|
||||
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/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
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/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
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=
|
||||
@@ -55,38 +61,39 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
||||
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=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
|
||||
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 h1:+FNtrFTmVw0YZGpBGX56XDee331t6JAXeK2bcyhLOOc=
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
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/evanphx/json-patch.v5 v5.6.0 h1:BMT6KIwBD9CaU91PJCZIe46bDmBWa9ynTQgJIOpfQBk=
|
||||
gopkg.in/evanphx/json-patch.v5 v5.6.0/go.mod h1:/kvTRh1TVm5wuM6OkHxqXtE/1nUZZpihg29RtuIyfvk=
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4=
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M=
|
||||
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=
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961 h1:pqRVJGQJz6oeZby8qmPKXYIBjyrcv7EHCe/33UkZMYA=
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961/go.mod h1:l8HTwL5fqnlns4jOveW1L75eo7R9KFHxiE0bsPGy428=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0 h1:ynlLMAxDhrY9otSg5GYE2TcIz31XkGZ2Pkj7SdolD84=
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0/go.mod h1:+uMkBahdU1KNOj78Uta4rrXH+iH7wvg+nW7+GULvREA=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/kustomize/kyaml v0.17.0 h1:G2bWs03V9Ur2PinHLzTUJ8Ded+30SzXZKiO92SRDs3c=
|
||||
sigs.k8s.io/kustomize/kyaml v0.17.0/go.mod h1:6lxkYF1Cv9Ic8g/N7I86cvxNc5iinUo/P2vKsHNmpyE=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -12,11 +12,12 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/imdario/mergo"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
kyaml "sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml/merge2"
|
||||
"sigs.k8s.io/yaml"
|
||||
)
|
||||
|
||||
@@ -53,6 +54,15 @@ func (p *HelmChartInflationGeneratorPlugin) Config(
|
||||
if h.GeneralConfig().HelmConfig.Command == "" {
|
||||
return fmt.Errorf("must specify --helm-command")
|
||||
}
|
||||
|
||||
// CLI args takes precedence
|
||||
if h.GeneralConfig().HelmConfig.KubeVersion != "" {
|
||||
p.HelmChart.KubeVersion = h.GeneralConfig().HelmConfig.KubeVersion
|
||||
}
|
||||
if len(h.GeneralConfig().HelmConfig.ApiVersions) != 0 {
|
||||
p.HelmChart.ApiVersions = h.GeneralConfig().HelmConfig.ApiVersions
|
||||
}
|
||||
|
||||
p.h = h
|
||||
if err = yaml.Unmarshal(config, p); err != nil {
|
||||
return
|
||||
@@ -91,7 +101,7 @@ func (p *HelmChartInflationGeneratorPlugin) validateArgs() (err error) {
|
||||
// be under the loader root (unless root restrictions are
|
||||
// disabled).
|
||||
if p.ValuesFile == "" {
|
||||
p.ValuesFile = filepath.Join(p.ChartHome, p.Name, "values.yaml")
|
||||
p.ValuesFile = filepath.Join(p.absChartHome(), p.Name, "values.yaml")
|
||||
}
|
||||
for i, file := range p.AdditionalValuesFiles {
|
||||
// use Load() to enforce root restrictions
|
||||
@@ -132,10 +142,17 @@ func (p *HelmChartInflationGeneratorPlugin) errIfIllegalValuesMerge() error {
|
||||
}
|
||||
|
||||
func (p *HelmChartInflationGeneratorPlugin) absChartHome() string {
|
||||
var chartHome string
|
||||
if filepath.IsAbs(p.ChartHome) {
|
||||
return p.ChartHome
|
||||
chartHome = p.ChartHome
|
||||
} else {
|
||||
chartHome = filepath.Join(p.h.Loader().Root(), p.ChartHome)
|
||||
}
|
||||
return filepath.Join(p.h.Loader().Root(), p.ChartHome)
|
||||
|
||||
if p.Version != "" && p.Repo != "" {
|
||||
return filepath.Join(chartHome, fmt.Sprintf("%s-%s", p.Name, p.Version))
|
||||
}
|
||||
return chartHome
|
||||
}
|
||||
|
||||
func (p *HelmChartInflationGeneratorPlugin) runHelmCommand(
|
||||
@@ -185,18 +202,33 @@ func (p *HelmChartInflationGeneratorPlugin) replaceValuesInline() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
chValues := make(map[string]interface{})
|
||||
if err = yaml.Unmarshal(pValues, &chValues); err != nil {
|
||||
return err
|
||||
chValues, err := kyaml.Parse(string(pValues))
|
||||
if err != nil {
|
||||
return errors.WrapPrefixf(err, "could not parse values file into rnode")
|
||||
}
|
||||
inlineValues, err := kyaml.FromMap(p.ValuesInline)
|
||||
if err != nil {
|
||||
return errors.WrapPrefixf(err, "could not parse values inline into rnode")
|
||||
}
|
||||
var outValues *kyaml.RNode
|
||||
switch p.ValuesMerge {
|
||||
// Function `merge2.Merge` overrides values in dest with values from src.
|
||||
// To achieve override or merge behavior, we pass parameters in different order.
|
||||
// Object passed as dest will be modified, so we copy it just in case someone
|
||||
// decides to use it after this is called.
|
||||
case valuesMergeOptionOverride:
|
||||
err = mergo.Merge(
|
||||
&chValues, p.ValuesInline, mergo.WithOverride)
|
||||
outValues, err = merge2.Merge(inlineValues, chValues.Copy(), kyaml.MergeOptions{})
|
||||
case valuesMergeOptionMerge:
|
||||
err = mergo.Merge(&chValues, p.ValuesInline)
|
||||
outValues, err = merge2.Merge(chValues, inlineValues.Copy(), kyaml.MergeOptions{})
|
||||
}
|
||||
p.ValuesInline = chValues
|
||||
if err != nil {
|
||||
return errors.WrapPrefixf(err, "could not merge values")
|
||||
}
|
||||
mapValues, err := outValues.Map()
|
||||
if err != nil {
|
||||
return errors.WrapPrefixf(err, "could not parse merged values into map")
|
||||
}
|
||||
p.ValuesInline = mapValues
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package builtins
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v5"
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v4"
|
||||
"sigs.k8s.io/kustomize/api/filters/patchjson6902"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v5"
|
||||
jsonpatch "gopkg.in/evanphx/json-patch.v4"
|
||||
"sigs.k8s.io/kustomize/api/filters/patchjson6902"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
|
||||
@@ -144,7 +144,7 @@ func reportFSysDiff(t *testing.T, fSysExpected filesys.FileSystem, fSysActual fi
|
||||
actualContent, readErr := fSysActual.ReadFile(path)
|
||||
require.NoError(t, readErr)
|
||||
expectedContent, findErr := fSysExpected.ReadFile(path)
|
||||
assert.NoErrorf(t, findErr, "unexpected file %q", path)
|
||||
require.NoErrorf(t, findErr, "unexpected file %q", path)
|
||||
if findErr == nil {
|
||||
assert.Equal(t, string(expectedContent), string(actualContent))
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func loadDefaultConfig(
|
||||
// makeTransformerConfigFromBytes returns a TransformerConfig object from bytes
|
||||
func makeTransformerConfigFromBytes(data []byte) (*TransformerConfig, error) {
|
||||
var t TransformerConfig
|
||||
err := yaml.Unmarshal(data, &t)
|
||||
err := yaml.UnmarshalStrict(data, &t)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package builtinconfig
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/internal/loader"
|
||||
@@ -44,3 +45,55 @@ namePrefix:
|
||||
t.Fatalf("expected %v\n but go6t %v\n", expected, tCfg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadDefaultConfigsFromFilesWithMissingFields(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
filePathContainsTypo := "config_contains_typo.yaml"
|
||||
if err := fSys.WriteFile(filePathContainsTypo, []byte(`
|
||||
namoPrefix:
|
||||
- path: nameprefix/path
|
||||
kind: SomeKind
|
||||
`)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ldr, err := loader.NewLoader(
|
||||
loader.RestrictionRootOnly, filesys.Separator, fSys)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
errMsg := "error unmarshaling JSON: while decoding JSON: json: unknown field"
|
||||
_, err = loadDefaultConfig(ldr, []string{filePathContainsTypo})
|
||||
if err == nil {
|
||||
t.Fatalf("expected to fail unmarshal yaml, but got nil %s", filePathContainsTypo)
|
||||
}
|
||||
if !strings.Contains(err.Error(), errMsg) {
|
||||
t.Fatalf("expected error %s, but got %s", errMsg, err)
|
||||
}
|
||||
}
|
||||
|
||||
// please remove this failing test after implements the labels support
|
||||
func TestLoadDefaultConfigsFromFilesWithMissingFieldsLabels(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
filePathContainsTypo := "config_contains_typo.yaml"
|
||||
if err := fSys.WriteFile(filePathContainsTypo, []byte(`
|
||||
labels:
|
||||
- path: spec/podTemplate/metadata/labels
|
||||
create: true
|
||||
kind: FlinkDeployment
|
||||
`)); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ldr, err := loader.NewLoader(
|
||||
loader.RestrictionRootOnly, filesys.Separator, fSys)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
errMsg := "error unmarshaling JSON: while decoding JSON: json: unknown field"
|
||||
_, err = loadDefaultConfig(ldr, []string{filePathContainsTypo})
|
||||
if err == nil {
|
||||
t.Fatalf("expected to fail unmarshal yaml, but got nil %s", filePathContainsTypo)
|
||||
}
|
||||
if !strings.Contains(err.Error(), errMsg) {
|
||||
t.Fatalf("expected error %s, but got %s", errMsg, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ type NameBackReferences struct {
|
||||
// TODO: rename json 'fieldSpecs' to 'referrers' for clarity.
|
||||
// This will, however, break anyone using a custom config.
|
||||
Referrers types.FsSlice `json:"fieldSpecs,omitempty" yaml:"fieldSpecs,omitempty"`
|
||||
|
||||
// Note: If any new pointer based members are added, DeepCopy needs to be updated
|
||||
}
|
||||
|
||||
func (n NameBackReferences) String() string {
|
||||
@@ -66,6 +68,17 @@ func (s nbrSlice) Less(i, j int) bool {
|
||||
return s[i].Gvk.IsLessThan(s[j].Gvk)
|
||||
}
|
||||
|
||||
// DeepCopy returns a new copy of nbrSlice
|
||||
func (s nbrSlice) DeepCopy() nbrSlice {
|
||||
ret := make(nbrSlice, len(s))
|
||||
copy(ret, s)
|
||||
for i, slice := range ret {
|
||||
ret[i].Referrers = slice.Referrers.DeepCopy()
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (s nbrSlice) mergeAll(o nbrSlice) (result nbrSlice, err error) {
|
||||
result = s
|
||||
for _, r := range o {
|
||||
|
||||
@@ -95,3 +95,29 @@ func TestMergeAll(t *testing.T) {
|
||||
t.Fatalf("expected\n %v\n but got\n %v\n", expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNbrSlice_DeepCopy(t *testing.T) {
|
||||
original := make(nbrSlice, 2, 4)
|
||||
original[0] = NameBackReferences{Gvk: resid.FromKind("A"), Referrers: types.FsSlice{{Path: "a"}}}
|
||||
original[1] = NameBackReferences{Gvk: resid.FromKind("B"), Referrers: types.FsSlice{{Path: "b"}}}
|
||||
|
||||
copied := original.DeepCopy()
|
||||
|
||||
original, _ = original.mergeOne(NameBackReferences{Gvk: resid.FromKind("C"), Referrers: types.FsSlice{{Path: "c"}}})
|
||||
|
||||
// perform mutations which should not affect original
|
||||
copied.Swap(0, 1)
|
||||
copied[0].Referrers[0].Path = "very b" // ensure Referrers are not shared
|
||||
_, _ = copied.mergeOne(NameBackReferences{Gvk: resid.FromKind("D"), Referrers: types.FsSlice{{Path: "d"}}})
|
||||
|
||||
// if DeepCopy does not work, original would be {very b,a,d} instead of {a,b,c}
|
||||
expected := nbrSlice{
|
||||
{Gvk: resid.FromKind("A"), Referrers: types.FsSlice{{Path: "a"}}},
|
||||
{Gvk: resid.FromKind("B"), Referrers: types.FsSlice{{Path: "b"}}},
|
||||
{Gvk: resid.FromKind("C"), Referrers: types.FsSlice{{Path: "c"}}},
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(original, expected) {
|
||||
t.Fatalf("original affected by mutations to copied object:\ngot\t%+v,\nexpected: %+v", original, expected)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package builtinconfig
|
||||
import (
|
||||
"log"
|
||||
"sort"
|
||||
"sync"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/internal/konfig/builtinpluginconsts"
|
||||
@@ -15,6 +16,7 @@ import (
|
||||
|
||||
// TransformerConfig holds the data needed to perform transformations.
|
||||
type TransformerConfig struct {
|
||||
// if any fields are added, update the DeepCopy implementation
|
||||
NamePrefix types.FsSlice `json:"namePrefix,omitempty" yaml:"namePrefix,omitempty"`
|
||||
NameSuffix types.FsSlice `json:"nameSuffix,omitempty" yaml:"nameSuffix,omitempty"`
|
||||
NameSpace types.FsSlice `json:"namespace,omitempty" yaml:"namespace,omitempty"`
|
||||
@@ -32,14 +34,43 @@ func MakeEmptyConfig() *TransformerConfig {
|
||||
return &TransformerConfig{}
|
||||
}
|
||||
|
||||
// DeepCopy returns a new copy of TransformerConfig
|
||||
func (t *TransformerConfig) DeepCopy() *TransformerConfig {
|
||||
return &TransformerConfig{
|
||||
NamePrefix: t.NamePrefix.DeepCopy(),
|
||||
NameSuffix: t.NameSuffix.DeepCopy(),
|
||||
NameSpace: t.NameSpace.DeepCopy(),
|
||||
CommonLabels: t.CommonLabels.DeepCopy(),
|
||||
TemplateLabels: t.TemplateLabels.DeepCopy(),
|
||||
CommonAnnotations: t.CommonAnnotations.DeepCopy(),
|
||||
NameReference: t.NameReference.DeepCopy(),
|
||||
VarReference: t.VarReference.DeepCopy(),
|
||||
Images: t.Images.DeepCopy(),
|
||||
Replicas: t.Replicas.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
// the default transformer config is initialized by MakeDefaultConfig,
|
||||
// and must only be accessed via that function.
|
||||
var (
|
||||
initDefaultConfig sync.Once //nolint:gochecknoglobals
|
||||
defaultConfig *TransformerConfig //nolint:gochecknoglobals
|
||||
)
|
||||
|
||||
// MakeDefaultConfig returns a default TransformerConfig.
|
||||
func MakeDefaultConfig() *TransformerConfig {
|
||||
c, err := makeTransformerConfigFromBytes(
|
||||
builtinpluginconsts.GetDefaultFieldSpecs())
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to make default transformconfig: %v", err)
|
||||
}
|
||||
return c
|
||||
// parsing is expensive when having a large tree with many kustomization modules, so only do it once
|
||||
initDefaultConfig.Do(func() {
|
||||
var err error
|
||||
defaultConfig, err = makeTransformerConfigFromBytes(
|
||||
builtinpluginconsts.GetDefaultFieldSpecs())
|
||||
if err != nil {
|
||||
log.Fatalf("Unable to make default transformconfig: %v", err)
|
||||
}
|
||||
})
|
||||
|
||||
// return a copy to avoid any mutations to protect the reference copy
|
||||
return defaultConfig.DeepCopy()
|
||||
}
|
||||
|
||||
// MakeTransformerConfig returns a merger of custom config,
|
||||
|
||||
@@ -173,3 +173,22 @@ func TestMerge(t *testing.T) {
|
||||
t.Fatalf("expected: %v\n but got: %v\n", cfga, actual)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMakeDefaultConfig_mutation(t *testing.T) {
|
||||
a := MakeDefaultConfig()
|
||||
|
||||
// mutate
|
||||
a.NameReference[0].Kind = "mutated"
|
||||
a.NameReference = a.NameReference[:1]
|
||||
|
||||
clean := MakeDefaultConfig()
|
||||
if clean.NameReference[0].Kind == "mutated" {
|
||||
t.Errorf("MakeDefaultConfig() did not return a clean copy: %+v", clean.NameReference)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMakeDefaultConfig(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = MakeDefaultConfig()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package execplugin
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
@@ -21,6 +22,7 @@ import (
|
||||
|
||||
const (
|
||||
tmpConfigFilePrefix = "kust-plugin-config-"
|
||||
maxArgStringLength = 131071
|
||||
)
|
||||
|
||||
// ExecPlugin record the name and args of an executable
|
||||
@@ -169,23 +171,35 @@ func (p *ExecPlugin) invokePlugin(input []byte) ([]byte, error) {
|
||||
p.path, append([]string{f.Name()}, p.args...)...)
|
||||
cmd.Env = p.getEnv()
|
||||
cmd.Stdin = bytes.NewReader(input)
|
||||
cmd.Stderr = os.Stderr
|
||||
var stdErr bytes.Buffer
|
||||
cmd.Stderr = &stdErr
|
||||
if _, err := os.Stat(p.h.Loader().Root()); err == nil {
|
||||
cmd.Dir = p.h.Loader().Root()
|
||||
}
|
||||
result, err := cmd.Output()
|
||||
if err != nil {
|
||||
return nil, errors.WrapPrefixf(
|
||||
err, "failure in plugin configured via %s; %v",
|
||||
f.Name(), err.Error())
|
||||
fmt.Errorf("failure in plugin configured via %s; %w",
|
||||
f.Name(), err), stdErr.String())
|
||||
}
|
||||
return result, os.Remove(f.Name())
|
||||
}
|
||||
|
||||
func (p *ExecPlugin) getEnv() []string {
|
||||
env := os.Environ()
|
||||
env = append(env,
|
||||
"KUSTOMIZE_PLUGIN_CONFIG_STRING="+string(p.cfg),
|
||||
"KUSTOMIZE_PLUGIN_CONFIG_ROOT="+p.h.Loader().Root())
|
||||
pluginConfigString := "KUSTOMIZE_PLUGIN_CONFIG_STRING=" + string(p.cfg)
|
||||
if len(pluginConfigString) <= maxArgStringLength {
|
||||
env = append(env, pluginConfigString)
|
||||
} else {
|
||||
log.Printf("KUSTOMIZE_PLUGIN_CONFIG_STRING exceeds hard limit of %d characters, the environment variable "+
|
||||
"will be omitted", maxArgStringLength)
|
||||
}
|
||||
pluginConfigRoot := "KUSTOMIZE_PLUGIN_CONFIG_ROOT=" + p.h.Loader().Root()
|
||||
if len(pluginConfigRoot) <= maxArgStringLength {
|
||||
env = append(env, pluginConfigRoot)
|
||||
} else {
|
||||
log.Printf("KUSTOMIZE_PLUGIN_CONFIG_ROOT exceeds hard limit of %d characters, the environment variable "+
|
||||
"will be omitted", maxArgStringLength)
|
||||
}
|
||||
return env
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ import (
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
expectedLargeConfigMap = `{"apiVersion":"v1","data":{"password":"password","username":"user"},"kind":"ConfigMap",` +
|
||||
`"metadata":{"annotations":{"internal.config.kubernetes.io/generatorBehavior":"unspecified",` +
|
||||
`"internal.config.kubernetes.io/needsHashSuffix":"enabled"},"name":"example-configmap-test"}}`
|
||||
)
|
||||
|
||||
func TestExecPluginConfig(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
err := fSys.WriteFile("sed-input.txt", []byte(`
|
||||
@@ -125,3 +131,104 @@ func TestExecPlugin_ErrIfNotExecutable(t *testing.T) {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// TestExecPluginLarge loads PluginConfigs of various (large) sizes. It tests if the env variable is kept below the
|
||||
// maximum of 131072 bytes.
|
||||
func TestExecPluginLarge(t *testing.T) {
|
||||
// Skip this test on windows.
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skipf("always returns nil on Windows")
|
||||
}
|
||||
|
||||
// Add executable plugin.
|
||||
srcRoot, err := utils.DeterminePluginSrcRoot(filesys.MakeFsOnDisk())
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
executablePlugin := filepath.Join(
|
||||
srcRoot, "someteam.example.com", "v1", "bashedconfigmap", "BashedConfigMap")
|
||||
p := NewExecPlugin(executablePlugin)
|
||||
err = p.ErrIfNotExecutable()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
|
||||
// Create a fake filesystem.
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
|
||||
// Load plugin config.
|
||||
ldr, err := fLdr.NewLoader(
|
||||
fLdr.RestrictionRootOnly, filesys.Separator, fSys)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
pvd := provider.NewDefaultDepProvider()
|
||||
rf := resmap.NewFactory(pvd.GetResourceFactory())
|
||||
pc := types.DisabledPluginConfig()
|
||||
|
||||
// Test for various lengths. 131071 is the max length that we can have for any given env var in Bytes.
|
||||
tcs := []struct {
|
||||
length int
|
||||
char rune
|
||||
}{
|
||||
{1000, 'a'},
|
||||
{131071, 'a'},
|
||||
{131072, 'a'},
|
||||
{200000, 'a'},
|
||||
{131071, '安'},
|
||||
{131074, '安'},
|
||||
}
|
||||
for _, tc := range tcs {
|
||||
t.Logf("Testing with an env var length of %d and character %c", tc.length, tc.char)
|
||||
pluginConfig, err := rf.RF().FromBytes(buildLargePluginConfig(tc.length, tc.char))
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
yaml, err := pluginConfig.AsYAML()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
err = p.Config(resmap.NewPluginHelpers(ldr, pvd.GetFieldValidator(), rf, pc), yaml)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
resMap, err := p.Generate()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
rNodeSlices := resMap.ToRNodeSlice()
|
||||
for _, rNodeSlice := range rNodeSlices {
|
||||
json, err := rNodeSlice.MarshalJSON()
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
if string(json) != expectedLargeConfigMap {
|
||||
t.Fatalf("expected generated JSON to match %q, but got %q instead",
|
||||
expectedLargeConfigMap, string(json))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// buildLargePluginConfig builds a plugin configuration of length: length - len("KUSTOMIZE_PLUGIN_CONFIG_STRING=")
|
||||
// This allows us to create an environment variable KUSTOMIZE_PLUGIN_CONFIG_STRING=<plugin content> with the exact
|
||||
// length that's provided in the length parameter. Used as a helper for TestExecPluginLarge.
|
||||
func buildLargePluginConfig(length int, char rune) []byte {
|
||||
length -= len("KUSTOMIZE_PLUGIN_CONFIG_STRING=")
|
||||
|
||||
var sb strings.Builder
|
||||
sb.WriteString("apiVersion: someteam.example.com/v1\n")
|
||||
sb.WriteString("kind: BashedConfigMap\n")
|
||||
sb.WriteString("metadata:\n")
|
||||
sb.WriteString(" name: some-random-name\n")
|
||||
sb.WriteString("argsOneLiner: \"user password\"\n")
|
||||
sb.WriteString("customArg: ")
|
||||
|
||||
// Now, fill up parameter customArg: until we reach the desired length. Account for the fact that runes can be
|
||||
// 1 to 4 Bytes each.
|
||||
upperBound := length - sb.Len()
|
||||
for i := 0; i < upperBound-len(string(char)); i += len(string(char)) {
|
||||
sb.WriteRune(char)
|
||||
}
|
||||
return []byte(sb.String())
|
||||
}
|
||||
|
||||
62
api/internal/plugins/loader/load_go_plugin.go
Normal file
62
api/internal/plugins/loader/load_go_plugin.go
Normal file
@@ -0,0 +1,62 @@
|
||||
// Copyright 2024 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//go:build !kustomize_disable_go_plugin_support
|
||||
|
||||
package loader
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"plugin"
|
||||
"reflect"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/internal/plugins/utils"
|
||||
"sigs.k8s.io/kustomize/api/konfig"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||
)
|
||||
|
||||
// registry is a means to avoid trying to load the same .so file
|
||||
// into memory more than once, which results in an error.
|
||||
// Each test makes its own loader, and tries to load its own plugins,
|
||||
// but the loaded .so files are in shared memory, so one will get
|
||||
// "this plugin already loaded" errors if the registry is maintained
|
||||
// as a Loader instance variable. So make it a package variable.
|
||||
var registry = make(map[string]resmap.Configurable) //nolint:gochecknoglobals
|
||||
|
||||
func copyPlugin(c resmap.Configurable) resmap.Configurable {
|
||||
indirect := reflect.Indirect(reflect.ValueOf(c))
|
||||
newIndirect := reflect.New(indirect.Type())
|
||||
newIndirect.Elem().Set(reflect.ValueOf(indirect.Interface()))
|
||||
newNamed := newIndirect.Interface()
|
||||
return newNamed.(resmap.Configurable) //nolint:forcetypeassert
|
||||
}
|
||||
|
||||
func (l *Loader) loadGoPlugin(id resid.ResId, absPath string) (resmap.Configurable, error) {
|
||||
regId := relativePluginPath(id)
|
||||
if c, ok := registry[regId]; ok {
|
||||
return copyPlugin(c), nil
|
||||
}
|
||||
if !utils.FileExists(absPath) {
|
||||
return nil, fmt.Errorf(
|
||||
"expected file with Go object code at: %s", absPath)
|
||||
}
|
||||
log.Printf("Attempting plugin load from %q", absPath)
|
||||
p, err := plugin.Open(absPath)
|
||||
if err != nil {
|
||||
return nil, errors.WrapPrefixf(err, "plugin %s fails to load", absPath)
|
||||
}
|
||||
symbol, err := p.Lookup(konfig.PluginSymbol)
|
||||
if err != nil {
|
||||
return nil, errors.WrapPrefixf(
|
||||
err, "plugin %s doesn't have symbol %s",
|
||||
regId, konfig.PluginSymbol)
|
||||
}
|
||||
c, ok := symbol.(resmap.Configurable)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("plugin %q not configurable", regId)
|
||||
}
|
||||
registry[regId] = c
|
||||
return copyPlugin(c), nil
|
||||
}
|
||||
24
api/internal/plugins/loader/load_go_plugin_disabled.go
Normal file
24
api/internal/plugins/loader/load_go_plugin_disabled.go
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2024 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// The build tag "kustomize_disable_go_plugin_support" is used to deactivate the
|
||||
// kustomize API's dependency on the "plugins" package. This is beneficial for
|
||||
// applications that need to embed it but do not have requirements for dynamic
|
||||
// Go plugins.
|
||||
// Including plugins as a dependency can lead to an increase in binary size due
|
||||
// to the population of ELF's sections such as .dynsym and .dynstr.
|
||||
// By utilizing this flag, applications have the flexibility to exclude the
|
||||
// import if they do not require support for dynamic Go plugins.
|
||||
//go:build kustomize_disable_go_plugin_support
|
||||
|
||||
package loader
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/kyaml/errors"
|
||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||
)
|
||||
|
||||
func (l *Loader) loadGoPlugin(_ resid.ResId, _ string) (resmap.Configurable, error) {
|
||||
return nil, errors.New("plugin load is disabled")
|
||||
}
|
||||
@@ -5,18 +5,14 @@ package loader
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"plugin"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/internal/plugins/builtinhelpers"
|
||||
"sigs.k8s.io/kustomize/api/internal/plugins/execplugin"
|
||||
"sigs.k8s.io/kustomize/api/internal/plugins/fnplugin"
|
||||
"sigs.k8s.io/kustomize/api/internal/plugins/utils"
|
||||
"sigs.k8s.io/kustomize/api/konfig"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
@@ -287,46 +283,3 @@ func (l *Loader) loadExecOrGoPlugin(resId resid.ResId) (resmap.Configurable, err
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// registry is a means to avoid trying to load the same .so file
|
||||
// into memory more than once, which results in an error.
|
||||
// Each test makes its own loader, and tries to load its own plugins,
|
||||
// but the loaded .so files are in shared memory, so one will get
|
||||
// "this plugin already loaded" errors if the registry is maintained
|
||||
// as a Loader instance variable. So make it a package variable.
|
||||
var registry = make(map[string]resmap.Configurable)
|
||||
|
||||
func (l *Loader) loadGoPlugin(id resid.ResId, absPath string) (resmap.Configurable, error) {
|
||||
regId := relativePluginPath(id)
|
||||
if c, ok := registry[regId]; ok {
|
||||
return copyPlugin(c), nil
|
||||
}
|
||||
if !utils.FileExists(absPath) {
|
||||
return nil, fmt.Errorf(
|
||||
"expected file with Go object code at: %s", absPath)
|
||||
}
|
||||
log.Printf("Attempting plugin load from '%s'", absPath)
|
||||
p, err := plugin.Open(absPath)
|
||||
if err != nil {
|
||||
return nil, errors.WrapPrefixf(err, "plugin %s fails to load", absPath)
|
||||
}
|
||||
symbol, err := p.Lookup(konfig.PluginSymbol)
|
||||
if err != nil {
|
||||
return nil, errors.WrapPrefixf(
|
||||
err, "plugin %s doesn't have symbol %s",
|
||||
regId, konfig.PluginSymbol)
|
||||
}
|
||||
c, ok := symbol.(resmap.Configurable)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("plugin '%s' not configurable", regId)
|
||||
}
|
||||
registry[regId] = c
|
||||
return copyPlugin(c), nil
|
||||
}
|
||||
|
||||
func copyPlugin(c resmap.Configurable) resmap.Configurable {
|
||||
indirect := reflect.Indirect(reflect.ValueOf(c))
|
||||
newIndirect := reflect.New(indirect.Type())
|
||||
newIndirect.Elem().Set(reflect.ValueOf(indirect.Interface()))
|
||||
newNamed := newIndirect.Interface()
|
||||
return newNamed.(resmap.Configurable)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/konfig"
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
@@ -53,7 +52,7 @@ func makeConfigMap(rf *resource.Factory, name, behavior string, hashValue *strin
|
||||
return r
|
||||
}
|
||||
|
||||
func makeConfigMapOptions(rf *resource.Factory, name, behavior string, disableHash bool) *resource.Resource {
|
||||
func makeConfigMapOptions(rf *resource.Factory, name, behavior string, disableHash bool) (*resource.Resource, error) {
|
||||
return rf.FromMapAndOption(map[string]interface{}{
|
||||
"apiVersion": "v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -89,12 +88,16 @@ func TestUpdateResourceOptions(t *testing.T) {
|
||||
name := fmt.Sprintf("test%d", i)
|
||||
err := in.Append(makeConfigMap(rf, name, c.behavior, c.hashValue))
|
||||
require.NoError(t, err)
|
||||
err = expected.Append(makeConfigMapOptions(rf, name, c.behavior, !c.needsHash))
|
||||
config, err := makeConfigMapOptions(rf, name, c.behavior, !c.needsHash)
|
||||
if err != nil {
|
||||
t.Errorf("expected new instance with an options but got error: %v", err)
|
||||
}
|
||||
err = expected.Append(config)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
actual, err := UpdateResourceOptions(in)
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, expected.ErrorIfNotEqualLists(actual))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, expected.ErrorIfNotEqualLists(actual))
|
||||
}
|
||||
|
||||
func TestUpdateResourceOptionsWithInvalidHashAnnotationValues(t *testing.T) {
|
||||
|
||||
@@ -425,7 +425,14 @@ func (kt *KustTarget) accumulateResources(
|
||||
}
|
||||
ldr, err := kt.ldr.New(path)
|
||||
if err != nil {
|
||||
if kusterr.IsMalformedYAMLError(errF) { // Some error occurred while tyring to decode YAML file
|
||||
// If accumulateFile found malformed YAML and there was a failure
|
||||
// loading the resource as a base, then the resource is likely a
|
||||
// file. The loader failure message is unnecessary, and could be
|
||||
// confusing. Report only the file load error.
|
||||
//
|
||||
// However, a loader timeout implies there is a git repo at the
|
||||
// path. In that case, both errors could be important.
|
||||
if kusterr.IsMalformedYAMLError(errF) && !utils.IsErrTimeout(err) {
|
||||
return nil, errF
|
||||
}
|
||||
return nil, errors.WrapPrefixf(
|
||||
|
||||
@@ -8,11 +8,13 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
. "sigs.k8s.io/kustomize/api/internal/target"
|
||||
"sigs.k8s.io/kustomize/api/internal/utils"
|
||||
"sigs.k8s.io/kustomize/api/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
"sigs.k8s.io/kustomize/api/resmap"
|
||||
@@ -285,15 +287,15 @@ metadata:
|
||||
}
|
||||
expected.RemoveBuildAnnotations()
|
||||
expYaml, err := expected.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
kt := makeKustTargetWithRf(t, th.GetFSys(), "/whatever", pvd)
|
||||
assert.NoError(t, kt.Load())
|
||||
require.NoError(t, kt.Load())
|
||||
actual, err := kt.MakeCustomizedResMap()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
actual.RemoveBuildAnnotations()
|
||||
actYaml, err := actual.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, string(expYaml), string(actYaml))
|
||||
}
|
||||
|
||||
@@ -313,19 +315,21 @@ configurations:
|
||||
th.WriteF("/merge-config/name-prefix-rules.yaml", `
|
||||
namePrefix:
|
||||
- path: metadata/name
|
||||
apiVersion: v1
|
||||
group: apps
|
||||
version: v1
|
||||
kind: Deployment
|
||||
- path: metadata/name
|
||||
apiVersion: v1
|
||||
version: v1
|
||||
kind: Secret
|
||||
`)
|
||||
th.WriteF("/merge-config/name-suffix-rules.yaml", `
|
||||
nameSuffix:
|
||||
- path: metadata/name
|
||||
apiVersion: v1
|
||||
version: v1
|
||||
kind: ConfigMap
|
||||
- path: metadata/name
|
||||
apiVersion: v1
|
||||
group: apps
|
||||
version: v1
|
||||
kind: Deployment
|
||||
`)
|
||||
th.WriteF("/merge-config/deployment.yaml", `
|
||||
@@ -423,7 +427,7 @@ func TestDuplicateExternalGeneratorsForbidden(t *testing.T) {
|
||||
configPath: another_config.json
|
||||
`)
|
||||
_, err := makeAndLoadKustTarget(t, th.GetFSys(), "/generator").AccumulateTarget()
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "may not add resource with an already registered id: ManifestGenerator.v1.generators.example/ManifestGenerator")
|
||||
}
|
||||
|
||||
@@ -452,6 +456,83 @@ func TestDuplicateExternalTransformersForbidden(t *testing.T) {
|
||||
value: 'fail'
|
||||
`)
|
||||
_, err := makeAndLoadKustTarget(t, th.GetFSys(), "/transformer").AccumulateTarget()
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "may not add resource with an already registered id: ValueAnnotator.v1.transformers.example.co/notImportantHere")
|
||||
}
|
||||
|
||||
func TestErrorMessageForMalformedYAML(t *testing.T) {
|
||||
// These testcases verify behavior for the scenario described in
|
||||
// https://github.com/kubernetes-sigs/kustomize/issues/5540 .
|
||||
|
||||
testcases := map[string]struct {
|
||||
loaderNewReturnsError error
|
||||
shouldShowLoadError bool
|
||||
}{
|
||||
"shouldShowLoadError": {
|
||||
loaderNewReturnsError: utils.NewErrTimeOut(time.Second, "git init"),
|
||||
shouldShowLoadError: true,
|
||||
},
|
||||
"shouldNotShowLoadError": {
|
||||
loaderNewReturnsError: NewErrMissingKustomization("/should-fail/resources.yaml"),
|
||||
shouldShowLoadError: false,
|
||||
},
|
||||
}
|
||||
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
th.WriteF("/should-fail/kustomization.yaml", `resources:
|
||||
- resources.yaml
|
||||
`)
|
||||
th.WriteF("/should-fail/resources.yaml", `<!DOCTYPE html>
|
||||
<html class="html-devise-layout ui-light-gray" lang="en">
|
||||
<head prefix="og: http://ogp.me/ns#">
|
||||
<meta charset="utf-8">
|
||||
`)
|
||||
|
||||
for name, tc := range testcases {
|
||||
t.Run(name, func(subT *testing.T) {
|
||||
ldrWrapper := func(baseLoader ifc.Loader) ifc.Loader {
|
||||
return loaderNewThrowsError{
|
||||
baseLoader: baseLoader,
|
||||
newReturnsError: tc.loaderNewReturnsError,
|
||||
}
|
||||
}
|
||||
_, err := makeAndLoadKustTargetWithLoaderOverride(t, th.GetFSys(), "/should-fail", ldrWrapper).AccumulateTarget()
|
||||
require.Error(t, err)
|
||||
errString := err.Error()
|
||||
assert.Contains(t, errString, "accumulating resources from 'resources.yaml'")
|
||||
assert.Contains(t, errString, "MalformedYAMLError: yaml: line 3: mapping values are not allowed in this context")
|
||||
if tc.shouldShowLoadError {
|
||||
assert.Regexp(t, `hit \w+ timeout running '`, errString)
|
||||
} else {
|
||||
assert.NotRegexp(t, `hit \w+ timeout running '`, errString)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// loaderNewReturnsError duplicates baseLoader's behavior except
|
||||
// that New() returns the specified error.
|
||||
type loaderNewThrowsError struct {
|
||||
baseLoader ifc.Loader
|
||||
newReturnsError error
|
||||
}
|
||||
|
||||
func (l loaderNewThrowsError) Repo() string {
|
||||
return l.baseLoader.Repo()
|
||||
}
|
||||
|
||||
func (l loaderNewThrowsError) Root() string {
|
||||
return l.baseLoader.Root()
|
||||
}
|
||||
|
||||
func (l loaderNewThrowsError) New(_ string) (ifc.Loader, error) {
|
||||
return nil, l.newReturnsError
|
||||
}
|
||||
|
||||
func (l loaderNewThrowsError) Load(location string) ([]byte, error) {
|
||||
return l.baseLoader.Load(location) //nolint:wrapcheck // baseLoader's error is sufficient
|
||||
}
|
||||
|
||||
func (l loaderNewThrowsError) Cleanup() error {
|
||||
return l.baseLoader.Cleanup() //nolint:wrapcheck // baseLoader's error is sufficient
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ package target_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
fLdr "sigs.k8s.io/kustomize/api/internal/loader"
|
||||
pLdr "sigs.k8s.io/kustomize/api/internal/plugins/loader"
|
||||
"sigs.k8s.io/kustomize/api/internal/target"
|
||||
@@ -21,11 +22,7 @@ func makeAndLoadKustTarget(
|
||||
fSys filesys.FileSystem,
|
||||
root string) *target.KustTarget {
|
||||
t.Helper()
|
||||
kt := makeKustTargetWithRf(t, fSys, root, provider.NewDefaultDepProvider())
|
||||
if err := kt.Load(); err != nil {
|
||||
t.Fatalf("Unexpected load error %v", err)
|
||||
}
|
||||
return kt
|
||||
return makeAndLoadKustTargetWithLoaderOverride(t, fSys, root, nil)
|
||||
}
|
||||
|
||||
func makeKustTargetWithRf(
|
||||
@@ -34,10 +31,37 @@ func makeKustTargetWithRf(
|
||||
root string,
|
||||
pvd *provider.DepProvider) *target.KustTarget {
|
||||
t.Helper()
|
||||
ldr, err := fLdr.NewLoader(fLdr.RestrictionRootOnly, root, fSys)
|
||||
return makeKustTargetWithRfAndLoaderOverride(t, fSys, root, pvd, nil)
|
||||
}
|
||||
|
||||
func makeAndLoadKustTargetWithLoaderOverride(
|
||||
t *testing.T,
|
||||
fSys filesys.FileSystem,
|
||||
root string,
|
||||
ldrWrapperFn func(ifc.Loader) ifc.Loader) *target.KustTarget {
|
||||
t.Helper()
|
||||
kt := makeKustTargetWithRfAndLoaderOverride(t, fSys, root, provider.NewDefaultDepProvider(), ldrWrapperFn)
|
||||
if err := kt.Load(); err != nil {
|
||||
t.Fatalf("Unexpected load error %v", err)
|
||||
}
|
||||
return kt
|
||||
}
|
||||
|
||||
func makeKustTargetWithRfAndLoaderOverride(
|
||||
t *testing.T,
|
||||
fSys filesys.FileSystem,
|
||||
root string,
|
||||
pvd *provider.DepProvider,
|
||||
ldrWrapperFn func(ifc.Loader) ifc.Loader) *target.KustTarget {
|
||||
t.Helper()
|
||||
baseLoader, err := fLdr.NewLoader(fLdr.RestrictionRootOnly, root, fSys)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ldr := baseLoader
|
||||
if ldrWrapperFn != nil {
|
||||
ldr = ldrWrapperFn(baseLoader)
|
||||
}
|
||||
rf := resmap.NewFactory(pvd.GetResourceFactory())
|
||||
pc := types.DisabledPluginConfig()
|
||||
return target.NewKustTarget(
|
||||
|
||||
@@ -15,11 +15,11 @@ type errTimeOut struct {
|
||||
cmd string
|
||||
}
|
||||
|
||||
func NewErrTimeOut(d time.Duration, c string) errTimeOut {
|
||||
return errTimeOut{duration: d, cmd: c}
|
||||
func NewErrTimeOut(d time.Duration, c string) *errTimeOut {
|
||||
return &errTimeOut{duration: d, cmd: c}
|
||||
}
|
||||
|
||||
func (e errTimeOut) Error() string {
|
||||
func (e *errTimeOut) Error() string {
|
||||
return fmt.Sprintf("hit %s timeout running '%s'", e.duration, e.cmd)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
// TimedCall runs fn, failing if it doesn't complete in the given duration.
|
||||
// The description is used in the timeout error message.
|
||||
func TimedCall(description string, d time.Duration, fn func() error) error {
|
||||
done := make(chan error)
|
||||
done := make(chan error, 1)
|
||||
timer := time.NewTimer(d)
|
||||
defer timer.Stop()
|
||||
go func() { done <- fn() }()
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uber.org/goleak"
|
||||
. "sigs.k8s.io/kustomize/api/internal/utils"
|
||||
)
|
||||
|
||||
@@ -62,3 +63,20 @@ func TestTimedCallSlowWithError(t *testing.T) {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimedCallGoroutineLeak(t *testing.T) {
|
||||
defer goleak.VerifyNone(t)
|
||||
err := TimedCall("function done, no goroutine leaks", timeToWait, func() error {
|
||||
time.Sleep(tooSlow)
|
||||
return fmt.Errorf("function done")
|
||||
})
|
||||
if assert.Error(t, err) {
|
||||
assert.EqualError(t, err, errMsg("function done, no goroutine leaks"))
|
||||
} else {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
// The code introduces a 2-second sleep to allow the goroutine to complete its execution.
|
||||
// Subsequently, it verifies if the goroutine created by the function exits as expected.
|
||||
time.Sleep(tooSlow)
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ package krusty_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -169,10 +171,15 @@ spec:
|
||||
|
||||
func TestAccumulateResourcesErrors(t *testing.T) {
|
||||
type testcase struct {
|
||||
name string
|
||||
resource string
|
||||
isAbsolute bool
|
||||
files map[string]string
|
||||
name string
|
||||
resource string
|
||||
// resourceFunc generates a resource string using the URL to the local
|
||||
// test server (optional).
|
||||
resourceFunc func(string) string
|
||||
// resourceServerSetup configures the local test server (optional).
|
||||
resourceServerSetup func(*http.ServeMux)
|
||||
isAbsolute bool
|
||||
files map[string]string
|
||||
// errFile, errDir are regex for the expected error message output
|
||||
// when kustomize tries to accumulate resource as file and dir,
|
||||
// respectively. The test substitutes occurrences of "%s" in the
|
||||
@@ -221,9 +228,14 @@ resources:
|
||||
for _, test := range []testcase{
|
||||
{
|
||||
name: "remote file not considered repo",
|
||||
// The example.com second-level domain is reserved and
|
||||
// safe to access, see RFC 2606.
|
||||
resource: "https://example.com/segments-too-few-to-be-repo",
|
||||
resourceFunc: func(url string) string {
|
||||
return fmt.Sprintf("%s/segments-too-few-to-be-repo", url)
|
||||
},
|
||||
resourceServerSetup: func(server *http.ServeMux) {
|
||||
server.HandleFunc("/", func(out http.ResponseWriter, req *http.Request) {
|
||||
out.WriteHeader(http.StatusNotFound)
|
||||
})
|
||||
},
|
||||
// It's acceptable for the error output of a remote file-like
|
||||
// resource to not indicate the resource's status as a
|
||||
// local directory. Though it is possible for a remote file-like
|
||||
@@ -231,8 +243,15 @@ resources:
|
||||
errFile: `HTTP Error: status code 404 \(Not Found\)\z`,
|
||||
},
|
||||
{
|
||||
name: "remote file qualifies as repo",
|
||||
resource: "https://example.com/long/enough/to/have/org/and/repo",
|
||||
name: "remote file qualifies as repo",
|
||||
resourceFunc: func(url string) string {
|
||||
return fmt.Sprintf("%s/long/enough/to/have/org/and/repo", url)
|
||||
},
|
||||
resourceServerSetup: func(server *http.ServeMux) {
|
||||
server.HandleFunc("/", func(out http.ResponseWriter, req *http.Request) {
|
||||
out.WriteHeader(http.StatusInternalServerError)
|
||||
})
|
||||
},
|
||||
// TODO(4788): This error message is technically wrong. Just
|
||||
// because we fail to GET a resource does not mean the resource is
|
||||
// not a remote file. We should return the GET status code as well.
|
||||
@@ -285,6 +304,19 @@ resources:
|
||||
},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if test.resourceFunc != nil {
|
||||
// Configure test server handler
|
||||
handler := http.NewServeMux()
|
||||
if test.resourceServerSetup != nil {
|
||||
test.resourceServerSetup(handler)
|
||||
}
|
||||
// Start test server
|
||||
svr := httptest.NewServer(handler)
|
||||
defer svr.Close()
|
||||
// Generate resource with test server address
|
||||
test.resource = test.resourceFunc(svr.URL)
|
||||
}
|
||||
|
||||
// Should use real file system to indicate that we are creating
|
||||
// new temporary directories on disk when we attempt to fetch repos.
|
||||
fs, tmpDir := kusttest_test.Setup(t)
|
||||
|
||||
@@ -591,3 +591,184 @@ metadata:
|
||||
name: test-m8t7bmb6g2
|
||||
`)
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/kubernetes-sigs/kustomize/issues/5047
|
||||
func TestPrefixSuffix(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
th.WriteF("kustomization.yaml", `
|
||||
resources:
|
||||
- a
|
||||
- b
|
||||
`)
|
||||
|
||||
th.WriteF("a/kustomization.yaml", `
|
||||
resources:
|
||||
- ../common
|
||||
|
||||
namePrefix: a
|
||||
`)
|
||||
|
||||
th.WriteF("b/kustomization.yaml", `
|
||||
resources:
|
||||
- ../common
|
||||
|
||||
namePrefix: b
|
||||
`)
|
||||
|
||||
th.WriteF("common/kustomization.yaml", `
|
||||
resources:
|
||||
- service
|
||||
|
||||
configMapGenerator:
|
||||
- name: "-example-configmap"
|
||||
`)
|
||||
|
||||
th.WriteF("common/service/deployment.yaml", `
|
||||
kind: Deployment
|
||||
apiVersion: apps/v1
|
||||
|
||||
metadata:
|
||||
name: "-"
|
||||
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: app
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: "-example-configmap"
|
||||
`)
|
||||
|
||||
th.WriteF("common/service/kustomization.yaml", `
|
||||
resources:
|
||||
- deployment.yaml
|
||||
|
||||
nameSuffix: api
|
||||
`)
|
||||
|
||||
m := th.Run(".", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: a-api
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- envFrom:
|
||||
- configMapRef:
|
||||
name: a-example-configmap-6ct58987ht
|
||||
name: app
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: a-example-configmap-6ct58987ht
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: b-api
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- envFrom:
|
||||
- configMapRef:
|
||||
name: b-example-configmap-6ct58987ht
|
||||
name: app
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: b-example-configmap-6ct58987ht
|
||||
`)
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/kubernetes-sigs/kustomize/issues/5047
|
||||
func TestPrefixSuffix2(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
th.WriteF("kustomization.yaml", `
|
||||
resources:
|
||||
- a
|
||||
- b
|
||||
`)
|
||||
|
||||
th.WriteF("a/kustomization.yaml", `
|
||||
resources:
|
||||
- ../common
|
||||
|
||||
namePrefix: a
|
||||
`)
|
||||
|
||||
th.WriteF("b/kustomization.yaml", `
|
||||
resources:
|
||||
- ../common
|
||||
|
||||
namePrefix: b
|
||||
`)
|
||||
|
||||
th.WriteF("common/deployment.yaml", `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: "-example"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: app
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: "-example-configmap"
|
||||
`)
|
||||
|
||||
th.WriteF("common/kustomization.yaml", `
|
||||
resources:
|
||||
- deployment.yaml
|
||||
|
||||
configMapGenerator:
|
||||
- name: "-example-configmap"
|
||||
`)
|
||||
|
||||
m := th.Run(".", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: a-example
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- envFrom:
|
||||
- configMapRef:
|
||||
name: a-example-configmap-6ct58987ht
|
||||
name: app
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: a-example-configmap-6ct58987ht
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: b-example
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- envFrom:
|
||||
- configMapRef:
|
||||
name: b-example-configmap-6ct58987ht
|
||||
name: app
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: b-example-configmap-6ct58987ht
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -17,12 +17,16 @@ commonLabels:
|
||||
vars:
|
||||
- name: APRIL_DIET
|
||||
objref:
|
||||
group: foo
|
||||
version: v1
|
||||
kind: Giraffe
|
||||
name: april
|
||||
fieldref:
|
||||
fieldpath: spec.diet
|
||||
- name: KOKO_DIET
|
||||
objref:
|
||||
group: foo
|
||||
version: v1
|
||||
kind: Gorilla
|
||||
name: koko
|
||||
fieldref:
|
||||
@@ -36,6 +40,7 @@ configurations:
|
||||
- config/custom.yaml
|
||||
`)
|
||||
th.WriteF("base/giraffes.yaml", `
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
name: april
|
||||
@@ -43,6 +48,7 @@ spec:
|
||||
diet: mimosa
|
||||
location: NE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
name: may
|
||||
@@ -51,6 +57,7 @@ spec:
|
||||
location: SE
|
||||
`)
|
||||
th.WriteF("base/gorilla.yaml", `
|
||||
apiVersion: foo/v1
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
name: koko
|
||||
@@ -59,7 +66,7 @@ spec:
|
||||
location: SW
|
||||
`)
|
||||
th.WriteF("base/animalPark.yaml", `
|
||||
apiVersion: foo
|
||||
apiVersion: foo/v1
|
||||
kind: AnimalPark
|
||||
metadata:
|
||||
name: sandiego
|
||||
@@ -94,7 +101,7 @@ varReference:
|
||||
`)
|
||||
m := th.Run("base", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: foo
|
||||
apiVersion: foo/v1
|
||||
kind: AnimalPark
|
||||
metadata:
|
||||
labels:
|
||||
@@ -109,6 +116,7 @@ spec:
|
||||
gorillaRef:
|
||||
name: x-koko
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
labels:
|
||||
@@ -118,6 +126,7 @@ spec:
|
||||
diet: mimosa
|
||||
location: NE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
labels:
|
||||
@@ -127,6 +136,7 @@ spec:
|
||||
diet: acacia
|
||||
location: SE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
@@ -163,7 +173,7 @@ varReference:
|
||||
`)
|
||||
m := th.Run("base", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: foo
|
||||
apiVersion: foo/v1
|
||||
kind: AnimalPark
|
||||
metadata:
|
||||
labels:
|
||||
@@ -178,6 +188,7 @@ spec:
|
||||
gorillaRef:
|
||||
name: x-koko
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
labels:
|
||||
@@ -187,6 +198,7 @@ spec:
|
||||
diet: mimosa
|
||||
location: NE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
labels:
|
||||
@@ -196,6 +208,7 @@ spec:
|
||||
diet: acacia
|
||||
location: SE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
@@ -215,17 +228,20 @@ func TestFixedBug605_BaseCustomizationAvailableInOverlay(t *testing.T) {
|
||||
nameReference:
|
||||
- kind: Gorilla
|
||||
fieldSpecs:
|
||||
- apiVersion: foo
|
||||
- group: foo
|
||||
version: v1
|
||||
kind: AnimalPark
|
||||
path: spec/gorillaRef/name
|
||||
- kind: Giraffe
|
||||
fieldSpecs:
|
||||
- apiVersion: foo
|
||||
- group: foo
|
||||
version: v1
|
||||
kind: AnimalPark
|
||||
path: spec/giraffeRef/name
|
||||
varReference:
|
||||
- path: spec/food
|
||||
apiVersion: foo
|
||||
group: foo
|
||||
version: v1
|
||||
kind: AnimalPark
|
||||
`)
|
||||
th.WriteK("overlay", `
|
||||
@@ -239,6 +255,7 @@ resources:
|
||||
- ursus.yaml
|
||||
`)
|
||||
th.WriteF("overlay/ursus.yaml", `
|
||||
apiVersion: foo/v1
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
name: ursus
|
||||
@@ -248,7 +265,7 @@ spec:
|
||||
`)
|
||||
// The following replaces the gorillaRef in the AnimalPark.
|
||||
th.WriteF("overlay/animalPark.yaml", `
|
||||
apiVersion: foo
|
||||
apiVersion: foo/v1
|
||||
kind: AnimalPark
|
||||
metadata:
|
||||
name: sandiego
|
||||
@@ -258,7 +275,7 @@ spec:
|
||||
`)
|
||||
m := th.Run("overlay", th.MakeDefaultOptions())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: foo
|
||||
apiVersion: foo/v1
|
||||
kind: AnimalPark
|
||||
metadata:
|
||||
labels:
|
||||
@@ -274,6 +291,7 @@ spec:
|
||||
gorillaRef:
|
||||
name: o-ursus
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
labels:
|
||||
@@ -284,6 +302,7 @@ spec:
|
||||
diet: mimosa
|
||||
location: NE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Giraffe
|
||||
metadata:
|
||||
labels:
|
||||
@@ -294,6 +313,7 @@ spec:
|
||||
diet: acacia
|
||||
location: SE
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
@@ -304,6 +324,7 @@ spec:
|
||||
diet: bambooshoots
|
||||
location: SW
|
||||
---
|
||||
apiVersion: foo/v1
|
||||
kind: Gorilla
|
||||
metadata:
|
||||
labels:
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
@@ -41,6 +42,6 @@ spec:
|
||||
`)
|
||||
m := th.Run(".", th.MakeDefaultOptions())
|
||||
_, err := m.AsYaml()
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "mapping key \"env\" already defined")
|
||||
}
|
||||
|
||||
@@ -4,17 +4,23 @@
|
||||
package krusty_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
. "sigs.k8s.io/kustomize/api/krusty"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
repoRootDir = "../../"
|
||||
)
|
||||
|
||||
const generateDeploymentDotSh = `#!/bin/sh
|
||||
|
||||
cat <<EOF
|
||||
@@ -61,7 +67,7 @@ func TestFnExecGeneratorInBase(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -86,7 +92,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -100,7 +106,7 @@ spec:
|
||||
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -134,7 +140,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestFnExecGeneratorInBaseWithOverlay(t *testing.T) {
|
||||
@@ -145,11 +151,11 @@ func TestFnExecGeneratorInBaseWithOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -176,7 +182,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(base, "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(base, "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -189,9 +195,9 @@ spec:
|
||||
`)
|
||||
|
||||
m := th.Run(prod, o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -225,7 +231,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestFnExecGeneratorInOverlay(t *testing.T) {
|
||||
@@ -236,11 +242,11 @@ func TestFnExecGeneratorInOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -267,7 +273,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(prod, "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(prod, "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(prod, "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(prod, "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -280,9 +286,9 @@ spec:
|
||||
`)
|
||||
|
||||
m := th.Run(prod, o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -316,7 +322,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestFnExecTransformerInBase(t *testing.T) {
|
||||
@@ -327,9 +333,9 @@ func TestFnExecTransformerInBase(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- secret.yaml
|
||||
@@ -348,7 +354,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(base, "krmTransformer.sh"), krmTransformerDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "krmTransformer.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "krmTransformer.sh"), 0777))
|
||||
th.WriteF(filepath.Join(base, "krm-transformer.yaml"), `
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1
|
||||
kind: MyPlugin
|
||||
@@ -362,7 +368,7 @@ metadata:
|
||||
|
||||
m := th.Run(base, o)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -371,7 +377,7 @@ stringData:
|
||||
foo: bar
|
||||
type: Opaque
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestFnExecTransformerInBaseWithOverlay(t *testing.T) {
|
||||
@@ -382,11 +388,11 @@ func TestFnExecTransformerInBaseWithOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- secret.yaml
|
||||
@@ -409,7 +415,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(base, "krmTransformer.sh"), krmTransformerDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "krmTransformer.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "krmTransformer.sh"), 0777))
|
||||
th.WriteF(filepath.Join(base, "krm-transformer.yaml"), `
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1
|
||||
kind: MyPlugin
|
||||
@@ -423,7 +429,7 @@ metadata:
|
||||
|
||||
m := th.Run(prod, o)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -432,7 +438,7 @@ stringData:
|
||||
foo: bar
|
||||
type: Opaque
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestFnExecTransformerInOverlay(t *testing.T) {
|
||||
@@ -443,11 +449,11 @@ func TestFnExecTransformerInOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- secret.yaml
|
||||
@@ -470,7 +476,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(prod, "krmTransformer.sh"), krmTransformerDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(prod, "krmTransformer.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(prod, "krmTransformer.sh"), 0777))
|
||||
th.WriteF(filepath.Join(prod, "krm-transformer.yaml"), `
|
||||
apiVersion: examples.config.kubernetes.io/v1beta1
|
||||
kind: MyPlugin
|
||||
@@ -484,7 +490,7 @@ metadata:
|
||||
|
||||
m := th.Run(prod, o)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -493,7 +499,7 @@ stringData:
|
||||
foo: bar
|
||||
type: Opaque
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func skipIfNoDocker(t *testing.T) {
|
||||
@@ -508,56 +514,63 @@ func TestFnContainerGenerator(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
o := th.MakeOptionsPluginsEnabled()
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
resources:
|
||||
- deployment.yaml
|
||||
generators:
|
||||
- project-service-set.yaml
|
||||
- service-set.yaml
|
||||
`)
|
||||
// Create generator config
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "project-service-set.yaml"), `
|
||||
apiVersion: blueprints.cloud.google.com/v1alpha1
|
||||
kind: ProjectServiceSet
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "service-set.yaml"), `
|
||||
apiVersion: kustomize.sigs.k8s.io/v1alpha1
|
||||
kind: ServiceGenerator
|
||||
metadata:
|
||||
name: demo
|
||||
name: simplegenerator
|
||||
annotations:
|
||||
config.kubernetes.io/function: |
|
||||
container:
|
||||
image: gcr.io/kpt-fn/enable-gcp-services:v0.1.0
|
||||
image: gcr.io/kustomize-functions/e2econtainersimplegenerator
|
||||
spec:
|
||||
services:
|
||||
- compute.googleapis.com
|
||||
projectID: foo
|
||||
port: 8081
|
||||
`)
|
||||
// Create another resource just to make sure everything is added
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "deployment.yaml"), `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: foo
|
||||
name: simplegenerator
|
||||
`)
|
||||
|
||||
build := exec.Command("docker", "build", ".",
|
||||
"-f", "./cmd/config/internal/commands/e2e/e2econtainersimplegenerator/Dockerfile",
|
||||
"-t", "gcr.io/kustomize-functions/e2econtainersimplegenerator",
|
||||
)
|
||||
build.Dir = repoRootDir
|
||||
require.NoError(t, run(build))
|
||||
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
actual, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: foo
|
||||
name: simplegenerator
|
||||
---
|
||||
apiVersion: serviceusage.cnrm.cloud.google.com/v1beta1
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
blueprints.cloud.google.com/ownerReference: blueprints.cloud.google.com/ProjectServiceSet/demo
|
||||
config.kubernetes.io/function: |
|
||||
container:
|
||||
image: gcr.io/kpt-fn/enable-gcp-services:v0.1.0
|
||||
name: demo-compute
|
||||
labels:
|
||||
app: simplegenerator
|
||||
name: simplegenerator-svc
|
||||
spec:
|
||||
projectRef:
|
||||
external: foo
|
||||
resourceID: compute.googleapis.com
|
||||
ports:
|
||||
- name: http
|
||||
port: 8081
|
||||
protocol: TCP
|
||||
targetPort: 8081
|
||||
selector:
|
||||
app: simplegenerator
|
||||
`, string(actual))
|
||||
}
|
||||
|
||||
@@ -566,7 +579,7 @@ func TestFnContainerTransformer(t *testing.T) {
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
o := th.MakeOptionsPluginsEnabled()
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
resources:
|
||||
- deployment.yaml
|
||||
@@ -593,11 +606,11 @@ metadata:
|
||||
"-f", "./cmd/config/internal/commands/e2e/e2econtainerconfig/Dockerfile",
|
||||
"-t", "gcr.io/kustomize-functions/e2econtainerconfig",
|
||||
)
|
||||
build.Dir = "../../" // Repo root
|
||||
assert.NoError(t, build.Run())
|
||||
build.Dir = repoRootDir
|
||||
require.NoError(t, run(build))
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
actual, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -611,32 +624,38 @@ metadata:
|
||||
|
||||
func TestFnContainerTransformerWithConfig(t *testing.T) {
|
||||
skipIfNoDocker(t)
|
||||
//https://docs.docker.com/engine/reference/commandline/build/#git-repositories
|
||||
build := exec.Command("docker", "build", "https://github.com/GoogleContainerTools/kpt-functions-sdk.git#go-sdk-v0.0.1:ts/hello-world",
|
||||
"-f", "build/label_namespace.Dockerfile",
|
||||
"-t", "gcr.io/kpt-functions/label-namespace:go-sdk-v0.0.1",
|
||||
)
|
||||
require.NoError(t, run(build))
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
o := th.MakeOptionsPluginsEnabled()
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := MakeKustomizer(&o)
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
resources:
|
||||
- data1.yaml
|
||||
- data2.yaml
|
||||
transformers:
|
||||
- label_namespace.yaml
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "data1.yaml"), []byte(`
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "data1.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: my-namespace
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "data2.yaml"), []byte(`
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "data2.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: another-namespace
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "label_namespace.yaml"), []byte(`
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "label_namespace.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
@@ -644,7 +663,7 @@ metadata:
|
||||
annotations:
|
||||
config.kubernetes.io/function: |-
|
||||
container:
|
||||
image: gcr.io/kpt-functions/label-namespace@sha256:4f030738d6d25a207641ca517916431517578bd0eb8d98a8bde04e3bb9315dcd
|
||||
image: gcr.io/kpt-functions/label-namespace:go-sdk-v0.0.1
|
||||
data:
|
||||
label_name: my-ns-name
|
||||
label_value: function-test
|
||||
@@ -652,9 +671,9 @@ data:
|
||||
m, err := b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
actual, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
@@ -678,37 +697,43 @@ func TestFnContainerEnvVars(t *testing.T) {
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := MakeKustomizer(&o)
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
generators:
|
||||
- gener.yaml
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "gener.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "gener.yaml"), []byte(`
|
||||
apiVersion: kustomize.sigs.k8s.io/v1alpha1
|
||||
kind: EnvTemplateGenerator
|
||||
metadata:
|
||||
name: demo
|
||||
name: e2econtainerenvgenerator
|
||||
annotations:
|
||||
config.kubernetes.io/function: |
|
||||
container:
|
||||
image: quay.io/aodinokov/kpt-templater:0.0.1
|
||||
image: gcr.io/kustomize-functions/e2econtainerenvgenerator
|
||||
envs:
|
||||
- TESTTEMPLATE=value
|
||||
data:
|
||||
template: |
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: env
|
||||
data:
|
||||
value: '{{ env "TESTTEMPLATE" }}'
|
||||
template: |
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: env
|
||||
data:
|
||||
value: %q
|
||||
`)))
|
||||
build := exec.Command("docker", "build", ".",
|
||||
"-f", "./cmd/config/internal/commands/e2e/e2econtainerenvgenerator/Dockerfile",
|
||||
"-t", "gcr.io/kustomize-functions/e2econtainerenvgenerator",
|
||||
)
|
||||
build.Dir = repoRootDir
|
||||
require.NoError(t, run(build))
|
||||
|
||||
m, err := b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
actual, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
data:
|
||||
value: value
|
||||
@@ -725,62 +750,54 @@ func TestFnContainerFnMounts(t *testing.T) {
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := MakeKustomizer(&o)
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
generators:
|
||||
- gener.yaml
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "gener.yaml"), []byte(`
|
||||
apiVersion: v1alpha1
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "gener.yaml"), []byte(`
|
||||
apiVersion: kustomize.sigs.k8s.io/v1alpha1
|
||||
kind: RenderHelmChart
|
||||
metadata:
|
||||
name: demo
|
||||
annotations:
|
||||
config.kubernetes.io/function: |
|
||||
container:
|
||||
image: gcr.io/kpt-fn/render-helm-chart:v0.1.0
|
||||
image: gcr.io/kustomize-functions/e2econtainermountbind
|
||||
mounts:
|
||||
- type: "bind"
|
||||
src: "./charts"
|
||||
dst: "/tmp/charts"
|
||||
helmCharts:
|
||||
- name: helloworld-chart
|
||||
releaseName: test
|
||||
valuesFile: /tmp/charts/helloworld-values/values.yaml
|
||||
src: "./yaml"
|
||||
dst: "/tmp/yaml"
|
||||
path: /tmp/yaml/resources.yaml
|
||||
`)))
|
||||
assert.NoError(t, fSys.MkdirAll(filepath.Join(tmpDir.String(), "charts", "helloworld-chart", "templates")))
|
||||
assert.NoError(t, fSys.MkdirAll(filepath.Join(tmpDir.String(), "charts", "helloworld-values")))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "charts", "helloworld-chart", "Chart.yaml"), []byte(`
|
||||
apiVersion: v2
|
||||
name: helloworld-chart
|
||||
description: A Helm chart for Kubernetes
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: 1.16.0
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "charts", "helloworld-chart", "templates", "deployment.yaml"), []byte(`
|
||||
require.NoError(t, fSys.MkdirAll(filepath.Join(tmpDir.String(), "yaml", "tmp")))
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "yaml", "resources.yaml"), []byte(`
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: name
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "charts", "helloworld-values", "values.yaml"), []byte(`
|
||||
replicaCount: 5
|
||||
replicas: 3
|
||||
`)))
|
||||
build := exec.Command("docker", "build", ".",
|
||||
"-f", "./cmd/config/internal/commands/e2e/e2econtainermountbind/Dockerfile",
|
||||
"-t", "gcr.io/kustomize-functions/e2econtainermountbind",
|
||||
)
|
||||
build.Dir = repoRootDir
|
||||
require.NoError(t, run(build))
|
||||
|
||||
m, err := b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
actual, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: name
|
||||
spec:
|
||||
replicas: 5
|
||||
replicas: 3
|
||||
`, string(actual))
|
||||
}
|
||||
|
||||
@@ -791,8 +808,8 @@ func TestFnContainerMountsLoadRestrictions_absolute(t *testing.T) {
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := MakeKustomizer(&o)
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
generators:
|
||||
- |-
|
||||
apiVersion: v1alpha1
|
||||
@@ -811,7 +828,7 @@ generators:
|
||||
_, err = b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "loading generator plugins: failed to load generator: plugin RenderHelmChart."+
|
||||
"v1alpha1.[noGrp]/demo.[noNs] with mount path '/tmp/dir' is not permitted; mount paths must"+
|
||||
" be relative to the current kustomization directory")
|
||||
@@ -824,8 +841,8 @@ func TestFnContainerMountsLoadRestrictions_outsideCurrentDir(t *testing.T) {
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := MakeKustomizer(&o)
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
generators:
|
||||
- |-
|
||||
apiVersion: v1alpha1
|
||||
@@ -844,7 +861,7 @@ generators:
|
||||
_, err = b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "loading generator plugins: failed to load generator: plugin RenderHelmChart."+
|
||||
"v1alpha1.[noGrp]/demo.[noNs] with mount path './tmp/../../dir' is not permitted; mount paths must "+
|
||||
"be under the current kustomization directory")
|
||||
@@ -872,6 +889,15 @@ spec:
|
||||
replicas: 3
|
||||
`)
|
||||
err := th.RunWithErr(".", th.MakeOptionsPluginsEnabled())
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.EqualError(t, err, "couldn't execute function: root working directory '/' not allowed")
|
||||
}
|
||||
|
||||
// run calls Cmd.Run and wraps the error to include the output to make debugging
|
||||
// easier. Not safe for real code, but fine for tests.
|
||||
func run(cmd *exec.Cmd) error {
|
||||
if out, err := cmd.CombinedOutput(); err != nil {
|
||||
return fmt.Errorf("%w\n--- COMMAND OUTPUT ---\n%s", err, string(out))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package krusty_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
@@ -496,7 +496,7 @@ spec:
|
||||
options := th.MakeDefaultOptions()
|
||||
// depPatch cannot find target with kind `Deployment` and name `new-name`
|
||||
// because the resource never had this GVKN
|
||||
assert.Error(t, th.RunWithErr("overlay", options))
|
||||
require.Error(t, th.RunWithErr("overlay", options))
|
||||
}
|
||||
|
||||
// Here is a structure of a kustomization of two components, component1
|
||||
|
||||
@@ -567,6 +567,325 @@ metadata:
|
||||
`)
|
||||
}
|
||||
|
||||
// Reference: https://github.com/kubernetes-sigs/kustomize/issues/5163
|
||||
func TestHelmChartInflationGeneratorForMultipleChartsDifferentVersion(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(), `
|
||||
namespace: default
|
||||
helmCharts:
|
||||
- name: test-chart
|
||||
releaseName: test
|
||||
version: 1.0.0
|
||||
skipTests: true
|
||||
- name: minecraft
|
||||
repo: https://itzg.github.io/minecraft-server-charts
|
||||
version: 3.1.3
|
||||
releaseName: test-1
|
||||
- name: minecraft
|
||||
repo: https://itzg.github.io/minecraft-server-charts
|
||||
version: 3.1.4
|
||||
releaseName: test-2
|
||||
`)
|
||||
|
||||
m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
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: v1
|
||||
data:
|
||||
rcon-password: Q0hBTkdFTUUh
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app: test-1-minecraft
|
||||
chart: minecraft-3.1.3
|
||||
heritage: Helm
|
||||
release: test-1
|
||||
name: test-1-minecraft
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: test-1-minecraft
|
||||
chart: minecraft-3.1.3
|
||||
heritage: Helm
|
||||
release: test-1
|
||||
name: test-1-minecraft
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- name: minecraft
|
||||
port: 25565
|
||||
protocol: TCP
|
||||
targetPort: minecraft
|
||||
selector:
|
||||
app: test-1-minecraft
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
rcon-password: Q0hBTkdFTUUh
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app: test-2-minecraft
|
||||
chart: minecraft-3.1.4
|
||||
heritage: Helm
|
||||
release: test-2
|
||||
name: test-2-minecraft
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: test-2-minecraft
|
||||
chart: minecraft-3.1.4
|
||||
heritage: Helm
|
||||
release: test-2
|
||||
name: test-2-minecraft
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- name: minecraft
|
||||
port: 25565
|
||||
protocol: TCP
|
||||
targetPort: minecraft
|
||||
selector:
|
||||
app: test-2-minecraft
|
||||
type: ClusterIP
|
||||
`)
|
||||
}
|
||||
|
||||
func TestHelmChartInflationGeneratorForMultipleKubeVersions(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(), `
|
||||
namespace: default
|
||||
helmCharts:
|
||||
- name: minecraft
|
||||
repo: https://itzg.github.io/minecraft-server-charts
|
||||
version: 4.11.0
|
||||
releaseName: test
|
||||
kubeVersion: "1.16"
|
||||
valuesInline:
|
||||
minecraftServer:
|
||||
extraPorts:
|
||||
- name: map
|
||||
containerPort: 8123
|
||||
protocol: TCP
|
||||
service:
|
||||
enabled: false
|
||||
ingress:
|
||||
enabled: true
|
||||
`)
|
||||
|
||||
m := th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
rcon-password: Q0hBTkdFTUUh
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft-rcon
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
cf-api-key: Q0hBTkdFTUUh
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft-curseforge
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- name: minecraft
|
||||
port: 25565
|
||||
protocol: TCP
|
||||
targetPort: minecraft
|
||||
selector:
|
||||
app: test-minecraft
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft-map
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft-map
|
||||
namespace: default
|
||||
spec:
|
||||
rules: null
|
||||
`)
|
||||
|
||||
th.WriteK(th.GetRoot(), `
|
||||
namespace: default
|
||||
helmCharts:
|
||||
- name: minecraft
|
||||
repo: https://itzg.github.io/minecraft-server-charts
|
||||
version: 4.11.0
|
||||
releaseName: test
|
||||
kubeVersion: "1.27"
|
||||
valuesInline:
|
||||
minecraftServer:
|
||||
extraPorts:
|
||||
- name: map
|
||||
containerPort: 8123
|
||||
protocol: TCP
|
||||
service:
|
||||
enabled: false
|
||||
ingress:
|
||||
enabled: true
|
||||
`)
|
||||
|
||||
m = th.Run(th.GetRoot(), th.MakeOptionsPluginsEnabled())
|
||||
th.AssertActualEqualsExpected(m, `
|
||||
apiVersion: v1
|
||||
data:
|
||||
rcon-password: Q0hBTkdFTUUh
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft-rcon
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
data:
|
||||
cf-api-key: Q0hBTkdFTUUh
|
||||
kind: Secret
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft-curseforge
|
||||
namespace: default
|
||||
type: Opaque
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft
|
||||
namespace: default
|
||||
spec:
|
||||
ports:
|
||||
- name: minecraft
|
||||
port: 25565
|
||||
protocol: TCP
|
||||
targetPort: minecraft
|
||||
selector:
|
||||
app: test-minecraft
|
||||
type: ClusterIP
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
labels:
|
||||
app: test-minecraft-map
|
||||
app.kubernetes.io/instance: test-minecraft
|
||||
app.kubernetes.io/name: minecraft
|
||||
app.kubernetes.io/version: 4.11.0
|
||||
chart: minecraft-4.11.0
|
||||
heritage: Helm
|
||||
release: test
|
||||
name: test-minecraft-map
|
||||
namespace: default
|
||||
spec:
|
||||
rules: null
|
||||
`)
|
||||
}
|
||||
|
||||
func copyValuesFilesTestChartsIntoHarness(t *testing.T, th *kusttest_test.HarnessEnhanced) {
|
||||
t.Helper()
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ package krusty_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
)
|
||||
|
||||
@@ -209,7 +209,7 @@ spec:
|
||||
- image: whatever
|
||||
`)
|
||||
err := th.RunWithErr("gcp", th.MakeDefaultOptions())
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
// Test for issue #3228
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
"sigs.k8s.io/kustomize/kyaml/openapi"
|
||||
"sigs.k8s.io/kustomize/kyaml/openapi/kubernetesapi"
|
||||
@@ -264,7 +265,7 @@ openapi:
|
||||
writeCustomResource(th, "mycrd.yaml")
|
||||
writeTestSchema(th, "./")
|
||||
err := th.RunWithErr(".", th.MakeDefaultOptions())
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t,
|
||||
"builtin version and custom schema provided, cannot use both",
|
||||
err.Error())
|
||||
@@ -284,7 +285,7 @@ openapi:
|
||||
`+customSchemaPatch)
|
||||
writeCustomResource(th, "mycrd.yaml")
|
||||
err := th.RunWithErr(".", th.MakeDefaultOptions())
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t,
|
||||
"'/mycrd_schema.json' doesn't exist",
|
||||
err.Error())
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/internal/utils"
|
||||
"sigs.k8s.io/kustomize/api/krusty"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
@@ -417,7 +418,7 @@ func TestAnnoOriginCustomExecGenerator(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -443,7 +444,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -456,9 +457,9 @@ spec:
|
||||
`)
|
||||
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -500,7 +501,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginCustomInlineExecGenerator(t *testing.T) {
|
||||
@@ -511,7 +512,7 @@ func TestAnnoOriginCustomInlineExecGenerator(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -544,11 +545,11 @@ stringData:
|
||||
- mkdir /mnt/vda
|
||||
`)
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
assert.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -590,7 +591,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginCustomExecGeneratorWithOverlay(t *testing.T) {
|
||||
@@ -601,11 +602,11 @@ func TestAnnoOriginCustomExecGeneratorWithOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -633,7 +634,7 @@ stringData:
|
||||
`)
|
||||
th.WriteF(filepath.Join(base, "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(base, "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -646,9 +647,9 @@ spec:
|
||||
`)
|
||||
|
||||
m := th.Run(prod, o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -690,7 +691,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginCustomInlineExecGeneratorWithOverlay(t *testing.T) {
|
||||
@@ -701,11 +702,11 @@ func TestAnnoOriginCustomInlineExecGeneratorWithOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
resources:
|
||||
- short_secret.yaml
|
||||
@@ -740,11 +741,11 @@ stringData:
|
||||
- mkdir /mnt/vda
|
||||
`)
|
||||
th.WriteF(filepath.Join(base, "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
m := th.Run(prod, o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
@@ -786,15 +787,15 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginRemoteBuiltinGenerator(t *testing.T) {
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := krusty.MakeKustomizer(krusty.MakeDefaultOptions())
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
resources:
|
||||
- github.com/kubernetes-sigs/kustomize/examples/ldap/base/?ref=v1.0.6
|
||||
buildMetadata: [originAnnotations]
|
||||
@@ -810,7 +811,7 @@ buildMetadata: [originAnnotations]
|
||||
t.FailNow()
|
||||
}
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Contains(t, string(yml), `kind: ConfigMap
|
||||
metadata:
|
||||
annotations:
|
||||
@@ -822,7 +823,7 @@ metadata:
|
||||
apiVersion: builtin
|
||||
kind: ConfigMapGenerator
|
||||
name: ldap-configmap-4d7m6k5b42`)
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginInlineBuiltinGenerator(t *testing.T) {
|
||||
@@ -1011,7 +1012,7 @@ func TestAnnoOriginGeneratorInTransformersField(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
transformers:
|
||||
- gener.yaml
|
||||
@@ -1020,7 +1021,7 @@ buildMetadata: [originAnnotations]
|
||||
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -1033,9 +1034,9 @@ spec:
|
||||
`)
|
||||
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -1062,7 +1063,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginGeneratorInTransformersFieldWithOverlay(t *testing.T) {
|
||||
@@ -1073,11 +1074,11 @@ func TestAnnoOriginGeneratorInTransformersFieldWithOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
|
||||
th.WriteK(base, `
|
||||
transformers:
|
||||
@@ -1086,7 +1087,7 @@ transformers:
|
||||
|
||||
th.WriteF(filepath.Join(base, "generateDeployment.sh"), generateDeploymentDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(base, "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -1105,9 +1106,9 @@ buildMetadata: [originAnnotations, transformerAnnotations]
|
||||
`)
|
||||
|
||||
m := th.Run(prod, o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -1139,5 +1140,5 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ resources:
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), test.err)
|
||||
if test.errT != nil {
|
||||
assert.ErrorIs(t, err, test.errT)
|
||||
require.ErrorIs(t, err, test.errT)
|
||||
}
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
@@ -453,6 +453,6 @@ func checkYaml(t *testing.T, actual resmap.ResMap, expected string) {
|
||||
t.Helper()
|
||||
|
||||
yml, err := actual.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expected, string(yml))
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/internal/utils"
|
||||
"sigs.k8s.io/kustomize/api/krusty"
|
||||
kusttest_test "sigs.k8s.io/kustomize/api/testutils/kusttest"
|
||||
@@ -261,8 +262,8 @@ func TestAnnoOriginRemoteBuiltinTransformer(t *testing.T) {
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
b := krusty.MakeKustomizer(krusty.MakeDefaultOptions())
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "kustomization.yaml"), []byte(`
|
||||
resources:
|
||||
- github.com/kubernetes-sigs/kustomize/examples/multibases/production/?ref=v1.0.6
|
||||
buildMetadata: [transformerAnnotations]
|
||||
@@ -278,7 +279,7 @@ buildMetadata: [transformerAnnotations]
|
||||
t.FailNow()
|
||||
}
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
@@ -298,7 +299,7 @@ spec:
|
||||
- image: nginx:1.7.9
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoTransformerBuiltinInline(t *testing.T) {
|
||||
@@ -356,7 +357,7 @@ func TestAnnoOriginCustomInlineTransformer(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
th.WriteK(tmpDir.String(), `
|
||||
transformers:
|
||||
- |-
|
||||
@@ -375,7 +376,7 @@ buildMetadata: [transformerAnnotations]
|
||||
// which will cause kustomize to record the plugin origin data as a transformation
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "generateDeployment.sh"), generateDeploymentWithOriginDotSh)
|
||||
|
||||
assert.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(tmpDir.String(), "generateDeployment.sh"), 0777))
|
||||
th.WriteF(filepath.Join(tmpDir.String(), "gener.yaml"), `
|
||||
kind: executable
|
||||
metadata:
|
||||
@@ -388,9 +389,9 @@ spec:
|
||||
`)
|
||||
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -417,7 +418,7 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
func TestAnnoOriginCustomExecTransformerWithOverlay(t *testing.T) {
|
||||
@@ -428,11 +429,11 @@ func TestAnnoOriginCustomExecTransformerWithOverlay(t *testing.T) {
|
||||
o.PluginConfig.FnpLoadingOptions.EnableExec = true
|
||||
|
||||
tmpDir, err := filesys.NewTmpConfirmedDir()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
base := filepath.Join(tmpDir.String(), "base")
|
||||
prod := filepath.Join(tmpDir.String(), "prod")
|
||||
assert.NoError(t, fSys.Mkdir(base))
|
||||
assert.NoError(t, fSys.Mkdir(prod))
|
||||
require.NoError(t, fSys.Mkdir(base))
|
||||
require.NoError(t, fSys.Mkdir(prod))
|
||||
th.WriteK(base, `
|
||||
transformers:
|
||||
- gener.yaml
|
||||
@@ -455,12 +456,12 @@ spec:
|
||||
// generateDeploymentWithOriginDotSh creates a resource that already has an origin annotation,
|
||||
// which will cause kustomize to record the plugin origin data as a transformation
|
||||
th.WriteF(filepath.Join(base, "generateDeployment.sh"), generateDeploymentWithOriginDotSh)
|
||||
assert.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
require.NoError(t, os.Chmod(filepath.Join(base, "generateDeployment.sh"), 0777))
|
||||
|
||||
m := th.Run(prod, o)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -487,5 +488,5 @@ spec:
|
||||
- image: nginx
|
||||
name: nginx
|
||||
`, string(yml))
|
||||
assert.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
require.NoError(t, fSys.RemoveAll(tmpDir.String()))
|
||||
}
|
||||
|
||||
@@ -377,7 +377,8 @@ spec:
|
||||
th.WriteF("base/config/knative.yaml", `
|
||||
images:
|
||||
- path: spec/runLatest/configuration/revisionTemplate/spec/container/image
|
||||
apiVersion: serving.knative.dev/v1alpha1
|
||||
group: serving.knative.dev
|
||||
version: v1alpha1
|
||||
kind: Service
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@ vars:
|
||||
objref: &config-map-ref
|
||||
kind: ConfigMap
|
||||
name: kustomize-vars
|
||||
apiVersion: v1
|
||||
version: v1
|
||||
fieldref:
|
||||
fieldpath: data.DBT_TARGET
|
||||
- name: SUSPENDED
|
||||
@@ -500,10 +500,12 @@ nameReference:
|
||||
varReference:
|
||||
- path: spec/workflowSpec/arguments/parameters/value
|
||||
kind: CronWorkflow
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
group: argoproj.io
|
||||
version: v1alpha1
|
||||
- path: spec
|
||||
kind: CronWorkflow
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
group: argoproj.io
|
||||
version: v1alpha1
|
||||
`)
|
||||
th.WriteF("vars.env", `
|
||||
DBT_TARGET=development
|
||||
|
||||
@@ -70,14 +70,19 @@ func TestKeyValuesFromLines(t *testing.T) {
|
||||
},
|
||||
expectedErr: false,
|
||||
},
|
||||
// TODO: add negative testcases
|
||||
{
|
||||
desc: "invalid UTF-8 content",
|
||||
content: "Invalid UTF8 Content: \x80\x81",
|
||||
expectedPairs: nil,
|
||||
expectedErr: true,
|
||||
},
|
||||
}
|
||||
|
||||
kvl := makeKvLoader(filesys.MakeFsInMemory())
|
||||
for _, test := range tests {
|
||||
pairs, err := kvl.keyValuesFromLines([]byte(test.content))
|
||||
if test.expectedErr && err == nil {
|
||||
t.Fatalf("%s should not return error", test.desc)
|
||||
t.Fatalf("%s should return error", test.desc)
|
||||
}
|
||||
if !reflect.DeepEqual(pairs, test.expectedPairs) {
|
||||
t.Errorf("%s should succeed, got:%v exptected:%v", test.desc, pairs, test.expectedPairs)
|
||||
|
||||
@@ -12,9 +12,6 @@ import (
|
||||
|
||||
// TODO: delete this when we find a better way to generate release notes.
|
||||
func main() {
|
||||
fmt.Println(`
|
||||
This 'main' exists only to make goreleaser create release notes for the API.
|
||||
See https://github.com/goreleaser/goreleaser/issues/981
|
||||
and https://github.com/kubernetes-sigs/kustomize/tree/master/releasing`)
|
||||
fmt.Println(`This 'main' exists only to create release notes for the API.`)
|
||||
fmt.Println(provenance.GetProvenance())
|
||||
}
|
||||
|
||||
13
api/pkg/util/image.go
Normal file
13
api/pkg/util/image.go
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2024 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"sigs.k8s.io/kustomize/api/internal/image"
|
||||
)
|
||||
|
||||
// Splits image string name into name, tag and digest
|
||||
func SplitImageName(imageName string) (name string, tag string, digest string) {
|
||||
return image.Split(imageName)
|
||||
}
|
||||
@@ -8,6 +8,8 @@ import (
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
|
||||
"github.com/blang/semver/v4"
|
||||
)
|
||||
|
||||
// These variables are set at build time using ldflags.
|
||||
@@ -62,9 +64,42 @@ func GetProvenance() Provenance {
|
||||
p.GitCommit = setting.Value
|
||||
}
|
||||
}
|
||||
|
||||
for _, dep := range info.Deps {
|
||||
if dep != nil && dep.Path == "sigs.k8s.io/kustomize/kustomize/v5" {
|
||||
if dep.Version != "devel" {
|
||||
continue
|
||||
}
|
||||
v, err := GetMostRecentTag(*dep)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to get most recent tag for %s: %v\n", dep.Path, err)
|
||||
continue
|
||||
}
|
||||
p.Version = v
|
||||
}
|
||||
}
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func GetMostRecentTag(m debug.Module) (string, error) {
|
||||
for m.Replace != nil {
|
||||
m = *m.Replace
|
||||
}
|
||||
|
||||
split := strings.Split(m.Version, "-")
|
||||
sv, err := semver.Parse(strings.TrimPrefix(split[0], "v"))
|
||||
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to parse version %s: %w", m.Version, err)
|
||||
}
|
||||
|
||||
if len(split) > 1 && sv.Patch > 0 {
|
||||
sv.Patch -= 1
|
||||
}
|
||||
return fmt.Sprintf("v%s", sv.FinalizeVersion()), nil
|
||||
}
|
||||
|
||||
// Short returns the shortened provenance stamp.
|
||||
func (v Provenance) Short() string {
|
||||
return fmt.Sprintf(
|
||||
|
||||
@@ -5,6 +5,7 @@ package provenance_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -45,3 +46,59 @@ func TestProvenance_Semver(t *testing.T) {
|
||||
p.Version = "kustomize/v4.11.12"
|
||||
assert.Equal(t, "v4.11.12", p.Semver())
|
||||
}
|
||||
|
||||
func mockModule(version string) debug.Module {
|
||||
return debug.Module{
|
||||
Path: "sigs.k8s.io/kustomize/kustomize/v5",
|
||||
Version: version,
|
||||
Replace: nil,
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetMostRecentTag(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
module debug.Module
|
||||
isError bool
|
||||
expectedTag string
|
||||
}{
|
||||
{
|
||||
name: "Standard version",
|
||||
module: mockModule("v1.2.3"),
|
||||
expectedTag: "v1.2.3",
|
||||
},
|
||||
{
|
||||
name: "Pseudo-version with patch increment",
|
||||
module: mockModule("v0.0.0-20210101010101-abcdefabcdef"),
|
||||
expectedTag: "v0.0.0",
|
||||
},
|
||||
{
|
||||
name: "Invalid semver string",
|
||||
module: mockModule("invalid-version"),
|
||||
isError: true,
|
||||
},
|
||||
{
|
||||
name: "Valid semver with patch increment and pre-release info",
|
||||
module: mockModule("v1.2.3-0.20210101010101-abcdefabcdef"),
|
||||
expectedTag: "v1.2.2",
|
||||
},
|
||||
{
|
||||
name: "Valid semver no patch increment",
|
||||
module: mockModule("v1.2.0"),
|
||||
expectedTag: "v1.2.0",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tag, err := provenance.GetMostRecentTag(tt.module)
|
||||
if err != nil {
|
||||
if !tt.isError {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
} else {
|
||||
assert.Equal(t, tt.expectedTag, tag)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
loader "sigs.k8s.io/kustomize/api/internal/loader"
|
||||
"sigs.k8s.io/kustomize/api/kv"
|
||||
@@ -61,19 +62,19 @@ metadata:
|
||||
"namespace": "test",
|
||||
}}).ResMap()
|
||||
expYaml, err := expected.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
assert.NoError(t, fSys.WriteFile("deployment.yaml", []byte(resourceStr)))
|
||||
require.NoError(t, fSys.WriteFile("deployment.yaml", []byte(resourceStr)))
|
||||
|
||||
ldr, err := loader.NewLoader(
|
||||
loader.RestrictionRootOnly, filesys.Separator, fSys)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
m, err := rmF.FromFile(ldr, "deployment.yaml")
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
mYaml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expYaml, mYaml)
|
||||
}
|
||||
|
||||
@@ -102,11 +103,11 @@ metadata:
|
||||
"name": "cm2",
|
||||
}}).ResMap()
|
||||
expYaml, err := expected.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
m, err := rmF.NewResMapFromBytes(encoded)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
mYaml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expYaml, mYaml)
|
||||
}
|
||||
|
||||
@@ -219,13 +220,13 @@ BAR=baz
|
||||
}
|
||||
}
|
||||
r, err := rmF.NewResMapFromConfigMapArgs(kvLdr, tc.input)
|
||||
assert.NoError(t, err, tc.description)
|
||||
require.NoError(t, err, tc.description)
|
||||
r.RemoveBuildAnnotations()
|
||||
rYaml, err := r.AsYaml()
|
||||
assert.NoError(t, err, tc.description)
|
||||
require.NoError(t, err, tc.description)
|
||||
tc.expected.RemoveBuildAnnotations()
|
||||
expYaml, err := tc.expected.AsYaml()
|
||||
assert.NoError(t, err, tc.description)
|
||||
require.NoError(t, err, tc.description)
|
||||
assert.Equal(t, expYaml, rYaml)
|
||||
}
|
||||
}
|
||||
@@ -257,7 +258,7 @@ func TestNewResMapFromSecretArgs(t *testing.T) {
|
||||
}
|
||||
actual.RemoveBuildAnnotations()
|
||||
actYaml, err := actual.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
expected := resmaptest_test.NewRmBuilder(t, rf).Add(
|
||||
map[string]interface{}{
|
||||
@@ -273,7 +274,7 @@ func TestNewResMapFromSecretArgs(t *testing.T) {
|
||||
},
|
||||
}).ResMap()
|
||||
expYaml, err := expected.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, string(expYaml), string(actYaml))
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/filters/labels"
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
. "sigs.k8s.io/kustomize/api/resmap"
|
||||
@@ -822,8 +823,9 @@ func TestAppendAll(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func makeMap1() ResMap {
|
||||
return rmF.FromResource(rf.FromMapAndOption(
|
||||
func makeMap1(t *testing.T) ResMap {
|
||||
t.Helper()
|
||||
r, err := rf.FromMapAndOption(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -836,11 +838,16 @@ func makeMap1() ResMap {
|
||||
},
|
||||
}, &types.GeneratorArgs{
|
||||
Behavior: "create",
|
||||
}))
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("expected new intance with an options but got error: %v", err)
|
||||
}
|
||||
return rmF.FromResource(r)
|
||||
}
|
||||
|
||||
func makeMap2(b types.GenerationBehavior) ResMap {
|
||||
return rmF.FromResource(rf.FromMapAndOption(
|
||||
func makeMap2(t *testing.T, b types.GenerationBehavior) ResMap {
|
||||
t.Helper()
|
||||
r, err := rf.FromMapAndOption(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -854,14 +861,19 @@ func makeMap2(b types.GenerationBehavior) ResMap {
|
||||
},
|
||||
}, &types.GeneratorArgs{
|
||||
Behavior: b.String(),
|
||||
}))
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("expected new intance with an options but got error: %v", err)
|
||||
}
|
||||
return rmF.FromResource(r)
|
||||
}
|
||||
|
||||
func TestAbsorbAll(t *testing.T) {
|
||||
metadata := map[string]interface{}{
|
||||
"name": "cmap",
|
||||
}
|
||||
expected := rmF.FromResource(rf.FromMapAndOption(
|
||||
|
||||
r, err := rf.FromMapAndOption(
|
||||
map[string]interface{}{
|
||||
"apiVersion": "apps/v1",
|
||||
"kind": "ConfigMap",
|
||||
@@ -874,25 +886,27 @@ func TestAbsorbAll(t *testing.T) {
|
||||
},
|
||||
&types.GeneratorArgs{
|
||||
Behavior: "create",
|
||||
}))
|
||||
w := makeMap1()
|
||||
assert.NoError(t, w.AbsorbAll(makeMap2(types.BehaviorMerge)))
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("expected new intance with an options but got error: %v", err)
|
||||
}
|
||||
expected := rmF.FromResource(r)
|
||||
w := makeMap1(t)
|
||||
require.NoError(t, w.AbsorbAll(makeMap2(t, types.BehaviorMerge)))
|
||||
expected.RemoveBuildAnnotations()
|
||||
w.RemoveBuildAnnotations()
|
||||
assert.NoError(t, expected.ErrorIfNotEqualLists(w))
|
||||
w = makeMap1()
|
||||
assert.NoError(t, w.AbsorbAll(nil))
|
||||
assert.NoError(t, w.ErrorIfNotEqualLists(makeMap1()))
|
||||
require.NoError(t, expected.ErrorIfNotEqualLists(w))
|
||||
w = makeMap1(t)
|
||||
require.NoError(t, w.AbsorbAll(nil))
|
||||
require.NoError(t, w.ErrorIfNotEqualLists(makeMap1(t)))
|
||||
|
||||
w = makeMap1()
|
||||
w2 := makeMap2(types.BehaviorReplace)
|
||||
assert.NoError(t, w.AbsorbAll(w2))
|
||||
w = makeMap1(t)
|
||||
w2 := makeMap2(t, types.BehaviorReplace)
|
||||
require.NoError(t, w.AbsorbAll(w2))
|
||||
w2.RemoveBuildAnnotations()
|
||||
assert.NoError(t, w2.ErrorIfNotEqualLists(w))
|
||||
w = makeMap1()
|
||||
w2 = makeMap2(types.BehaviorUnspecified)
|
||||
err := w.AbsorbAll(w2)
|
||||
assert.Error(t, err)
|
||||
require.NoError(t, w2.ErrorIfNotEqualLists(w))
|
||||
err = makeMap1(t).AbsorbAll(makeMap2(t, types.BehaviorUnspecified))
|
||||
require.Error(t, err)
|
||||
assert.True(
|
||||
t, strings.Contains(err.Error(), "behavior must be merge or replace"))
|
||||
}
|
||||
@@ -944,10 +958,10 @@ data:
|
||||
feeling: *color-used
|
||||
`
|
||||
rm, err := rmF.NewResMapFromBytes([]byte(input))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, rm.DeAnchor())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, rm.DeAnchor())
|
||||
yaml, err := rm.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, strings.TrimSpace(`
|
||||
apiVersion: v1
|
||||
data:
|
||||
@@ -978,10 +992,10 @@ spec:
|
||||
<<: *probe
|
||||
`
|
||||
rm, err := rmF.NewResMapFromBytes([]byte(input))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, rm.DeAnchor())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, rm.DeAnchor())
|
||||
yaml, err := rm.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, strings.TrimSpace(`apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -1025,7 +1039,7 @@ data:
|
||||
feeling: *color-used
|
||||
`
|
||||
_, err := rmF.NewResMapFromBytes([]byte(input))
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "unknown anchor 'color-used' referenced")
|
||||
}
|
||||
|
||||
@@ -1052,10 +1066,10 @@ items:
|
||||
feeling: *color-used
|
||||
`
|
||||
rm, err := rmF.NewResMapFromBytes([]byte(input))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, rm.DeAnchor())
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, rm.DeAnchor())
|
||||
yaml, err := rm.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, strings.TrimSpace(`
|
||||
apiVersion: v1
|
||||
data:
|
||||
@@ -1288,11 +1302,11 @@ spec:
|
||||
tc := tests[n]
|
||||
t.Run(n, func(t *testing.T) {
|
||||
m, err := rmF.NewResMapFromBytes([]byte(strings.Join(tc.base, "\n---\n")))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
foundError := false
|
||||
for _, patch := range tc.patches {
|
||||
rp, err := rf.FromBytes([]byte(patch))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
idSet := resource.MakeIdSet([]*resource.Resource{rp})
|
||||
if err = m.ApplySmPatch(idSet, rp); err != nil {
|
||||
foundError = true
|
||||
@@ -1307,7 +1321,7 @@ spec:
|
||||
assert.False(t, tc.errorExpected)
|
||||
m.RemoveBuildAnnotations()
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, strings.Join(tc.expected, "---\n"), string(yml))
|
||||
})
|
||||
}
|
||||
@@ -1496,8 +1510,8 @@ metadata:
|
||||
tc := tests[name]
|
||||
t.Run(name, func(t *testing.T) {
|
||||
m, err := rmF.NewResMapFromBytes([]byte(tc.input))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, m.ApplyFilter(tc.f))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, m.ApplyFilter(tc.f))
|
||||
kusttest_test.AssertActualEqualsExpectedWithTweak(
|
||||
t, m, nil, tc.expected)
|
||||
})
|
||||
@@ -1591,16 +1605,16 @@ $patch: delete
|
||||
tc := tests[name]
|
||||
t.Run(name, func(t *testing.T) {
|
||||
m, err := rmF.NewResMapFromBytes([]byte(target))
|
||||
assert.NoError(t, err, name)
|
||||
require.NoError(t, err, name)
|
||||
idSet := resource.MakeIdSet(m.Resources())
|
||||
assert.Equal(t, 1, idSet.Size(), name)
|
||||
p, err := rf.FromBytes([]byte(tc.patch))
|
||||
assert.NoError(t, err, name)
|
||||
assert.NoError(t, m.ApplySmPatch(idSet, p), name)
|
||||
require.NoError(t, err, name)
|
||||
require.NoError(t, m.ApplySmPatch(idSet, p), name)
|
||||
assert.Equal(t, tc.finalMapSize, m.Size(), name)
|
||||
m.RemoveBuildAnnotations()
|
||||
yml, err := m.AsYaml()
|
||||
assert.NoError(t, err, name)
|
||||
require.NoError(t, err, name)
|
||||
assert.Equal(t, tc.expected, string(yml), name)
|
||||
})
|
||||
}
|
||||
@@ -1609,28 +1623,28 @@ $patch: delete
|
||||
func TestOriginAnnotations(t *testing.T) {
|
||||
w := New()
|
||||
for i := 0; i < 3; i++ {
|
||||
assert.NoError(t, w.Append(makeCm(i)))
|
||||
require.NoError(t, w.Append(makeCm(i)))
|
||||
}
|
||||
// this should add an origin annotation to every resource
|
||||
assert.NoError(t, w.AddOriginAnnotation(origin1))
|
||||
require.NoError(t, w.AddOriginAnnotation(origin1))
|
||||
resources := w.Resources()
|
||||
for _, res := range resources {
|
||||
or, err := res.GetOrigin()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, origin1, or)
|
||||
}
|
||||
// this should not overwrite the existing origin annotations
|
||||
assert.NoError(t, w.AddOriginAnnotation(origin2))
|
||||
require.NoError(t, w.AddOriginAnnotation(origin2))
|
||||
for _, res := range resources {
|
||||
or, err := res.GetOrigin()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, origin1, or)
|
||||
}
|
||||
// this should remove origin annotations from all resources
|
||||
assert.NoError(t, w.RemoveOriginAnnotations())
|
||||
require.NoError(t, w.RemoveOriginAnnotations())
|
||||
for _, res := range resources {
|
||||
or, err := res.GetOrigin()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, or)
|
||||
}
|
||||
}
|
||||
@@ -1638,31 +1652,31 @@ func TestOriginAnnotations(t *testing.T) {
|
||||
func TestTransformerAnnotations(t *testing.T) {
|
||||
w := New()
|
||||
for i := 0; i < 3; i++ {
|
||||
assert.NoError(t, w.Append(makeCm(i)))
|
||||
require.NoError(t, w.Append(makeCm(i)))
|
||||
}
|
||||
// this should add an origin annotation to every resource
|
||||
assert.NoError(t, w.AddTransformerAnnotation(origin1))
|
||||
require.NoError(t, w.AddTransformerAnnotation(origin1))
|
||||
resources := w.Resources()
|
||||
for _, res := range resources {
|
||||
or, err := res.GetOrigin()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, origin1, or)
|
||||
}
|
||||
// this should add a transformer annotation to every resource
|
||||
assert.NoError(t, w.AddTransformerAnnotation(origin2))
|
||||
require.NoError(t, w.AddTransformerAnnotation(origin2))
|
||||
for _, res := range resources {
|
||||
or, err := res.GetOrigin()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, origin1, or)
|
||||
tr, err := res.GetTransformations()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, resource.Transformations{origin2}, tr)
|
||||
}
|
||||
// remove transformer annotations from all resources
|
||||
assert.NoError(t, w.RemoveTransformerAnnotations())
|
||||
require.NoError(t, w.RemoveTransformerAnnotations())
|
||||
for _, res := range resources {
|
||||
tr, err := res.GetTransformations()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, tr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
. "sigs.k8s.io/kustomize/api/resmap"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||
@@ -50,7 +51,7 @@ metadata:
|
||||
name: x-name1
|
||||
namespace: x-default
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -183,7 +184,7 @@ func TestFindPatchTargets(t *testing.T) {
|
||||
}
|
||||
for n, testcase := range testcases {
|
||||
actual, err := rm.Select(testcase.target)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equalf(
|
||||
t, testcase.count, len(actual), "test=%s target=%v", n, testcase.target)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,12 @@ func (rf *Factory) Hasher() ifc.KustHasher {
|
||||
|
||||
// FromMap returns a new instance of Resource.
|
||||
func (rf *Factory) FromMap(m map[string]interface{}) *Resource {
|
||||
return rf.FromMapAndOption(m, nil)
|
||||
res, err := rf.FromMapAndOption(m, nil)
|
||||
if err != nil {
|
||||
// TODO: return err instead of log.
|
||||
log.Fatalf("failed to create resource from map: %v", err)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// FromMapWithName returns a new instance with the given "original" name.
|
||||
@@ -52,19 +57,22 @@ func (rf *Factory) FromMapWithName(n string, m map[string]interface{}) *Resource
|
||||
|
||||
// FromMapWithNamespaceAndName returns a new instance with the given "original" namespace.
|
||||
func (rf *Factory) FromMapWithNamespaceAndName(ns string, n string, m map[string]interface{}) *Resource {
|
||||
r := rf.FromMapAndOption(m, nil)
|
||||
r, err := rf.FromMapAndOption(m, nil)
|
||||
if err != nil {
|
||||
// TODO: return err instead of log.
|
||||
log.Fatalf("failed to create resource from map: %v", err)
|
||||
}
|
||||
return r.setPreviousId(ns, n, r.GetKind())
|
||||
}
|
||||
|
||||
// FromMapAndOption returns a new instance of Resource with given options.
|
||||
func (rf *Factory) FromMapAndOption(
|
||||
m map[string]interface{}, args *types.GeneratorArgs) *Resource {
|
||||
m map[string]interface{}, args *types.GeneratorArgs) (*Resource, error) {
|
||||
n, err := yaml.FromMap(m)
|
||||
if err != nil {
|
||||
// TODO: return err instead of log.
|
||||
log.Fatal(err)
|
||||
return nil, fmt.Errorf("failed to convert map to YAML node: %w", err)
|
||||
}
|
||||
return rf.makeOne(n, args)
|
||||
return rf.makeOne(n, args), nil
|
||||
}
|
||||
|
||||
// makeOne returns a new instance of Resource.
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/internal/loader"
|
||||
. "sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
@@ -360,9 +361,9 @@ kind: List
|
||||
assert.Equal(t, len(test.expectedOut), len(rs))
|
||||
for i := range rs {
|
||||
expYaml, err := test.expectedOut[i].AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
actYaml, err := rs[i].AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expYaml, actYaml)
|
||||
}
|
||||
})
|
||||
@@ -634,7 +635,7 @@ data:
|
||||
assert.Equal(t, len(tc.exp.out), len(rs))
|
||||
for i := range rs {
|
||||
actual, err := rs[i].String()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(
|
||||
t, strings.TrimSpace(tc.exp.out[i]), strings.TrimSpace(actual))
|
||||
}
|
||||
@@ -721,7 +722,7 @@ metadata:
|
||||
t.Run(n, func(t *testing.T) {
|
||||
nin, _ := kio.FromBytes(tc.input)
|
||||
res, err := factory.DropLocalNodes(nin)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
if tc.expected == nil {
|
||||
assert.Equal(t, 0, len(res))
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
. "sigs.k8s.io/kustomize/api/resource"
|
||||
kyaml "sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
)
|
||||
@@ -37,7 +38,7 @@ repo: https://github.com/kubernetes-sigs/kustomize
|
||||
}
|
||||
for _, test := range tests {
|
||||
actual, err := test.in.Append(test.path).String()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, test.expected, actual)
|
||||
}
|
||||
}
|
||||
@@ -78,7 +79,7 @@ repo: github.com/kubernetes-sigs/kustomize/examples/multibases/dev/
|
||||
|
||||
for _, test := range tests {
|
||||
actual, err := test.in.String()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, test.expected, actual)
|
||||
}
|
||||
}
|
||||
@@ -154,7 +155,7 @@ func TestTransformationsString(t *testing.T) {
|
||||
}
|
||||
for _, test := range tests {
|
||||
actual, err := test.in.String()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, test.expected, actual)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,12 +287,25 @@ func (r *Resource) getCsvAnnotation(name string) []string {
|
||||
return strings.Split(annotations[name], ",")
|
||||
}
|
||||
|
||||
// PrefixesSuffixesEquals is conceptually doing the same task
|
||||
// as OutermostPrefixSuffix but performs a deeper comparison
|
||||
// of the suffix and prefix slices.
|
||||
func (r *Resource) PrefixesSuffixesEquals(o ResCtx) bool {
|
||||
return utils.SameEndingSubSlice(r.GetNamePrefixes(), o.GetNamePrefixes()) &&
|
||||
utils.SameEndingSubSlice(r.GetNameSuffixes(), o.GetNameSuffixes())
|
||||
// PrefixesSuffixesEquals is conceptually doing the same task as
|
||||
// OutermostPrefixSuffix but performs a deeper comparison of the suffix and
|
||||
// prefix slices.
|
||||
// The allowEmpty flag determines whether an empty prefix/suffix
|
||||
// should be considered a match on anything.
|
||||
// This is used when filtering, starting with a coarser pass allowing empty
|
||||
// matches, before requiring exact matches if there are multiple
|
||||
// remaining candidates.
|
||||
func (r *Resource) PrefixesSuffixesEquals(o ResCtx, allowEmpty bool) bool {
|
||||
if allowEmpty {
|
||||
eitherPrefixEmpty := len(r.GetNamePrefixes()) == 0 || len(o.GetNamePrefixes()) == 0
|
||||
eitherSuffixEmpty := len(r.GetNameSuffixes()) == 0 || len(o.GetNameSuffixes()) == 0
|
||||
|
||||
return (eitherPrefixEmpty || utils.SameEndingSubSlice(r.GetNamePrefixes(), o.GetNamePrefixes())) &&
|
||||
(eitherSuffixEmpty || utils.SameEndingSubSlice(r.GetNameSuffixes(), o.GetNameSuffixes()))
|
||||
} else {
|
||||
return utils.SameEndingSubSlice(r.GetNamePrefixes(), o.GetNamePrefixes()) &&
|
||||
utils.SameEndingSubSlice(r.GetNameSuffixes(), o.GetNameSuffixes())
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveBuildAnnotations removes annotations created by the build process.
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/internal/utils"
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
. "sigs.k8s.io/kustomize/api/resource"
|
||||
@@ -156,7 +157,7 @@ spec:
|
||||
ports:
|
||||
- containerPort: 80
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
patch, err := factory.FromBytes([]byte(`
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
@@ -171,11 +172,11 @@ spec:
|
||||
ports:
|
||||
- containerPort: 777
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.NoError(t, resource.ApplySmPatch(patch))
|
||||
require.NoError(t, resource.ApplySmPatch(patch))
|
||||
bytes, err := resource.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -218,7 +219,7 @@ spec:
|
||||
A: X
|
||||
B: Y
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
patch, err := factory.FromBytes([]byte(`
|
||||
apiVersion: example.com/v1
|
||||
kind: Foo
|
||||
@@ -232,10 +233,10 @@ spec:
|
||||
baz:
|
||||
hello: world
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, resource.ApplySmPatch(patch))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, resource.ApplySmPatch(patch))
|
||||
bytes, err := resource.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: example.com/v1
|
||||
kind: Foo
|
||||
metadata:
|
||||
@@ -259,7 +260,7 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
patch, err := factory.FromBytes([]byte(`
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
@@ -268,10 +269,10 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 999
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, resource.ApplySmPatch(patch))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, resource.ApplySmPatch(patch))
|
||||
bytes, err := resource.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -281,6 +282,43 @@ spec:
|
||||
`, string(bytes))
|
||||
}
|
||||
|
||||
// regression test for https://github.com/kubernetes-sigs/kustomize/issues/5031
|
||||
func TestApplySmPatch_Idempotency(t *testing.T) {
|
||||
// an arbitrary number of times to apply the patch
|
||||
patchApplyCount := 4
|
||||
resourceYaml := `apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
creationTimestamp: null
|
||||
labels: null
|
||||
name: my-deployment
|
||||
`
|
||||
resource, err := factory.FromBytes([]byte(resourceYaml))
|
||||
require.NoError(t, err)
|
||||
|
||||
noOpPatch, err := factory.FromBytes([]byte(`
|
||||
apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: my-deployment
|
||||
`))
|
||||
require.NoError(t, err)
|
||||
|
||||
for i := 0; i < patchApplyCount; i++ {
|
||||
require.NoError(t, resource.ApplySmPatch(noOpPatch))
|
||||
|
||||
bytes, err := resource.AsYAML()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(
|
||||
t,
|
||||
resourceYaml,
|
||||
string(bytes),
|
||||
"resource should be unchanged after re-application of patch",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplySmPatchShouldOutputListItemsInCorrectOrder(t *testing.T) {
|
||||
cases := []struct {
|
||||
name string
|
||||
@@ -410,13 +448,13 @@ spec:
|
||||
- name: foo
|
||||
- name: bar
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
patch, err := factory.FromBytes([]byte(tc.patch))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, resource.ApplySmPatch(patch))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, resource.ApplySmPatch(patch))
|
||||
bytes, err := resource.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tc.expectedOutput, string(bytes))
|
||||
})
|
||||
}
|
||||
@@ -529,13 +567,13 @@ metadata:
|
||||
name: test
|
||||
finalizers: ["foo", "bar"]
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
patch, err := factory.FromBytes([]byte(tc.patch))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, resource.ApplySmPatch(patch))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, resource.ApplySmPatch(patch))
|
||||
bytes, err := resource.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, tc.expectedOutput, string(bytes))
|
||||
})
|
||||
}
|
||||
@@ -566,7 +604,7 @@ data:
|
||||
}
|
||||
resource.MergeDataMapFrom(patch)
|
||||
bytes, err := resource.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
data:
|
||||
fruit: pear
|
||||
@@ -612,19 +650,19 @@ spec:
|
||||
hello: world
|
||||
`
|
||||
r1, err := factory.FromBytes([]byte(s1))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
r2, err := factory.FromBytes([]byte(s2))
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, r1.ApplySmPatch(r2))
|
||||
require.NoError(t, err)
|
||||
require.NoError(t, r1.ApplySmPatch(r2))
|
||||
bytes, err := r1.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expected, string(bytes))
|
||||
|
||||
r1, _ = factory.FromBytes([]byte(s1))
|
||||
r2, _ = factory.FromBytes([]byte(s2))
|
||||
assert.NoError(t, r2.ApplySmPatch(r1))
|
||||
require.NoError(t, r2.ApplySmPatch(r1))
|
||||
bytes, err = r2.AsYAML()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, expected, string(bytes))
|
||||
}
|
||||
|
||||
@@ -939,17 +977,17 @@ spec:
|
||||
|
||||
for name, test := range tests {
|
||||
resource, err := factory.FromBytes([]byte(test.base))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
for _, p := range test.patch {
|
||||
patch, err := factory.FromBytes([]byte(p))
|
||||
assert.NoError(t, err, name)
|
||||
assert.NoError(t, resource.ApplySmPatch(patch), name)
|
||||
require.NoError(t, err, name)
|
||||
require.NoError(t, resource.ApplySmPatch(patch), name)
|
||||
}
|
||||
bytes, err := resource.AsYAML()
|
||||
if test.errorExpected {
|
||||
assert.Error(t, err, name)
|
||||
require.Error(t, err, name)
|
||||
} else {
|
||||
assert.NoError(t, err, name)
|
||||
require.NoError(t, err, name)
|
||||
assert.Equal(t, test.expected, string(bytes), name)
|
||||
}
|
||||
}
|
||||
@@ -1349,7 +1387,7 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
|
||||
gvk := r.GetGvk()
|
||||
expected := "apps"
|
||||
@@ -1377,7 +1415,7 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
r.SetGvk(resid.GvkFromString("knd.ver.grp"))
|
||||
gvk := r.GetGvk()
|
||||
if expected, actual := "grp", gvk.Group; expected != actual {
|
||||
@@ -1400,7 +1438,7 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
r.AppendRefBy(resid.FromString("knd1.ver1.gr1/name1.ns1"))
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Deployment
|
||||
@@ -1438,13 +1476,13 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
origin := &Origin{
|
||||
Path: "deployment.yaml",
|
||||
Repo: "github.com/myrepo",
|
||||
Ref: "master",
|
||||
}
|
||||
assert.NoError(t, r.SetOrigin(origin))
|
||||
require.NoError(t, r.SetOrigin(origin))
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -1458,7 +1496,7 @@ spec:
|
||||
numReplicas: 1
|
||||
`, r.MustString())
|
||||
or, err := r.GetOrigin()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, origin, or)
|
||||
}
|
||||
|
||||
@@ -1471,7 +1509,7 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`))
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
origin1 := &Origin{
|
||||
Repo: "github.com/myrepo",
|
||||
Ref: "master",
|
||||
@@ -1500,7 +1538,7 @@ spec:
|
||||
},
|
||||
},
|
||||
}
|
||||
assert.NoError(t, r.AddTransformation(origin1))
|
||||
require.NoError(t, r.AddTransformation(origin1))
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -1518,7 +1556,7 @@ metadata:
|
||||
spec:
|
||||
numReplicas: 1
|
||||
`, r.MustString())
|
||||
assert.NoError(t, r.AddTransformation(origin2))
|
||||
require.NoError(t, r.AddTransformation(origin2))
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -1543,9 +1581,9 @@ spec:
|
||||
numReplicas: 1
|
||||
`, r.MustString())
|
||||
transformations, err := r.GetTransformations()
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, Transformations{origin1, origin2}, transformations)
|
||||
assert.NoError(t, r.ClearTransformations())
|
||||
require.NoError(t, r.ClearTransformations())
|
||||
assert.Equal(t, `apiVersion: v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
|
||||
@@ -30,6 +30,8 @@ type FieldSpec struct {
|
||||
resid.Gvk `json:",inline,omitempty" yaml:",inline,omitempty"`
|
||||
Path string `json:"path,omitempty" yaml:"path,omitempty"`
|
||||
CreateIfNotPresent bool `json:"create,omitempty" yaml:"create,omitempty"`
|
||||
|
||||
// Note: If any new pointer based members are added, FsSlice.DeepCopy needs to be updated
|
||||
}
|
||||
|
||||
func (fs FieldSpec) String() string {
|
||||
@@ -50,6 +52,13 @@ func (s FsSlice) Less(i, j int) bool {
|
||||
return s[i].Gvk.IsLessThan(s[j].Gvk)
|
||||
}
|
||||
|
||||
// DeepCopy returns a new copy of FsSlice
|
||||
func (s FsSlice) DeepCopy() FsSlice {
|
||||
ret := make(FsSlice, len(s))
|
||||
copy(ret, s)
|
||||
return ret
|
||||
}
|
||||
|
||||
// MergeAll merges the argument into this, returning the result.
|
||||
// Items already present are ignored.
|
||||
// Items that conflict (primary key matches, but remain data differs)
|
||||
|
||||
@@ -142,3 +142,27 @@ func TestFsSlice_MergeAll(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFsSlice_DeepCopy(t *testing.T) {
|
||||
original := make(FsSlice, 2, 4)
|
||||
original[0] = FieldSpec{Path: "a"}
|
||||
original[1] = FieldSpec{Path: "b"}
|
||||
|
||||
copied := original.DeepCopy()
|
||||
|
||||
original, _ = original.MergeOne(FieldSpec{Path: "c"})
|
||||
|
||||
// perform mutations which should not affect original
|
||||
copied.Swap(0, 1)
|
||||
_, _ = copied.MergeOne(FieldSpec{Path: "d"})
|
||||
|
||||
// if DeepCopy does not work, original would be {b,a,d} instead of {a,b,c}
|
||||
expected := FsSlice{
|
||||
{Path: "a"},
|
||||
{Path: "b"},
|
||||
{Path: "c"},
|
||||
}
|
||||
if !reflect.DeepEqual(original, expected) {
|
||||
t.Fatalf("original affected by mutations to copied object:\ngot\t%+v,\nexpected: %+v", original, expected)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,9 @@ type HelmChart struct {
|
||||
// ApiVersions is the kubernetes apiversions used for Capabilities.APIVersions
|
||||
ApiVersions []string `json:"apiVersions,omitempty" yaml:"apiVersions,omitempty"`
|
||||
|
||||
// KubeVersion is the kubernetes version used by Helm for Capabilities.KubeVersion"
|
||||
KubeVersion string `json:"kubeVersion,omitempty" yaml:"kubeVersion,omitempty"`
|
||||
|
||||
// NameTemplate is for specifying the name template used to name the release.
|
||||
NameTemplate string `json:"nameTemplate,omitempty" yaml:"nameTemplate,omitempty"`
|
||||
|
||||
@@ -172,6 +175,10 @@ func (h HelmChart) AsHelmArgs(absChartHome string) []string {
|
||||
for _, apiVer := range h.ApiVersions {
|
||||
args = append(args, "--api-versions", apiVer)
|
||||
}
|
||||
if h.KubeVersion != "" {
|
||||
args = append(args, "--kube-version", h.KubeVersion)
|
||||
}
|
||||
|
||||
if h.IncludeCRDs {
|
||||
args = append(args, "--include-crds")
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ func TestAsHelmArgs(t *testing.T) {
|
||||
Version: "1.0.0",
|
||||
Repo: "https://helm.releases.hashicorp.com",
|
||||
ApiVersions: []string{"foo", "bar"},
|
||||
KubeVersion: "1.27",
|
||||
NameTemplate: "template",
|
||||
SkipTests: true,
|
||||
IncludeCRDs: true,
|
||||
@@ -33,6 +34,7 @@ func TestAsHelmArgs(t *testing.T) {
|
||||
"-f", "values",
|
||||
"-f", "values1", "-f", "values2",
|
||||
"--api-versions", "foo", "--api-versions", "bar",
|
||||
"--kube-version", "1.27",
|
||||
"--include-crds",
|
||||
"--skip-tests",
|
||||
"--no-hooks"})
|
||||
|
||||
@@ -188,6 +188,7 @@ const (
|
||||
deprecatedPatchesJson6902Message = "# Warning: 'patchesJson6902' is deprecated. Please use 'patches' instead." + " " + deprecatedWarningToRunEditFix
|
||||
deprecatedPatchesStrategicMergeMessage = "# Warning: 'patchesStrategicMerge' is deprecated. Please use 'patches' instead." + " " + deprecatedWarningToRunEditFix
|
||||
deprecatedVarsMessage = "# Warning: 'vars' is deprecated. Please use 'replacements' instead." + " " + deprecatedWarningToRunEditFixExperimential
|
||||
deprecatedCommonLabelsWarningMessage = "# Warning: 'commonLabels' is deprecated. Please use 'labels' instead." + " " + deprecatedWarningToRunEditFix
|
||||
)
|
||||
|
||||
// CheckDeprecatedFields check deprecated field is used or not.
|
||||
@@ -196,6 +197,9 @@ func (k *Kustomization) CheckDeprecatedFields() *[]string {
|
||||
if k.Bases != nil {
|
||||
warningMessages = append(warningMessages, deprecatedBaseWarningMessage)
|
||||
}
|
||||
if k.CommonLabels != nil {
|
||||
warningMessages = append(warningMessages, deprecatedCommonLabelsWarningMessage)
|
||||
}
|
||||
if k.ImageTags != nil {
|
||||
warningMessages = append(warningMessages, deprecatedImageTagsWarningMessage)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,13 @@ func TestKustomization_CheckDeprecatedFields(t *testing.T) {
|
||||
},
|
||||
want: &[]string{deprecatedBaseWarningMessage},
|
||||
},
|
||||
{
|
||||
name: "using_CommonLabels",
|
||||
k: Kustomization{
|
||||
CommonLabels: map[string]string{},
|
||||
},
|
||||
want: &[]string{deprecatedCommonLabelsWarningMessage},
|
||||
},
|
||||
{
|
||||
name: "using_ImageTags",
|
||||
k: Kustomization{
|
||||
@@ -61,6 +68,7 @@ func TestKustomization_CheckDeprecatedFields(t *testing.T) {
|
||||
name: "usingAll",
|
||||
k: Kustomization{
|
||||
Bases: []string{"base"},
|
||||
CommonLabels: map[string]string{},
|
||||
ImageTags: []Image{},
|
||||
PatchesJson6902: []Patch{},
|
||||
PatchesStrategicMerge: []PatchStrategicMerge{},
|
||||
@@ -68,6 +76,7 @@ func TestKustomization_CheckDeprecatedFields(t *testing.T) {
|
||||
},
|
||||
want: &[]string{
|
||||
deprecatedBaseWarningMessage,
|
||||
deprecatedCommonLabelsWarningMessage,
|
||||
deprecatedImageTagsWarningMessage,
|
||||
deprecatedPatchesJson6902Message,
|
||||
deprecatedPatchesStrategicMergeMessage,
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
package types
|
||||
|
||||
type HelmConfig struct {
|
||||
Enabled bool
|
||||
Command string
|
||||
Enabled bool
|
||||
Command string
|
||||
ApiVersions []string
|
||||
KubeVersion string
|
||||
}
|
||||
|
||||
// PluginConfig holds plugin configuration.
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||
yaml "sigs.k8s.io/yaml/goyaml.v2"
|
||||
)
|
||||
|
||||
func TestGVK(t *testing.T) {
|
||||
|
||||
@@ -85,7 +85,7 @@ End-of-message
|
||||
`Dockerfile` installs `kustomize fn` and copies the script into the container image.
|
||||
|
||||
```
|
||||
FROM golang:1.20-bullseye
|
||||
FROM golang:1.21-bullseye
|
||||
RUN go get sigs.k8s.io/kustomize/cmd/config
|
||||
RUN mv /go/bin/config /usr/bin/config
|
||||
COPY nginx-template.sh /usr/bin/nginx-template.sh
|
||||
|
||||
@@ -1,37 +1,34 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/go-errors/errors v1.4.2
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/stretchr/testify v1.8.1
|
||||
github.com/spf13/cobra v1.8.0
|
||||
github.com/stretchr/testify v1.8.4
|
||||
gopkg.in/inf.v0 v0.9.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.17.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
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/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/sergi/go-diff v1.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
@@ -30,7 +33,8 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm
|
||||
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.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -39,14 +43,16 @@ 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
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/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@@ -57,20 +63,21 @@ github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81P
|
||||
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=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
|
||||
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 h1:+FNtrFTmVw0YZGpBGX56XDee331t6JAXeK2bcyhLOOc=
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5/go.mod h1:nmDLcffg48OtT/PSW0Hg7FvpRQsQh5OSqIylirxKC7o=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
@@ -79,15 +86,14 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
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=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961 h1:pqRVJGQJz6oeZby8qmPKXYIBjyrcv7EHCe/33UkZMYA=
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961/go.mod h1:l8HTwL5fqnlns4jOveW1L75eo7R9KFHxiE0bsPGy428=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0 h1:ynlLMAxDhrY9otSg5GYE2TcIz31XkGZ2Pkj7SdolD84=
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0/go.mod h1:+uMkBahdU1KNOj78Uta4rrXH+iH7wvg+nW7+GULvREA=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/kustomize/kyaml v0.17.0 h1:G2bWs03V9Ur2PinHLzTUJ8Ded+30SzXZKiO92SRDs3c=
|
||||
sigs.k8s.io/kustomize/kyaml v0.17.0/go.mod h1:6lxkYF1Cv9Ic8g/N7I86cvxNc5iinUo/P2vKsHNmpyE=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/cmd/config/internal/commands"
|
||||
"sigs.k8s.io/kustomize/kyaml/copyutil"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
@@ -615,7 +616,7 @@ spec:
|
||||
defer openapi.ResetOpenAPI()
|
||||
sourceDir := filepath.Join("test", "testdata", test.dataset)
|
||||
baseDir := t.TempDir()
|
||||
assert.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
|
||||
require.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
|
||||
runner := commands.GetCatRunner("")
|
||||
actual := &bytes.Buffer{}
|
||||
runner.Command.SetOut(actual)
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/cmd/config/internal/commands"
|
||||
"sigs.k8s.io/kustomize/kyaml/copyutil"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
@@ -118,7 +119,7 @@ Deployment: 1
|
||||
defer openapi.ResetOpenAPI()
|
||||
sourceDir := filepath.Join("test", "testdata", test.dataset)
|
||||
baseDir := t.TempDir()
|
||||
assert.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
|
||||
require.NoError(t, copyutil.CopyDir(filesys.MakeFsOnDisk(), sourceDir, baseDir))
|
||||
runner := commands.GetCountRunner("")
|
||||
actual := &bytes.Buffer{}
|
||||
runner.Command.SetOut(actual)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
FROM golang:1.20-bullseye
|
||||
FROM golang:1.21-bullseye
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
|
||||
|
||||
@@ -1,34 +1,31 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainerconfig
|
||||
|
||||
go 1.20
|
||||
go 1.21
|
||||
|
||||
require sigs.k8s.io/kustomize/kyaml v0.14.2
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.3 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/google/go-cmp v0.5.9 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
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/spf13/cobra v1.7.0 // indirect
|
||||
github.com/spf13/cobra v1.8.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961 // indirect
|
||||
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
|
||||
@@ -1,35 +1,40 @@
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
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.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
@@ -38,13 +43,16 @@ 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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
@@ -54,28 +62,29 @@ github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpE
|
||||
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=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
|
||||
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
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.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=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961 h1:pqRVJGQJz6oeZby8qmPKXYIBjyrcv7EHCe/33UkZMYA=
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961/go.mod h1:l8HTwL5fqnlns4jOveW1L75eo7R9KFHxiE0bsPGy428=
|
||||
k8s.io/utils v0.0.0-20230505201702-9f6742963106 h1:EObNQ3TW2D+WptiYXlApGNLVy0zm/JIBVY9i+M4wpAU=
|
||||
k8s.io/utils v0.0.0-20230505201702-9f6742963106/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
FROM golang:1.21-bullseye
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
|
||||
# download modules
|
||||
# COPY go.mod go.mod
|
||||
# COPY go.sum go.sum
|
||||
# RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN go build -v -o /usr/local/bin/function ./cmd/config/internal/commands/e2e/e2econtainerenvgenerator
|
||||
|
||||
FROM alpine:latest
|
||||
COPY --from=0 /usr/local/bin/function /usr/local/bin/function
|
||||
CMD ["function"]
|
||||
@@ -0,0 +1,9 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
include ../../../../../../Makefile-modules.mk
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
docker build . -t gcr.io/kustomize-functions/e2econtainerenvgenerator
|
||||
docker push gcr.io/kustomize-functions/e2econtainerenvgenerator
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main contains a function to be used for e2e testing.
|
||||
// See https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md
|
||||
package main
|
||||
@@ -0,0 +1,31 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainerenvgenerator
|
||||
|
||||
go 1.21
|
||||
|
||||
require sigs.k8s.io/kustomize/kyaml v0.14.2
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
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/spf13/cobra v1.8.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
@@ -0,0 +1,90 @@
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
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.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
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.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
|
||||
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
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.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
@@ -0,0 +1,38 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
)
|
||||
|
||||
func main() {
|
||||
api := new(struct {
|
||||
Template string `json:"template" yaml:"template"`
|
||||
})
|
||||
// create the template
|
||||
templateFn := func(items []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
generated := []*yaml.RNode{}
|
||||
for range items {
|
||||
templateResult, err := yaml.Parse(fmt.Sprintf(api.Template, os.Getenv("TESTTEMPLATE")))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse: %w", err)
|
||||
}
|
||||
generated = append(generated, templateResult)
|
||||
}
|
||||
return generated, nil
|
||||
}
|
||||
p := framework.SimpleProcessor{Config: api, Filter: kio.FilterFunc(templateFn)}
|
||||
cmd := command.Build(p, command.StandaloneDisabled, false)
|
||||
command.AddGenerateDockerfile(cmd)
|
||||
if err := cmd.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
FROM golang:1.21-bullseye
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
|
||||
# download modules
|
||||
# COPY go.mod go.mod
|
||||
# COPY go.sum go.sum
|
||||
# RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN go build -v -o /usr/local/bin/function ./cmd/config/internal/commands/e2e/e2econtainermountbind
|
||||
|
||||
FROM alpine:latest
|
||||
COPY --from=0 /usr/local/bin/function /usr/local/bin/function
|
||||
CMD ["function"]
|
||||
@@ -0,0 +1,9 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
include ../../../../../../Makefile-modules.mk
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
docker build . -t gcr.io/kustomize-functions/e2econtainermountbind
|
||||
docker push gcr.io/kustomize-functions/e2econtainermountbind
|
||||
@@ -0,0 +1,31 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainer-render-helm-chart
|
||||
|
||||
go 1.21
|
||||
|
||||
require sigs.k8s.io/kustomize/kyaml v0.14.2
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
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/spf13/cobra v1.8.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
@@ -0,0 +1,90 @@
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
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.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
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.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
|
||||
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
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.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright 2023 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework"
|
||||
"sigs.k8s.io/kustomize/kyaml/fn/framework/command"
|
||||
"sigs.k8s.io/kustomize/kyaml/kio"
|
||||
"sigs.k8s.io/kustomize/kyaml/yaml"
|
||||
)
|
||||
|
||||
func main() {
|
||||
api := new(struct {
|
||||
Path string `json:"path" yaml:"template"`
|
||||
})
|
||||
// create the template
|
||||
readFn := func(items []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
generated := []*yaml.RNode{}
|
||||
for range items {
|
||||
bytes, err := os.ReadFile(api.Path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to read file: %w", err)
|
||||
}
|
||||
resources, err := yaml.Parse(string(bytes))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse: %w", err)
|
||||
}
|
||||
generated = append(generated, resources)
|
||||
}
|
||||
|
||||
return generated, nil
|
||||
}
|
||||
p := framework.SimpleProcessor{Config: api, Filter: kio.FilterFunc(readFn)}
|
||||
cmd := command.Build(p, command.StandaloneDisabled, false)
|
||||
command.AddGenerateDockerfile(cmd)
|
||||
if err := cmd.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
FROM golang:1.21-bullseye
|
||||
ENV CGO_ENABLED=0
|
||||
WORKDIR /go/src/
|
||||
|
||||
# download modules
|
||||
# COPY go.mod go.mod
|
||||
# COPY go.sum go.sum
|
||||
# RUN go mod download
|
||||
|
||||
COPY . .
|
||||
RUN go build -v -o /usr/local/bin/function ./cmd/config/internal/commands/e2e/e2econtainersimplegenerator
|
||||
|
||||
FROM alpine:latest
|
||||
COPY --from=0 /usr/local/bin/function /usr/local/bin/function
|
||||
CMD ["function"]
|
||||
@@ -0,0 +1,9 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
include ../../../../../../Makefile-modules.mk
|
||||
|
||||
.PHONY: image
|
||||
image:
|
||||
docker build . -t gcr.io/kustomize-functions/e2econtainersimplegenerator
|
||||
docker push gcr.io/kustomize-functions/e2econtainersimplegenerator
|
||||
@@ -0,0 +1,6 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Package main contains a function to be used for e2e testing.
|
||||
// See https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md
|
||||
package main
|
||||
@@ -0,0 +1,31 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainersimplegenerator
|
||||
|
||||
go 1.21
|
||||
|
||||
require sigs.k8s.io/kustomize/kyaml v0.14.2
|
||||
|
||||
require (
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/go-errors/errors v1.4.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.6 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/gnostic-models v0.6.8 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
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/spf13/cobra v1.8.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.17.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
@@ -0,0 +1,90 @@
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
|
||||
github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
|
||||
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
|
||||
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
|
||||
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
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.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
|
||||
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
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.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/xlab/treeprint v1.2.0 h1:HzHnuAF1plUN2zGlAFHbSQP2qJ0ZAD3XF5XD7OesXRQ=
|
||||
github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0=
|
||||
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
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.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780=
|
||||
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
|
||||
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user