mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-15 19:08:16 +00:00
Compare commits
84 Commits
api/v0.15.
...
release-ap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2ec4bb482 | ||
|
|
29d0214cbd | ||
|
|
faf93bb71d | ||
|
|
71f6f4c7d7 | ||
|
|
b22dbc7db9 | ||
|
|
bfe18b8198 | ||
|
|
6f47203e3f | ||
|
|
afc2357d5f | ||
|
|
c1ae80d25d | ||
|
|
f23d45fcb4 | ||
|
|
0b4974eb1c | ||
|
|
228d22cff0 | ||
|
|
bfb00ecb27 | ||
|
|
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 | ||
|
|
50159d47c2 | ||
|
|
a7e065ddb4 | ||
|
|
d20a7c4996 | ||
|
|
7b9880aaab | ||
|
|
9966387002 |
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
|
||||
4
.github/workflows/apidiff.yml
vendored
4
.github/workflows/apidiff.yml
vendored
@@ -13,7 +13,7 @@ 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
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
with:
|
||||
go-version-file: go.work
|
||||
- name: Execute go-apidiff
|
||||
uses: joelanford/go-apidiff@v0.6.0
|
||||
uses: joelanford/go-apidiff@v0.7.0
|
||||
with:
|
||||
compare-imports: true
|
||||
print-compatible: true
|
||||
|
||||
8
.github/workflows/go.yml
vendored
8
.github/workflows/go.yml
vendored
@@ -15,7 +15,7 @@ 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
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
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
|
||||
with:
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
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
|
||||
with:
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
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
|
||||
with:
|
||||
|
||||
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -13,7 +13,7 @@ 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
|
||||
|
||||
@@ -34,6 +34,7 @@ linters:
|
||||
- golint
|
||||
- maintidx
|
||||
- nosnakecase
|
||||
- testpackage # it's better to keep tests in the same package for now because kustomize does open box testing
|
||||
|
||||
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]
|
||||
|
||||
6
Makefile
6
Makefile
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Makefile for kustomize CLI and API.
|
||||
|
||||
LATEST_RELEASE=v5.1.1
|
||||
LATEST_RELEASE=v5.2.1
|
||||
|
||||
SHELL := /usr/bin/env bash
|
||||
GOOS = $(shell go env GOOS)
|
||||
@@ -145,11 +145,11 @@ 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/*" 19
|
||||
|
||||
.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/*" 19
|
||||
|
||||
.PHONY: test-unit-kustomize-plugins
|
||||
test-unit-kustomize-plugins:
|
||||
|
||||
@@ -15,6 +15,9 @@ aliases:
|
||||
- yuwenma
|
||||
- annasong20
|
||||
- koba1t
|
||||
- stormqueen1990
|
||||
- varshaprasad96
|
||||
- ncapps
|
||||
# emeritus:
|
||||
# - liujingfang1
|
||||
# - Shell32-Natsu
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,11 +7,11 @@ require (
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
github.com/imdario/mergo v0.3.13
|
||||
github.com/stretchr/testify v1.8.1
|
||||
go.uber.org/goleak v1.3.0
|
||||
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
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -31,7 +31,7 @@ require (
|
||||
github.com/sergi/go-diff v1.1.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
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
16
api/go.sum
16
api/go.sum
@@ -61,9 +61,11 @@ 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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
@@ -77,8 +79,6 @@ gopkg.in/evanphx/json-patch.v5 v5.6.0 h1:BMT6KIwBD9CaU91PJCZIe46bDmBWa9ynTQgJIOp
|
||||
gopkg.in/evanphx/json-patch.v5 v5.6.0/go.mod h1:/kvTRh1TVm5wuM6OkHxqXtE/1nUZZpihg29RtuIyfvk=
|
||||
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=
|
||||
@@ -86,7 +86,7 @@ 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=
|
||||
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/kustomize/kyaml v0.16.0 h1:6J33uKSoATlKZH16unr2XOhDI+otoe2sR3M8PDzW3K0=
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0/go.mod h1:xOK/7i+vmE14N2FdFyugIshB8eF6ALpy7jI87Q2nRh4=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -53,6 +53,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 +100,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 +141,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(
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,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,7 +89,11 @@ 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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -15,6 +15,10 @@ import (
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
repoRootDir = "../../"
|
||||
)
|
||||
|
||||
const generateDeploymentDotSh = `#!/bin/sh
|
||||
|
||||
cat <<EOF
|
||||
@@ -513,51 +517,58 @@ func TestFnContainerGenerator(t *testing.T) {
|
||||
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
|
||||
assert.NoError(t, build.Run())
|
||||
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
actual, err := m.AsYaml()
|
||||
assert.NoError(t, err)
|
||||
assert.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))
|
||||
}
|
||||
|
||||
@@ -593,7 +604,7 @@ metadata:
|
||||
"-f", "./cmd/config/internal/commands/e2e/e2econtainerconfig/Dockerfile",
|
||||
"-t", "gcr.io/kustomize-functions/e2econtainerconfig",
|
||||
)
|
||||
build.Dir = "../../" // Repo root
|
||||
build.Dir = repoRootDir
|
||||
assert.NoError(t, build.Run())
|
||||
m := th.Run(tmpDir.String(), o)
|
||||
actual, err := m.AsYaml()
|
||||
@@ -611,6 +622,12 @@ 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",
|
||||
)
|
||||
assert.NoError(t, build.Run())
|
||||
th := kusttest_test.MakeHarness(t)
|
||||
o := th.MakeOptionsPluginsEnabled()
|
||||
fSys := filesys.MakeFsOnDisk()
|
||||
@@ -644,7 +661,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
|
||||
@@ -684,25 +701,31 @@ generators:
|
||||
- gener.yaml
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "gener.yaml"), []byte(`
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
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
|
||||
assert.NoError(t, build.Run())
|
||||
|
||||
m, err := b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
@@ -731,44 +754,36 @@ generators:
|
||||
- gener.yaml
|
||||
`)))
|
||||
assert.NoError(t, fSys.WriteFile(filepath.Join(tmpDir.String(), "gener.yaml"), []byte(`
|
||||
apiVersion: v1alpha1
|
||||
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(`
|
||||
assert.NoError(t, fSys.MkdirAll(filepath.Join(tmpDir.String(), "yaml", "tmp")))
|
||||
assert.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
|
||||
assert.NoError(t, build.Run())
|
||||
|
||||
m, err := b.Run(
|
||||
fSys,
|
||||
tmpDir.String())
|
||||
@@ -780,7 +795,7 @@ kind: Deployment
|
||||
metadata:
|
||||
name: name
|
||||
spec:
|
||||
replicas: 5
|
||||
replicas: 3
|
||||
`, string(actual))
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -822,8 +822,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 +837,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 +860,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,24 +885,26 @@ 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)
|
||||
assert.NoError(t, w.AbsorbAll(makeMap2(t, types.BehaviorMerge)))
|
||||
expected.RemoveBuildAnnotations()
|
||||
w.RemoveBuildAnnotations()
|
||||
assert.NoError(t, expected.ErrorIfNotEqualLists(w))
|
||||
w = makeMap1()
|
||||
w = makeMap1(t)
|
||||
assert.NoError(t, w.AbsorbAll(nil))
|
||||
assert.NoError(t, w.ErrorIfNotEqualLists(makeMap1()))
|
||||
assert.NoError(t, w.ErrorIfNotEqualLists(makeMap1(t)))
|
||||
|
||||
w = makeMap1()
|
||||
w2 := makeMap2(types.BehaviorReplace)
|
||||
w = makeMap1(t)
|
||||
w2 := makeMap2(t, types.BehaviorReplace)
|
||||
assert.NoError(t, w.AbsorbAll(w2))
|
||||
w2.RemoveBuildAnnotations()
|
||||
assert.NoError(t, w2.ErrorIfNotEqualLists(w))
|
||||
w = makeMap1()
|
||||
w2 = makeMap2(types.BehaviorUnspecified)
|
||||
err := w.AbsorbAll(w2)
|
||||
err = makeMap1(t).AbsorbAll(makeMap2(t, types.BehaviorUnspecified))
|
||||
assert.Error(t, err)
|
||||
assert.True(
|
||||
t, strings.Contains(err.Error(), "behavior must be merge or replace"))
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -7,7 +7,7 @@ require (
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/stretchr/testify v1.8.1
|
||||
gopkg.in/inf.v0 v0.9.1
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -28,10 +28,9 @@ require (
|
||||
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
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -64,8 +64,8 @@ github.com/xlab/treeprint v1.2.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd
|
||||
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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
@@ -79,15 +79,13 @@ 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=
|
||||
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/kustomize/kyaml v0.16.0 h1:6J33uKSoATlKZH16unr2XOhDI+otoe2sR3M8PDzW3K0=
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0/go.mod h1:xOK/7i+vmE14N2FdFyugIshB8eF6ALpy7jI87Q2nRh4=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -22,13 +22,12 @@ require (
|
||||
github.com/spf13/cobra v1.7.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
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
|
||||
@@ -58,7 +58,8 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
@@ -67,8 +68,6 @@ google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
|
||||
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=
|
||||
@@ -77,5 +76,5 @@ k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961/go.mod h1:l8HTwL5fqnlns4j
|
||||
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=
|
||||
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/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.20-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,34 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainerenvgenerator
|
||||
|
||||
go 1.20
|
||||
|
||||
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/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/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/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
@@ -0,0 +1,82 @@
|
||||
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/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/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/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/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/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/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 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/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/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 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
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=
|
||||
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=
|
||||
@@ -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.20-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,34 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainer-render-helm-chart
|
||||
|
||||
go 1.20
|
||||
|
||||
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/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/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/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
@@ -0,0 +1,82 @@
|
||||
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/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/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/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/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/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/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 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/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/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 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
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=
|
||||
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=
|
||||
@@ -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.20-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,34 @@
|
||||
module sigs.k8s.io/kustomize/cmd/config/internal/commands/e2e/e2econtainersimplegenerator
|
||||
|
||||
go 1.20
|
||||
|
||||
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/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/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/pflag v1.0.5 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/kyaml => ../../../../../../kyaml
|
||||
@@ -0,0 +1,82 @@
|
||||
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/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/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/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/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/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/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 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/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/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 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
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.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
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=
|
||||
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=
|
||||
@@ -0,0 +1,71 @@
|
||||
// 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"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
Metadata struct {
|
||||
Name string `yaml:"name"`
|
||||
} `yaml:"metadata"`
|
||||
Spec struct {
|
||||
Port int `yaml:"port" json:"port"`
|
||||
} `yaml:"spec" json:"spec"`
|
||||
}
|
||||
|
||||
func generateService(name string, sourcePort int, targetPort int) (*yaml.RNode, error) {
|
||||
serviceName := name + "-svc"
|
||||
svc, err := yaml.Parse(fmt.Sprintf(`apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: %s
|
||||
name: %s
|
||||
spec:
|
||||
selector:
|
||||
app: %s
|
||||
ports:
|
||||
- name: http
|
||||
port: %d
|
||||
protocol: TCP
|
||||
targetPort: %d
|
||||
`, name, serviceName, name, sourcePort, targetPort))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to generate resource: %w", err)
|
||||
}
|
||||
return svc, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
config := new(App)
|
||||
fn := func(items []*yaml.RNode) ([]*yaml.RNode, error) {
|
||||
var newNodes []*yaml.RNode
|
||||
resourceName := config.Metadata.Name
|
||||
for range items {
|
||||
// generate Service
|
||||
service, err := generateService(resourceName, config.Spec.Port, config.Spec.Port)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
newNodes = append(newNodes, service)
|
||||
}
|
||||
items = newNodes
|
||||
|
||||
return items, nil
|
||||
}
|
||||
p := framework.SimpleProcessor{Config: config, Filter: kio.FilterFunc(fn)}
|
||||
cmd := command.Build(p, command.StandaloneDisabled, false)
|
||||
command.AddGenerateDockerfile(cmd)
|
||||
if err := cmd.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -62,5 +62,5 @@ require (
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/kustomize v2.0.3+incompatible // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -759,5 +759,5 @@ sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kF
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -4,7 +4,7 @@ go 1.20
|
||||
|
||||
require (
|
||||
github.com/stretchr/testify v1.8.1
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -13,6 +13,5 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.10.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -2,6 +2,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
|
||||
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/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
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=
|
||||
@@ -27,10 +29,8 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
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=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -5,8 +5,8 @@ go 1.20
|
||||
require (
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/stretchr/testify v1.8.1
|
||||
sigs.k8s.io/kustomize/api v0.14.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0
|
||||
sigs.k8s.io/kustomize/api v0.15.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -27,13 +27,12 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.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
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
replace sigs.k8s.io/kustomize/api => ../../api
|
||||
|
||||
@@ -62,8 +62,9 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
|
||||
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=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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=
|
||||
@@ -73,8 +74,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/evanphx/json-patch.v5 v5.6.0 h1:BMT6KIwBD9CaU91PJCZIe46bDmBWa9ynTQgJIOpfQBk=
|
||||
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=
|
||||
@@ -83,7 +82,7 @@ k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961/go.mod h1:l8HTwL5fqnlns4j
|
||||
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=
|
||||
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/kustomize/kyaml v0.16.0 h1:6J33uKSoATlKZH16unr2XOhDI+otoe2sR3M8PDzW3K0=
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0/go.mod h1:xOK/7i+vmE14N2FdFyugIshB8eF6ALpy7jI87Q2nRh4=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -6,7 +6,7 @@ require (
|
||||
k8s.io/apimachinery v0.27.0
|
||||
sigs.k8s.io/application v0.8.2
|
||||
sigs.k8s.io/kustomize/kyaml v0.13.7
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -29,7 +29,7 @@ require (
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||
github.com/onsi/ginkgo v1.11.0 // indirect
|
||||
github.com/onsi/ginkgo v1.14.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/net v0.17.0 // indirect
|
||||
|
||||
@@ -129,6 +129,7 @@ github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
|
||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
@@ -323,7 +324,6 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
@@ -402,18 +402,23 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
|
||||
github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.4.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw=
|
||||
github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
||||
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
|
||||
github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA=
|
||||
github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.3.0/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
|
||||
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||
@@ -630,6 +635,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/
|
||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
@@ -692,10 +698,12 @@ golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191105231009-c1f44814a5cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -709,6 +717,7 @@ golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -935,7 +944,6 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
|
||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||
@@ -1039,5 +1047,5 @@ sigs.k8s.io/testing_frameworks v0.1.2 h1:vK0+tvjF0BZ/RYFeZ1E6BYBwHJJXhjuZ3TdsEKH
|
||||
sigs.k8s.io/testing_frameworks v0.1.2/go.mod h1:ToQrwSC3s8Xf/lADdZp3Mktcql9CG0UAmdJG9th5i0w=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -46,5 +46,5 @@ require (
|
||||
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
|
||||
sigs.k8s.io/yaml v1.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -203,5 +203,5 @@ sigs.k8s.io/kustomize/kyaml v0.14.1 h1:c8iibius7l24G2wVAGZn/Va2wNys03GXLjYVIcFVx
|
||||
sigs.k8s.io/kustomize/kyaml v0.14.1/go.mod h1:AN1/IpawKilWD7V+YvQwRGUvuUOOWpjsHu6uHwonSF4=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -32,5 +32,5 @@ require (
|
||||
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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -684,5 +684,5 @@ sigs.k8s.io/kustomize/kyaml v0.13.7 h1:/EZ/nPaLUzeJKF/BuJ4QCuMVJWiEVoI8iftOHY3g3
|
||||
sigs.k8s.io/kustomize/kyaml v0.13.7/go.mod h1:6K+IUOuir3Y7nucPRAjw9yth04KSWBnP5pqUTGwj/qU=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -32,5 +32,5 @@ require (
|
||||
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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -684,5 +684,5 @@ sigs.k8s.io/kustomize/kyaml v0.13.7 h1:/EZ/nPaLUzeJKF/BuJ4QCuMVJWiEVoI8iftOHY3g3
|
||||
sigs.k8s.io/kustomize/kyaml v0.13.7/go.mod h1:6K+IUOuir3Y7nucPRAjw9yth04KSWBnP5pqUTGwj/qU=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -35,10 +35,10 @@ require (
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
github.com/xlab/treeprint v1.2.0 // indirect
|
||||
golang.org/x/sys v0.12.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -489,7 +489,8 @@ golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.0.0-20180810153555-6e3c4e7365dd/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -710,5 +711,5 @@ sigs.k8s.io/kustomize/kyaml v0.13.7/go.mod h1:6K+IUOuir3Y7nucPRAjw9yth04KSWBnP5p
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
@@ -25,5 +25,5 @@ require (
|
||||
gopkg.in/yaml.v2 v2.4.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
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
@@ -670,5 +670,5 @@ sigs.k8s.io/kustomize/kyaml v0.13.7 h1:/EZ/nPaLUzeJKF/BuJ4QCuMVJWiEVoI8iftOHY3g3
|
||||
sigs.k8s.io/kustomize/kyaml v0.13.7/go.mod h1:6K+IUOuir3Y7nucPRAjw9yth04KSWBnP5pqUTGwj/qU=
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw=
|
||||
sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
|
||||
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
|
||||
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
|
||||
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
|
||||
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
|
||||
|
||||
3
go.work
3
go.work
@@ -4,6 +4,9 @@ use (
|
||||
./api
|
||||
./cmd/config
|
||||
./cmd/config/internal/commands/e2e/e2econtainerconfig
|
||||
./cmd/config/internal/commands/e2e/e2econtainerenvgenerator
|
||||
./cmd/config/internal/commands/e2e/e2econtainermountbind
|
||||
./cmd/config/internal/commands/e2e/e2econtainersimplegenerator
|
||||
./cmd/depprobcheck
|
||||
./cmd/gorepomod
|
||||
./cmd/k8scopy
|
||||
|
||||
28
go.work.sum
28
go.work.sum
@@ -72,7 +72,6 @@ github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCv
|
||||
github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
|
||||
github.com/flowstack/go-jsonschema v0.1.1 h1:dCrjGJRXIlbDsLAgTJZTjhwUJnnxVWl1OgNyYh5nyDc=
|
||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1 h1:QbL/5oDUmRBzO9/Z7Seo6zf912W/a6Sr4Eu0G/3Jho0=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=
|
||||
@@ -202,19 +201,17 @@ go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
|
||||
go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
|
||||
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE=
|
||||
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6 h1:QE6XYQK6naiK1EPAe1g/ILLxN5RBoH5xkJk3CqlMI/Y=
|
||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b h1:+qEpEAPhDZ1o0x3tHzZTQDArnOixOzGD9HUJfcg0mb4=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028 h1:4+4C/Iv2U4fMZBiMCc98MG1In4gJY5YRhtpDNeDeHWs=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -224,10 +221,18 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
|
||||
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
|
||||
golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
|
||||
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
|
||||
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
gomodules.xyz/jsonpatch/v2 v2.0.1 h1:xyiBuvkD2g5n7cYzx6u2sxQvsAy4QJsZFCzGVdzOXZ0=
|
||||
gonum.org/v1/gonum v0.0.0-20190331200053-3d26580ed485 h1:OB/uP/Puiu5vS5QMRPrXCDWUPb+kt8f1KW8oQzFejQw=
|
||||
@@ -235,7 +240,6 @@ gonum.org/v1/netlib v0.0.0-20190331212654-76723241ea4e h1:jRyg0XfpwWlhEV8mDfdNGB
|
||||
google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w=
|
||||
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 h1:Et6SkiuvnBn+SgrSYXs/BrUpGB4mbdwt4R3vaPIlicA=
|
||||
google.golang.org/grpc v1.40.0 h1:AGJ0Ih4mHjSeibYkFGh1dD9KJ/eOtZ93I6hoHhukQ5Q=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.25 h1:Ev7yu1/f6+d+b3pi5vPdRPc6nNtP1umSfcWiEfRqv6I=
|
||||
gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
|
||||
@@ -250,12 +254,4 @@ k8s.io/code-generator v0.17.0 h1:y+KWtDWNqlJzJu/kUy8goJZO0X71PGIpAHLX8a0JYk0=
|
||||
k8s.io/component-base v0.17.0 h1:BnDFcmBDq+RPpxXjmuYnZXb59XNN9CaFrX8ba9+3xrA=
|
||||
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c h1:GohjlNKauSai7gN4wsJkeZ3WAJx4Sh+oT/b5IYn5suA=
|
||||
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
|
||||
modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ=
|
||||
modernc.org/golex v1.0.0 h1:wWpDlbK8ejRfSyi0frMyhilD3JBvtcx2AdGDnU+JtsE=
|
||||
modernc.org/mathutil v1.0.0 h1:93vKjrJopTPrtTNpZ8XIovER7iCIH1QU7wNbOQXC60I=
|
||||
modernc.org/strutil v1.0.0 h1:XVFtQwFVwc02Wk+0L/Z/zDDXO81r5Lhe6iMKmGX3KhE=
|
||||
modernc.org/xc v1.0.0 h1:7ccXrupWZIS3twbUGrtKmHS2DXY6xegFua+6O3xgAFU=
|
||||
rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=
|
||||
rsc.io/quote/v3 v3.1.0 h1:9JKUTTIUgS6kzR9mK1YuGKv6Nl+DijDNIc0ghT58FaY=
|
||||
rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4=
|
||||
sigs.k8s.io/structured-merge-diff v1.0.1-0.20191108220359-b1b620dd3f06 h1:zD2IemQ4LmOcAumeiyDWXKUI2SO0NYDe3H6QGvPOVgU=
|
||||
|
||||
@@ -15,7 +15,7 @@ fi
|
||||
|
||||
cmd=$1
|
||||
skip_pattern="${2-}"
|
||||
expected_module_count=${3:-45}
|
||||
expected_module_count=${3:-48}
|
||||
|
||||
seen=()
|
||||
# Hack scripts must be run from the root of the repository.
|
||||
@@ -25,11 +25,11 @@ export KUSTOMIZE_ROOT
|
||||
# verify all modules pass validation
|
||||
for i in $(find . -name go.mod -not -path "./site/*" -not -path "$skip_pattern"); do
|
||||
pushd .
|
||||
cd $(dirname $i);
|
||||
cd $(dirname "$i");
|
||||
|
||||
set +x
|
||||
dir=$(pwd)
|
||||
module="${dir#$KUSTOMIZE_ROOT}"
|
||||
module="${dir#"$KUSTOMIZE_ROOT"}"
|
||||
echo -e "\n----------------------------------------------------------"
|
||||
echo "Running command in $module"
|
||||
echo -e "----------------------------------------------------------"
|
||||
|
||||
@@ -27,10 +27,12 @@ var theFlags struct {
|
||||
managedByLabel bool
|
||||
helm bool
|
||||
}
|
||||
helmCommand string
|
||||
loadRestrictor string
|
||||
reorderOutput string
|
||||
fnOptions types.FnPluginLoadingOptions
|
||||
helmCommand string
|
||||
helmApiVersions []string
|
||||
helmKubeVersion string
|
||||
loadRestrictor string
|
||||
reorderOutput string
|
||||
fnOptions types.FnPluginLoadingOptions
|
||||
}
|
||||
|
||||
type Help struct {
|
||||
@@ -153,6 +155,8 @@ func HonorKustomizeFlags(kOpts *krusty.Options, flags *flag.FlagSet) *krusty.Opt
|
||||
kOpts.PluginConfig.HelmConfig.Enabled = theFlags.enable.helm
|
||||
}
|
||||
kOpts.PluginConfig.HelmConfig.Command = theFlags.helmCommand
|
||||
kOpts.PluginConfig.HelmConfig.ApiVersions = theFlags.helmApiVersions
|
||||
kOpts.PluginConfig.HelmConfig.KubeVersion = theFlags.helmKubeVersion
|
||||
kOpts.AddManagedbyLabel = isManagedByLabelEnabled()
|
||||
return kOpts
|
||||
}
|
||||
|
||||
@@ -21,4 +21,14 @@ func AddFlagEnableHelm(set *pflag.FlagSet) {
|
||||
"helm-command",
|
||||
"helm", // default
|
||||
"helm command (path to executable)")
|
||||
set.StringArrayVar(
|
||||
&theFlags.helmApiVersions,
|
||||
"helm-api-versions",
|
||||
[]string{}, // default
|
||||
"Kubernetes api versions used by Helm for Capabilities.APIVersions")
|
||||
set.StringVar(
|
||||
&theFlags.helmKubeVersion,
|
||||
"helm-kube-version",
|
||||
"", // default
|
||||
"Kubernetes version used by Helm for Capabilities.KubeVersion")
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
@@ -20,7 +21,7 @@ func newCmdAddConfigMap(
|
||||
ldr ifc.KvLoader,
|
||||
rf *resource.Factory,
|
||||
) *cobra.Command {
|
||||
var flags configmapSecretFlagsAndArgs
|
||||
var flags util.ConfigMapSecretFlagsAndArgs
|
||||
cmd := &cobra.Command{
|
||||
Use: "configmap NAME [--namespace=namespace-name] [--behavior={create|merge|replace}] [--from-file=[key=]source] [--from-literal=key1=value1]",
|
||||
Short: "Adds a configmap to the kustomization file",
|
||||
@@ -48,36 +49,36 @@ func newCmdAddConfigMap(
|
||||
|
||||
cmd.Flags().StringSliceVar(
|
||||
&flags.FileSources,
|
||||
fromFileFlag,
|
||||
util.FromFileFlag,
|
||||
[]string{},
|
||||
"Key file can be specified using its file path, in which case file basename will be used as configmap "+
|
||||
"key, or optionally with a key and file path, in which case the given key will be used. Specifying a "+
|
||||
"directory will iterate each named file in the directory whose basename is a valid configmap key.")
|
||||
cmd.Flags().StringArrayVar(
|
||||
&flags.LiteralSources,
|
||||
fromLiteralFlag,
|
||||
util.FromLiteralFlag,
|
||||
[]string{},
|
||||
"Specify a key and literal value to insert in configmap (i.e. mykey=somevalue)")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.EnvFileSource,
|
||||
fromEnvFileFlag,
|
||||
util.FromEnvFileFlag,
|
||||
"",
|
||||
"Specify the path to a file to read lines of key=val pairs to create a configmap (i.e. a Docker .env file).")
|
||||
cmd.Flags().BoolVar(
|
||||
&flags.DisableNameSuffixHash,
|
||||
disableNameSuffixHashFlag,
|
||||
util.DisableNameSuffixHashFlag,
|
||||
false,
|
||||
"Disable the name suffix for the configmap")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.Behavior,
|
||||
behaviorFlag,
|
||||
util.BehaviorFlag,
|
||||
"",
|
||||
"Specify the behavior for config map generation, i.e whether to create a new configmap (the default), "+
|
||||
"to merge with a previously defined one, or to replace an existing one. Merge and replace should be used only "+
|
||||
" when overriding an existing configmap defined in a base")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.Namespace,
|
||||
namespaceFlag,
|
||||
util.NamespaceFlag,
|
||||
"",
|
||||
"Specify the namespace of the ConfigMap")
|
||||
|
||||
@@ -85,7 +86,7 @@ func newCmdAddConfigMap(
|
||||
}
|
||||
|
||||
func runEditAddConfigMap(
|
||||
flags configmapSecretFlagsAndArgs,
|
||||
flags util.ConfigMapSecretFlagsAndArgs,
|
||||
fSys filesys.FileSystem,
|
||||
args []string,
|
||||
ldr ifc.KvLoader,
|
||||
@@ -96,7 +97,7 @@ func runEditAddConfigMap(
|
||||
return fmt.Errorf("failed to expand file source: %w", err)
|
||||
}
|
||||
|
||||
err = flags.Validate(args)
|
||||
err = flags.ValidateAdd(args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to validate flags: %w", err)
|
||||
}
|
||||
@@ -133,11 +134,11 @@ func runEditAddConfigMap(
|
||||
func addConfigMap(
|
||||
ldr ifc.KvLoader,
|
||||
k *types.Kustomization,
|
||||
flags configmapSecretFlagsAndArgs,
|
||||
flags util.ConfigMapSecretFlagsAndArgs,
|
||||
rf *resource.Factory,
|
||||
) error {
|
||||
args := findOrMakeConfigMapArgs(k, flags.Name, flags.Namespace)
|
||||
mergeFlagsIntoGeneratorArgs(&args.GeneratorArgs, flags)
|
||||
util.MergeFlagsIntoGeneratorArgs(&args.GeneratorArgs, flags)
|
||||
// Validate by trying to create corev1.configmap.
|
||||
args.Options = types.MergeGlobalOptionsIntoLocal(
|
||||
args.Options, k.GeneratorOptions)
|
||||
@@ -147,7 +148,7 @@ func addConfigMap(
|
||||
|
||||
func findOrMakeConfigMapArgs(m *types.Kustomization, name, namespace string) *types.ConfigMapArgs {
|
||||
for i, v := range m.ConfigMapGenerator {
|
||||
if name == v.Name && namespace == v.Namespace {
|
||||
if name == v.Name && util.NamespaceEqual(v.Namespace, namespace) {
|
||||
return &m.ConfigMapGenerator[i]
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
@@ -25,7 +26,7 @@ const (
|
||||
|
||||
func TestNewAddConfigMapIsNotNil(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
assert.NotNil(t, newCmdAddConfigMap(
|
||||
require.NotNil(t, newCmdAddConfigMap(
|
||||
fSys,
|
||||
kv.NewLoader(
|
||||
loader.NewFileLoaderAtCwd(fSys),
|
||||
@@ -40,26 +41,25 @@ func TestMakeConfigMapArgs(t *testing.T) {
|
||||
NamePrefix: "test-name-prefix",
|
||||
}
|
||||
|
||||
if len(kustomization.ConfigMapGenerator) != 0 {
|
||||
t.Fatal("Initial kustomization should not have any configmaps")
|
||||
}
|
||||
require.Len(t, kustomization.ConfigMapGenerator, 0, "Initial kustomization should not have any configmaps")
|
||||
|
||||
args := findOrMakeConfigMapArgs(kustomization, cmName, configMapNamespace)
|
||||
assert.NotNil(t, args)
|
||||
assert.Equal(t, 1, len(kustomization.ConfigMapGenerator))
|
||||
assert.Equal(t, &kustomization.ConfigMapGenerator[len(kustomization.ConfigMapGenerator)-1], args)
|
||||
assert.Equal(t, args, findOrMakeConfigMapArgs(kustomization, cmName, configMapNamespace))
|
||||
assert.Equal(t, 1, len(kustomization.ConfigMapGenerator))
|
||||
require.NotNil(t, args)
|
||||
require.Equal(t, 1, len(kustomization.ConfigMapGenerator))
|
||||
require.Equal(t, &kustomization.ConfigMapGenerator[len(kustomization.ConfigMapGenerator)-1], args)
|
||||
require.Equal(t, args, findOrMakeConfigMapArgs(kustomization, cmName, configMapNamespace))
|
||||
require.Equal(t, 1, len(kustomization.ConfigMapGenerator))
|
||||
}
|
||||
|
||||
func TestMergeFlagsIntoConfigMapArgs_LiteralSources(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeConfigMapArgs(k, "foo", configMapNamespace)
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{LiteralSources: []string{"k1=v1"}})
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.ConfigMapSecretFlagsAndArgs{LiteralSources: []string{"k1=v1"}})
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{LiteralSources: []string{"k2=v2"}})
|
||||
util.ConfigMapSecretFlagsAndArgs{LiteralSources: []string{"k2=v2"}})
|
||||
assert.Equal(t, "k1=v1", k.ConfigMapGenerator[0].LiteralSources[0])
|
||||
assert.Equal(t, "k2=v2", k.ConfigMapGenerator[0].LiteralSources[1])
|
||||
}
|
||||
@@ -67,12 +67,12 @@ func TestMergeFlagsIntoConfigMapArgs_LiteralSources(t *testing.T) {
|
||||
func TestMergeFlagsIntoConfigMapArgs_FileSources(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeConfigMapArgs(k, "foo", configMapNamespace)
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{FileSources: []string{"file1"}})
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.ConfigMapSecretFlagsAndArgs{FileSources: []string{"file1"}})
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{FileSources: []string{"file2"}})
|
||||
util.ConfigMapSecretFlagsAndArgs{FileSources: []string{"file2"}})
|
||||
assert.Equal(t, "file1", k.ConfigMapGenerator[0].FileSources[0])
|
||||
assert.Equal(t, "file2", k.ConfigMapGenerator[0].FileSources[1])
|
||||
}
|
||||
@@ -80,12 +80,12 @@ func TestMergeFlagsIntoConfigMapArgs_FileSources(t *testing.T) {
|
||||
func TestMergeFlagsIntoConfigMapArgs_EnvSource(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeConfigMapArgs(k, "foo", configMapNamespace)
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{EnvFileSource: "env1"})
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.ConfigMapSecretFlagsAndArgs{EnvFileSource: "env1"})
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{EnvFileSource: "env2"})
|
||||
util.ConfigMapSecretFlagsAndArgs{EnvFileSource: "env2"})
|
||||
assert.Equal(t, "env1", k.ConfigMapGenerator[0].EnvSources[0])
|
||||
assert.Equal(t, "env2", k.ConfigMapGenerator[0].EnvSources[1])
|
||||
}
|
||||
@@ -94,31 +94,31 @@ func TestMergeFlagsIntoConfigMapArgs_Behavior(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeConfigMapArgs(k, "foo", configMapNamespace)
|
||||
|
||||
createBehaviorFlags := configmapSecretFlagsAndArgs{
|
||||
createBehaviorFlags := util.ConfigMapSecretFlagsAndArgs{
|
||||
Behavior: "create",
|
||||
EnvFileSource: "env1",
|
||||
}
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
createBehaviorFlags)
|
||||
require.Equal(t, configMapNamespace, k.ConfigMapGenerator[0].Namespace)
|
||||
assert.Equal(t, "create", k.ConfigMapGenerator[0].Behavior)
|
||||
|
||||
mergeBehaviorFlags := configmapSecretFlagsAndArgs{
|
||||
mergeBehaviorFlags := util.ConfigMapSecretFlagsAndArgs{
|
||||
Behavior: "merge",
|
||||
EnvFileSource: "env1",
|
||||
}
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
mergeBehaviorFlags)
|
||||
require.Equal(t, configMapNamespace, k.ConfigMapGenerator[0].Namespace)
|
||||
assert.Equal(t, "merge", k.ConfigMapGenerator[0].Behavior)
|
||||
|
||||
replaceBehaviorFlags := configmapSecretFlagsAndArgs{
|
||||
replaceBehaviorFlags := util.ConfigMapSecretFlagsAndArgs{
|
||||
Behavior: "replace",
|
||||
EnvFileSource: "env1",
|
||||
}
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
replaceBehaviorFlags)
|
||||
require.Equal(t, configMapNamespace, k.ConfigMapGenerator[0].Namespace)
|
||||
@@ -162,8 +162,8 @@ func TestEditAddConfigMapWithLiteralSource(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
tc.configMapName,
|
||||
fmt.Sprintf(flagFormat, fromLiteralFlag, tc.literalSource),
|
||||
fmt.Sprintf(flagFormat, namespaceFlag, tc.configMapNamespace),
|
||||
fmt.Sprintf(util.FlagFormat, util.FromLiteralFlag, tc.literalSource),
|
||||
fmt.Sprintf(util.FlagFormat, util.NamespaceFlag, tc.configMapNamespace),
|
||||
}
|
||||
cmd := newCmdAddConfigMap(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
@@ -243,8 +243,8 @@ func TestEditAddConfigMapWithEnvSource(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
tc.configMapName,
|
||||
fmt.Sprintf(flagFormat, fromEnvFileFlag, tc.envSource),
|
||||
fmt.Sprintf(flagFormat, namespaceFlag, tc.configMapNamespace),
|
||||
fmt.Sprintf(util.FlagFormat, util.FromEnvFileFlag, tc.envSource),
|
||||
fmt.Sprintf(util.FlagFormat, util.NamespaceFlag, tc.configMapNamespace),
|
||||
}
|
||||
cmd := newCmdAddConfigMap(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
@@ -323,8 +323,8 @@ func TestEditAddConfigMapWithFileSource(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
tc.configMapName,
|
||||
fmt.Sprintf(flagFormat, fromFileFlag, tc.fileSource),
|
||||
fmt.Sprintf(flagFormat, namespaceFlag, tc.configMapNamespace),
|
||||
fmt.Sprintf(util.FlagFormat, util.FromFileFlag, tc.fileSource),
|
||||
fmt.Sprintf(util.FlagFormat, util.NamespaceFlag, tc.configMapNamespace),
|
||||
}
|
||||
cmd := newCmdAddConfigMap(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
@@ -351,3 +351,143 @@ func TestEditAddConfigMapWithFileSource(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestEditAddConfigMapNamespaced tests situations regarding namespacing. For example, it
|
||||
// verifies that the empty namespace and the default namespace are treated the
|
||||
// same when adding a configmap to a kustomization file.
|
||||
func TestEditAddConfigMapNamespaced(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
configMapName string
|
||||
configMapNamespace string
|
||||
literalSources []string
|
||||
initialArgs string
|
||||
expectedResult []types.ConfigMapArgs
|
||||
expectedSliceLength int
|
||||
}{
|
||||
{
|
||||
name: "adds new key to configmap when default namespace matches empty",
|
||||
configMapName: "test-cm",
|
||||
configMapNamespace: "default",
|
||||
literalSources: []string{"key1=value1"},
|
||||
initialArgs: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- key=value
|
||||
name: test-cm
|
||||
`,
|
||||
expectedResult: []types.ConfigMapArgs{
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "",
|
||||
Name: "test-cm",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key=value", "key1=value1"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedSliceLength: 1,
|
||||
},
|
||||
{
|
||||
name: "adds new key to configmap when empty namespace matches default",
|
||||
configMapName: "test-cm",
|
||||
configMapNamespace: "",
|
||||
literalSources: []string{"key1=value1"},
|
||||
initialArgs: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- key=value
|
||||
name: test-cm
|
||||
namespace: default
|
||||
`,
|
||||
expectedResult: []types.ConfigMapArgs{
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "default",
|
||||
Name: "test-cm",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key=value", "key1=value1"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedSliceLength: 1,
|
||||
},
|
||||
{
|
||||
name: "creates a new generator when namespaces don't match",
|
||||
configMapName: "test-cm",
|
||||
configMapNamespace: "",
|
||||
literalSources: []string{"key1=value1"},
|
||||
initialArgs: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- key=value
|
||||
name: test-cm
|
||||
namespace: ns1
|
||||
`,
|
||||
expectedResult: []types.ConfigMapArgs{
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "ns1",
|
||||
Name: "test-cm",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key=value"},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "",
|
||||
Name: "test-cm",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key1=value1"},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
expectedSliceLength: 2,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
fSys := filesys.MakeEmptyDirInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, []byte(tc.initialArgs))
|
||||
|
||||
pvd := provider.NewDefaultDepProvider()
|
||||
ldr := kv.NewLoader(loader.NewFileLoaderAtCwd(fSys), pvd.GetFieldValidator())
|
||||
|
||||
args := []string{
|
||||
tc.configMapName,
|
||||
fmt.Sprintf(util.FlagFormat, util.NamespaceFlag, tc.configMapNamespace),
|
||||
}
|
||||
|
||||
for _, source := range tc.literalSources {
|
||||
args = append(args, fmt.Sprintf(util.FlagFormat, util.FromLiteralFlag, source))
|
||||
}
|
||||
|
||||
cmd := newCmdAddConfigMap(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
require.NoError(t, cmd.Execute())
|
||||
|
||||
_, err := testutils_test.ReadTestKustomization(fSys)
|
||||
require.NoError(t, err)
|
||||
|
||||
mf, err := kustfile.NewKustomizationFile(fSys)
|
||||
require.NoError(t, err)
|
||||
|
||||
kustomization, err := mf.Read()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Len(t, kustomization.ConfigMapGenerator, tc.expectedSliceLength)
|
||||
require.ElementsMatch(t, tc.expectedResult, kustomization.ConfigMapGenerator)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
@@ -20,7 +21,7 @@ func newCmdAddSecret(
|
||||
ldr ifc.KvLoader,
|
||||
rf *resource.Factory,
|
||||
) *cobra.Command {
|
||||
var flags configmapSecretFlagsAndArgs
|
||||
var flags util.ConfigMapSecretFlagsAndArgs
|
||||
cmd := &cobra.Command{
|
||||
Use: "secret NAME [--from-file=[key=]source] [--from-literal=key1=value1] [--type=Opaque|kubernetes.io/tls]",
|
||||
Short: "Adds a secret to the kustomization file.",
|
||||
@@ -42,19 +43,19 @@ func newCmdAddSecret(
|
||||
|
||||
cmd.Flags().StringSliceVar(
|
||||
&flags.FileSources,
|
||||
fromFileFlag,
|
||||
util.FromFileFlag,
|
||||
[]string{},
|
||||
"Key file can be specified using its file path, in which case file basename will be used as secret "+
|
||||
"key, or optionally with a key and file path, in which case the given key will be used. Specifying a "+
|
||||
"directory will iterate each named file in the directory whose basename is a valid secret key.")
|
||||
cmd.Flags().StringArrayVar(
|
||||
&flags.LiteralSources,
|
||||
fromLiteralFlag,
|
||||
util.FromLiteralFlag,
|
||||
[]string{},
|
||||
"Specify a key and literal value to insert in secret (i.e. mykey=somevalue)")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.EnvFileSource,
|
||||
fromEnvFileFlag,
|
||||
util.FromEnvFileFlag,
|
||||
"",
|
||||
"Specify the path to a file to read lines of key=val pairs to create a secret (i.e. a Docker .env file).")
|
||||
cmd.Flags().StringVar(
|
||||
@@ -64,12 +65,12 @@ func newCmdAddSecret(
|
||||
"Specify the secret type this can be 'Opaque' (default), or 'kubernetes.io/tls'")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.Namespace,
|
||||
namespaceFlag,
|
||||
util.NamespaceFlag,
|
||||
"",
|
||||
"Specify the namespace of the secret")
|
||||
cmd.Flags().BoolVar(
|
||||
&flags.DisableNameSuffixHash,
|
||||
disableNameSuffixHashFlag,
|
||||
util.DisableNameSuffixHashFlag,
|
||||
false,
|
||||
"Disable the name suffix for the secret")
|
||||
|
||||
@@ -77,7 +78,7 @@ func newCmdAddSecret(
|
||||
}
|
||||
|
||||
func runEditAddSecret(
|
||||
flags configmapSecretFlagsAndArgs,
|
||||
flags util.ConfigMapSecretFlagsAndArgs,
|
||||
fSys filesys.FileSystem,
|
||||
args []string,
|
||||
ldr ifc.KvLoader,
|
||||
@@ -88,7 +89,7 @@ func runEditAddSecret(
|
||||
return fmt.Errorf("failed to expand file source: %w", err)
|
||||
}
|
||||
|
||||
err = flags.Validate(args)
|
||||
err = flags.ValidateAdd(args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to validate flags: %w", err)
|
||||
}
|
||||
@@ -125,11 +126,11 @@ func runEditAddSecret(
|
||||
func addSecret(
|
||||
ldr ifc.KvLoader,
|
||||
k *types.Kustomization,
|
||||
flags configmapSecretFlagsAndArgs,
|
||||
flags util.ConfigMapSecretFlagsAndArgs,
|
||||
rf *resource.Factory,
|
||||
) error {
|
||||
args := findOrMakeSecretArgs(k, flags.Name, flags.Namespace, flags.Type)
|
||||
mergeFlagsIntoGeneratorArgs(&args.GeneratorArgs, flags)
|
||||
util.MergeFlagsIntoGeneratorArgs(&args.GeneratorArgs, flags)
|
||||
// Validate by trying to create corev1.secret.
|
||||
args.Options = types.MergeGlobalOptionsIntoLocal(
|
||||
args.Options, k.GeneratorOptions)
|
||||
@@ -139,7 +140,7 @@ func addSecret(
|
||||
|
||||
func findOrMakeSecretArgs(m *types.Kustomization, name, namespace, secretType string) *types.SecretArgs {
|
||||
for i, v := range m.SecretGenerator {
|
||||
if name == v.Name && namespace == v.Namespace {
|
||||
if name == v.Name && util.NamespaceEqual(v.Namespace, namespace) {
|
||||
return &m.SecretGenerator[i]
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/kv"
|
||||
"sigs.k8s.io/kustomize/api/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
@@ -51,12 +53,12 @@ func TestMakeSecretArgs(t *testing.T) {
|
||||
func TestMergeFlagsIntoSecretArgs_LiteralSources(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeSecretArgs(k, "foo", "bar", "forbidden")
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{LiteralSources: []string{"k1=v1"}})
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.ConfigMapSecretFlagsAndArgs{LiteralSources: []string{"k1=v1"}})
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{LiteralSources: []string{"k2=v2"}})
|
||||
util.ConfigMapSecretFlagsAndArgs{LiteralSources: []string{"k2=v2"}})
|
||||
assert.Equal(t, "k1=v1", k.SecretGenerator[0].LiteralSources[0])
|
||||
assert.Equal(t, "k2=v2", k.SecretGenerator[0].LiteralSources[1])
|
||||
}
|
||||
@@ -64,12 +66,12 @@ func TestMergeFlagsIntoSecretArgs_LiteralSources(t *testing.T) {
|
||||
func TestMergeFlagsIntoSecretArgs_FileSources(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeSecretArgs(k, "foo", "bar", "forbidden")
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{FileSources: []string{"file1"}})
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.ConfigMapSecretFlagsAndArgs{FileSources: []string{"file1"}})
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{FileSources: []string{"file2"}})
|
||||
util.ConfigMapSecretFlagsAndArgs{FileSources: []string{"file2"}})
|
||||
assert.Equal(t, "file1", k.SecretGenerator[0].FileSources[0])
|
||||
assert.Equal(t, "file2", k.SecretGenerator[0].FileSources[1])
|
||||
}
|
||||
@@ -77,12 +79,12 @@ func TestMergeFlagsIntoSecretArgs_FileSources(t *testing.T) {
|
||||
func TestMergeFlagsIntoSecretArgs_EnvSource(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeSecretArgs(k, "foo", "bar", "forbidden")
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{EnvFileSource: "env1"})
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.ConfigMapSecretFlagsAndArgs{EnvFileSource: "env1"})
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{EnvFileSource: "env2"})
|
||||
util.ConfigMapSecretFlagsAndArgs{EnvFileSource: "env2"})
|
||||
assert.Equal(t, "env1", k.SecretGenerator[0].EnvSources[0])
|
||||
assert.Equal(t, "env2", k.SecretGenerator[0].EnvSources[1])
|
||||
}
|
||||
@@ -90,9 +92,9 @@ func TestMergeFlagsIntoSecretArgs_EnvSource(t *testing.T) {
|
||||
func TestMergeFlagsIntoSecretArgs_DisableNameSuffixHash(t *testing.T) {
|
||||
k := &types.Kustomization{}
|
||||
args := findOrMakeSecretArgs(k, "foo", "bar", "forbidden")
|
||||
mergeFlagsIntoGeneratorArgs(
|
||||
util.MergeFlagsIntoGeneratorArgs(
|
||||
&args.GeneratorArgs,
|
||||
configmapSecretFlagsAndArgs{DisableNameSuffixHash: true})
|
||||
util.ConfigMapSecretFlagsAndArgs{DisableNameSuffixHash: true})
|
||||
assert.True(t, k.SecretGenerator[0].Options.DisableNameSuffixHash)
|
||||
}
|
||||
|
||||
@@ -112,7 +114,7 @@ func TestEditAddSecretWithLiteralSource(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
secretName,
|
||||
fmt.Sprintf(flagFormat, fromLiteralFlag, literalSource),
|
||||
fmt.Sprintf(util.FlagFormat, util.FromLiteralFlag, literalSource),
|
||||
}
|
||||
cmd := newCmdAddSecret(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
@@ -162,7 +164,7 @@ func TestEditAddSecretWithEnvSource(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
secretName,
|
||||
fmt.Sprintf(flagFormat, fromEnvFileFlag, envSource),
|
||||
fmt.Sprintf(util.FlagFormat, util.FromEnvFileFlag, envSource),
|
||||
}
|
||||
cmd := newCmdAddSecret(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
@@ -212,7 +214,7 @@ func TestEditAddSecretWithFileSource(t *testing.T) {
|
||||
|
||||
args := []string{
|
||||
secretName,
|
||||
fmt.Sprintf(flagFormat, fromFileFlag, fileSource),
|
||||
fmt.Sprintf(util.FlagFormat, util.FromFileFlag, fileSource),
|
||||
}
|
||||
cmd := newCmdAddSecret(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
@@ -236,3 +238,150 @@ func TestEditAddSecretWithFileSource(t *testing.T) {
|
||||
require.Equal(t, secretName, newSecretGenerator.Name)
|
||||
require.Contains(t, newSecretGenerator.FileSources, fileSource)
|
||||
}
|
||||
|
||||
// TestEditAddSecretNamespaced tests situations regarding namespacing. For example, it
|
||||
// verifies that the empty namespace and the default namespace are treated the
|
||||
// same when adding a configmap to a kustomization file.
|
||||
func TestEditAddSecretNamespaced(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
secretName string
|
||||
secretNamespace string
|
||||
literalSources []string
|
||||
initialArgs string
|
||||
expectedResult []types.SecretArgs
|
||||
expectedSliceLength int
|
||||
}{
|
||||
{
|
||||
name: "adds new key to secret when default namespace matches empty",
|
||||
secretName: "test-secret",
|
||||
secretNamespace: "default",
|
||||
literalSources: []string{"key1=value1"},
|
||||
initialArgs: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- literals:
|
||||
- key=value
|
||||
name: test-secret
|
||||
type: Opaque
|
||||
`,
|
||||
expectedResult: []types.SecretArgs{
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "",
|
||||
Name: "test-secret",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key=value", "key1=value1"},
|
||||
},
|
||||
},
|
||||
Type: ifc.SecretTypeOpaque,
|
||||
},
|
||||
},
|
||||
expectedSliceLength: 1,
|
||||
},
|
||||
{
|
||||
name: "adds new key to secret when empty namespace matches default",
|
||||
secretName: "test-secret",
|
||||
secretNamespace: "",
|
||||
literalSources: []string{"key1=value1"},
|
||||
initialArgs: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- literals:
|
||||
- key=value
|
||||
name: test-secret
|
||||
namespace: default
|
||||
type: Opaque
|
||||
`,
|
||||
expectedResult: []types.SecretArgs{
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "default",
|
||||
Name: "test-secret",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key=value", "key1=value1"},
|
||||
},
|
||||
},
|
||||
Type: ifc.SecretTypeOpaque,
|
||||
},
|
||||
},
|
||||
expectedSliceLength: 1,
|
||||
},
|
||||
{
|
||||
name: "creates a new generator when namespaces don't match",
|
||||
secretName: "test-secret",
|
||||
secretNamespace: "",
|
||||
literalSources: []string{"key1=value1"},
|
||||
initialArgs: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- literals:
|
||||
- key=value
|
||||
name: test-secret
|
||||
namespace: ns1
|
||||
type: Opaque
|
||||
`,
|
||||
expectedResult: []types.SecretArgs{
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "ns1",
|
||||
Name: "test-secret",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key=value"},
|
||||
},
|
||||
},
|
||||
Type: ifc.SecretTypeOpaque,
|
||||
},
|
||||
{
|
||||
GeneratorArgs: types.GeneratorArgs{
|
||||
Namespace: "",
|
||||
Name: "test-secret",
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key1=value1"},
|
||||
},
|
||||
},
|
||||
Type: ifc.SecretTypeOpaque,
|
||||
},
|
||||
},
|
||||
expectedSliceLength: 2,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
fSys := filesys.MakeEmptyDirInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, []byte(tc.initialArgs))
|
||||
|
||||
pvd := provider.NewDefaultDepProvider()
|
||||
ldr := kv.NewLoader(loader.NewFileLoaderAtCwd(fSys), pvd.GetFieldValidator())
|
||||
|
||||
args := []string{
|
||||
tc.secretName,
|
||||
fmt.Sprintf(util.FlagFormat, util.NamespaceFlag, tc.secretNamespace),
|
||||
}
|
||||
|
||||
for _, source := range tc.literalSources {
|
||||
args = append(args, fmt.Sprintf(util.FlagFormat, util.FromLiteralFlag, source))
|
||||
}
|
||||
|
||||
cmd := newCmdAddSecret(fSys, ldr, pvd.GetResourceFactory())
|
||||
cmd.SetArgs(args)
|
||||
require.NoError(t, cmd.Execute())
|
||||
|
||||
_, err := testutils_test.ReadTestKustomization(fSys)
|
||||
require.NoError(t, err)
|
||||
|
||||
mf, err := kustfile.NewKustomizationFile(fSys)
|
||||
require.NoError(t, err)
|
||||
|
||||
kustomization, err := mf.Read()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Len(t, kustomization.SecretGenerator, tc.expectedSliceLength)
|
||||
require.ElementsMatch(t, tc.expectedResult, kustomization.SecretGenerator)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package add
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
fromFileFlag = "from-file"
|
||||
fromLiteralFlag = "from-literal"
|
||||
fromEnvFileFlag = "from-env-file"
|
||||
disableNameSuffixHashFlag = "disableNameSuffixHash"
|
||||
behaviorFlag = "behavior"
|
||||
namespaceFlag = "namespace"
|
||||
flagFormat = "--%s=%s"
|
||||
)
|
||||
|
||||
// configmapSecretFlagsAndArgs encapsulates the options for add secret/configmap commands.
|
||||
type configmapSecretFlagsAndArgs struct {
|
||||
// Name of configMap/Secret (required)
|
||||
Name string
|
||||
// FileSources to derive the configMap/Secret from (optional)
|
||||
FileSources []string
|
||||
// LiteralSources to derive the configMap/Secret from (optional)
|
||||
LiteralSources []string
|
||||
// EnvFileSource to derive the configMap/Secret from (optional)
|
||||
// TODO: Rationalize this name with Generic.EnvSource
|
||||
EnvFileSource string
|
||||
// Resource generation behavior (optional)
|
||||
Behavior string
|
||||
// Type of secret to create
|
||||
Type string
|
||||
// Namespace of secret
|
||||
Namespace string
|
||||
// Disable name suffix
|
||||
DisableNameSuffixHash bool
|
||||
}
|
||||
|
||||
// Validate validates required fields are set to support structured generation.
|
||||
func (a *configmapSecretFlagsAndArgs) Validate(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("name must be specified once")
|
||||
}
|
||||
a.Name = args[0]
|
||||
if len(a.EnvFileSource) == 0 && len(a.FileSources) == 0 && len(a.LiteralSources) == 0 {
|
||||
return fmt.Errorf("at least from-env-file, or from-file or from-literal must be set")
|
||||
}
|
||||
if len(a.EnvFileSource) > 0 && (len(a.FileSources) > 0 || len(a.LiteralSources) > 0) {
|
||||
return fmt.Errorf("from-env-file cannot be combined with from-file or from-literal")
|
||||
}
|
||||
if len(a.Behavior) > 0 && types.NewGenerationBehavior(a.Behavior) == types.BehaviorUnspecified {
|
||||
return fmt.Errorf(`invalid behavior: must be one of "%s", "%s", or "%s"`,
|
||||
types.BehaviorCreate, types.BehaviorMerge, types.BehaviorReplace)
|
||||
}
|
||||
// TODO: Should we check if the path exists? if it's valid, if it's within the same (sub-)directory?
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExpandFileSource normalizes a string list, possibly
|
||||
// containing globs, into a validated, globless list.
|
||||
// For example, this list:
|
||||
// some/path
|
||||
// some/dir/a*
|
||||
// bfile=some/dir/b*
|
||||
// becomes:
|
||||
// some/path
|
||||
// some/dir/airplane
|
||||
// some/dir/ant
|
||||
// some/dir/apple
|
||||
// bfile=some/dir/banana
|
||||
// i.e. everything is converted to a key=value pair,
|
||||
// where the value is always a relative file path,
|
||||
// and the key, if missing, is the same as the value.
|
||||
// In the case where the key is explicitly declared,
|
||||
// the globbing, if present, must have exactly one match.
|
||||
func (a *configmapSecretFlagsAndArgs) ExpandFileSource(fSys filesys.FileSystem) error {
|
||||
var results []string
|
||||
for _, pattern := range a.FileSources {
|
||||
var patterns []string
|
||||
key := ""
|
||||
// check if the pattern is in `--from-file=[key=]source` format
|
||||
// and if so split it to send only the file-pattern to glob function
|
||||
s := strings.Split(pattern, "=")
|
||||
if len(s) == 2 {
|
||||
patterns = append(patterns, s[1])
|
||||
key = s[0]
|
||||
} else {
|
||||
patterns = append(patterns, s[0])
|
||||
}
|
||||
result, err := util.GlobPatterns(fSys, patterns)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if the format is `--from-file=[key=]source` accept only one result
|
||||
// and extend it with the `key=` prefix
|
||||
if key != "" {
|
||||
if len(result) != 1 {
|
||||
return fmt.Errorf(
|
||||
"'pattern '%s' catches files %v, should catch only one", pattern, result)
|
||||
}
|
||||
fileSource := fmt.Sprintf("%s=%s", key, result[0])
|
||||
results = append(results, fileSource)
|
||||
} else {
|
||||
results = append(results, result...)
|
||||
}
|
||||
}
|
||||
a.FileSources = results
|
||||
return nil
|
||||
}
|
||||
|
||||
func mergeFlagsIntoGeneratorArgs(args *types.GeneratorArgs, flags configmapSecretFlagsAndArgs) {
|
||||
if len(flags.LiteralSources) > 0 {
|
||||
args.LiteralSources = append(
|
||||
args.LiteralSources, flags.LiteralSources...)
|
||||
}
|
||||
if len(flags.FileSources) > 0 {
|
||||
args.FileSources = append(
|
||||
args.FileSources, flags.FileSources...)
|
||||
}
|
||||
if flags.EnvFileSource != "" {
|
||||
args.EnvSources = append(
|
||||
args.EnvSources, flags.EnvFileSource)
|
||||
}
|
||||
if flags.DisableNameSuffixHash {
|
||||
args.Options = &types.GeneratorOptions{
|
||||
DisableNameSuffixHash: true,
|
||||
}
|
||||
}
|
||||
if flags.Behavior != "" {
|
||||
args.Behavior = flags.Behavior
|
||||
}
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package add
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
func TestDataValidation_NoName(t *testing.T) {
|
||||
fa := configmapSecretFlagsAndArgs{}
|
||||
require.Error(t, fa.Validate([]string{}))
|
||||
}
|
||||
|
||||
func TestDataValidation_MoreThanOneName(t *testing.T) {
|
||||
fa := configmapSecretFlagsAndArgs{}
|
||||
|
||||
require.Error(t, fa.Validate([]string{"name", "othername"}))
|
||||
}
|
||||
|
||||
func TestDataConfigValidation_Flags(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
fa configmapSecretFlagsAndArgs
|
||||
shouldFail bool
|
||||
}{
|
||||
{
|
||||
name: "env-file-source and literal are both set",
|
||||
fa: configmapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{"one", "two"},
|
||||
EnvFileSource: "three",
|
||||
},
|
||||
shouldFail: true,
|
||||
},
|
||||
{
|
||||
name: "env-file-source and from-file are both set",
|
||||
fa: configmapSecretFlagsAndArgs{
|
||||
FileSources: []string{"one", "two"},
|
||||
EnvFileSource: "three",
|
||||
},
|
||||
shouldFail: true,
|
||||
},
|
||||
{
|
||||
name: "we don't have any option set",
|
||||
fa: configmapSecretFlagsAndArgs{},
|
||||
shouldFail: true,
|
||||
},
|
||||
{
|
||||
name: "we have from-file and literal ",
|
||||
fa: configmapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{"one", "two"},
|
||||
FileSources: []string{"three", "four"},
|
||||
},
|
||||
shouldFail: false,
|
||||
},
|
||||
{
|
||||
name: "correct behavior",
|
||||
fa: configmapSecretFlagsAndArgs{
|
||||
EnvFileSource: "foo",
|
||||
Behavior: "merge",
|
||||
},
|
||||
shouldFail: false,
|
||||
},
|
||||
{
|
||||
name: "incorrect behavior",
|
||||
fa: configmapSecretFlagsAndArgs{
|
||||
EnvFileSource: "foo",
|
||||
Behavior: "merge-unknown",
|
||||
},
|
||||
shouldFail: true,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
err := test.fa.Validate([]string{"name"})
|
||||
if test.shouldFail {
|
||||
require.Error(t, err)
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandFileSource(t *testing.T) {
|
||||
fSys := filesys.MakeEmptyDirInMemory()
|
||||
_, err := fSys.Create("dir/fa1")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/fa2")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/readme")
|
||||
require.NoError(t, err)
|
||||
fa := configmapSecretFlagsAndArgs{
|
||||
FileSources: []string{"dir/fa*"},
|
||||
}
|
||||
err = fa.ExpandFileSource(fSys)
|
||||
require.NoError(t, err)
|
||||
expected := []string{
|
||||
"dir/fa1",
|
||||
"dir/fa2",
|
||||
}
|
||||
if !reflect.DeepEqual(fa.FileSources, expected) {
|
||||
t.Fatalf("FileSources is not correctly expanded: %v", fa.FileSources)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandFileSourceWithKey(t *testing.T) {
|
||||
fSys := filesys.MakeEmptyDirInMemory()
|
||||
_, err := fSys.Create("dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/foobar")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/simplebar")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/readme")
|
||||
require.NoError(t, err)
|
||||
fa := configmapSecretFlagsAndArgs{
|
||||
FileSources: []string{"foo-key=dir/fa*", "bar-key=dir/foobar", "dir/simplebar"},
|
||||
}
|
||||
err = fa.ExpandFileSource(fSys)
|
||||
require.NoError(t, err)
|
||||
expected := []string{
|
||||
"foo-key=dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc",
|
||||
"bar-key=dir/foobar",
|
||||
"dir/simplebar",
|
||||
}
|
||||
if !reflect.DeepEqual(fa.FileSources, expected) {
|
||||
t.Fatalf("FileSources is not correctly expanded: %v", fa.FileSources)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandFileSourceWithKeyAndError(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
_, err := fSys.Create("dir/fa1")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/fa2")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/readme")
|
||||
require.NoError(t, err)
|
||||
fa := configmapSecretFlagsAndArgs{
|
||||
FileSources: []string{"foo-key=dir/fa*"},
|
||||
}
|
||||
err = fa.ExpandFileSource(fSys)
|
||||
if err == nil {
|
||||
t.Fatalf("FileSources should not be correctly expanded: %v", fa.FileSources)
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,8 @@ func NewCmdEdit(
|
||||
set.NewCmdSet(
|
||||
fSys,
|
||||
kv.NewLoader(ldrhelper.NewFileLoaderAtCwd(fSys), v),
|
||||
v),
|
||||
v,
|
||||
rf),
|
||||
fix.NewCmdFix(fSys, w),
|
||||
remove.NewCmdRemove(fSys, v),
|
||||
listbuiltin.NewCmdListBuiltinPlugin(),
|
||||
|
||||
@@ -134,7 +134,7 @@ func getNodesFromFile(fileName string, fSys filesys.FileSystem) ([]*kyaml.RNode,
|
||||
}
|
||||
out := &bytes.Buffer{}
|
||||
r := kio.ByteReadWriter{
|
||||
Reader: bytes.NewBufferString(string(b)),
|
||||
Reader: bytes.NewBuffer(b),
|
||||
Writer: out,
|
||||
KeepReaderAnnotations: true,
|
||||
OmitReaderAnnotations: true,
|
||||
@@ -284,7 +284,11 @@ func constructTargets(file string, node *kyaml.RNode, fieldPaths []string,
|
||||
func writePatchTargets(patch types.Patch, node *kyaml.RNode, fieldPaths []string,
|
||||
options []*types.FieldOptions) ([]*types.TargetSelector, error) {
|
||||
var result []*types.TargetSelector
|
||||
selector := patch.Target.Copy()
|
||||
|
||||
selector := types.Selector{}
|
||||
if patch.Target != nil {
|
||||
selector = patch.Target.Copy()
|
||||
}
|
||||
|
||||
for i := range fieldPaths {
|
||||
target := &types.TargetSelector{
|
||||
|
||||
@@ -43,7 +43,7 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -119,7 +119,7 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -197,7 +197,7 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -276,7 +276,7 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -355,7 +355,7 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
err := cmd.RunE(cmd, nil)
|
||||
@@ -412,8 +412,8 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
fSys.WriteFile("patch.yaml", patch)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
assert.NoError(t, fSys.WriteFile("patch.yaml", patch))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -533,8 +533,8 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
fSys.WriteFile("patch.yaml", patch)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
assert.NoError(t, fSys.WriteFile("patch.yaml", patch))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -657,8 +657,8 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
fSys.WriteFile("patch.yaml", patch)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
assert.NoError(t, fSys.WriteFile("patch.yaml", patch))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -780,8 +780,8 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
fSys.WriteFile("patch.yaml", patch)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
assert.NoError(t, fSys.WriteFile("patch.yaml", patch))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -910,8 +910,8 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
fSys.WriteFile("patch.yaml", patch)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
assert.NoError(t, fSys.WriteFile("patch.yaml", patch))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -1023,8 +1023,8 @@ spec:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomizationOverlay)
|
||||
fSys.WriteFile("base/pod.yaml", pod)
|
||||
fSys.WriteFile("base/kustomization.yaml", kustomizationBase)
|
||||
assert.NoError(t, fSys.WriteFile("base/pod.yaml", pod))
|
||||
assert.NoError(t, fSys.WriteFile("base/kustomization.yaml", kustomizationBase))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -1104,7 +1104,7 @@ metadata:
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
fSys.WriteFile("pod.yaml", pod)
|
||||
assert.NoError(t, fSys.WriteFile("pod.yaml", pod))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
@@ -1143,3 +1143,74 @@ metadata:
|
||||
a.b.c: SOME_SECRET_NAME_PLACEHOLDER
|
||||
`, string(content))
|
||||
}
|
||||
|
||||
func TestFixVarsWithPatch(t *testing.T) {
|
||||
kustomization := []byte(`
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
patchesStrategicMerge:
|
||||
- patch.yaml
|
||||
|
||||
vars:
|
||||
- name: CERTIFICATE_NAMESPACE
|
||||
objref:
|
||||
name: system
|
||||
fieldref:
|
||||
fieldpath: metadata.namespace
|
||||
`)
|
||||
patch := []byte(`
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: controller-manager
|
||||
namespace: system
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: $(CERTIFICATE_NAMESPACE)
|
||||
`)
|
||||
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, kustomization)
|
||||
assert.NoError(t, fSys.WriteFile("patch.yaml", patch))
|
||||
cmd := NewCmdFix(fSys, os.Stdout)
|
||||
assert.NoError(t, cmd.Flags().Set("vars", "true"))
|
||||
assert.NoError(t, cmd.RunE(cmd, nil))
|
||||
content, err := testutils_test.ReadTestKustomization(fSys)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
|
||||
patches:
|
||||
- path: patch.yaml
|
||||
replacements:
|
||||
- source:
|
||||
fieldPath: metadata.namespace
|
||||
name: system
|
||||
targets:
|
||||
- fieldPaths:
|
||||
- spec.template.spec.containers.0.name
|
||||
select:
|
||||
namespace: system
|
||||
`, string(content))
|
||||
|
||||
content, err = fSys.ReadFile("patch.yaml")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, `
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: controller-manager
|
||||
namespace: system
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: CERTIFICATE_NAMESPACE_PLACEHOLDER
|
||||
`, string(content))
|
||||
}
|
||||
|
||||
@@ -13,33 +13,49 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/konfig"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
type removeConfigMapOptions struct {
|
||||
configMapNamesToRemove []string
|
||||
namespace string
|
||||
}
|
||||
|
||||
// newCmdRemoveConfigMap removes configMapGenerator(s) with the specified name(s).
|
||||
func newCmdRemoveConfigMap(fSys filesys.FileSystem) *cobra.Command {
|
||||
var o removeConfigMapOptions
|
||||
var flags removeConfigMapOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "configmap",
|
||||
Use: "configmap NAME [,NAME] [--namespace=namespace-name]",
|
||||
Short: "Removes the specified configmap(s) from " +
|
||||
konfig.DefaultKustomizationFileName(),
|
||||
Long: "",
|
||||
Long: `Removes the specified configmap(s) from the ` + konfig.DefaultKustomizationFileName() + ` file in the specified namespace.
|
||||
If multiple configmap names are specified, the command will not fail on secret names that were not found in the file,
|
||||
but will issue a warning for each name that wasn't found.`,
|
||||
Example: `
|
||||
remove configmap my-configmap
|
||||
`,
|
||||
# Removes a single configmap named 'my-configmap' in the default namespace from the ` + konfig.DefaultKustomizationFileName() + ` file
|
||||
kustomize edit remove configmap my-configmap
|
||||
|
||||
# Removes configmaps named 'my-configmap' and 'other-configmap' in namespace 'test-namespace' from the ` + konfig.DefaultKustomizationFileName() + ` file
|
||||
kustomize edit remove configmap my-configmap,other-configmap --namespace=test-namespace
|
||||
`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := o.Validate(args)
|
||||
err := flags.Validate(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return o.RunRemoveConfigMap(fSys)
|
||||
return flags.RunRemoveConfigMap(fSys)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVar(
|
||||
&flags.namespace,
|
||||
util.NamespaceFlag,
|
||||
"",
|
||||
"Namespace to remove ConfigMap(s) from",
|
||||
)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -69,14 +85,16 @@ func (o *removeConfigMapOptions) RunRemoveConfigMap(fSys filesys.FileSystem) err
|
||||
}
|
||||
|
||||
foundConfigMaps := make(map[string]struct{})
|
||||
remainingConfigMaps := make([]types.ConfigMapArgs, 0, len(m.ConfigMapGenerator))
|
||||
|
||||
newConfigMaps := make([]types.ConfigMapArgs, 0, len(m.ConfigMapGenerator))
|
||||
for _, currentConfigMap := range m.ConfigMapGenerator {
|
||||
if kustfile.StringInSlice(currentConfigMap.Name, o.configMapNamesToRemove) {
|
||||
if kustfile.StringInSlice(currentConfigMap.Name, o.configMapNamesToRemove) &&
|
||||
util.NamespaceEqual(currentConfigMap.Namespace, o.namespace) {
|
||||
foundConfigMaps[currentConfigMap.Name] = struct{}{}
|
||||
continue
|
||||
}
|
||||
newConfigMaps = append(newConfigMaps, currentConfigMap)
|
||||
|
||||
remainingConfigMaps = append(remainingConfigMaps, currentConfigMap)
|
||||
}
|
||||
|
||||
if len(foundConfigMaps) == 0 {
|
||||
@@ -90,7 +108,7 @@ func (o *removeConfigMapOptions) RunRemoveConfigMap(fSys filesys.FileSystem) err
|
||||
}
|
||||
}
|
||||
|
||||
m.ConfigMapGenerator = newConfigMaps
|
||||
m.ConfigMapGenerator = remainingConfigMaps
|
||||
err = mf.Write(m)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write kustomization file: %w", err)
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright 2023 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package remove //nolint:testpackage
|
||||
package remove
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -13,84 +12,188 @@ import (
|
||||
)
|
||||
|
||||
func TestRemoveConfigMap(t *testing.T) {
|
||||
const configMapName01 = "example-configmap-01"
|
||||
const configMapName02 = "example-configmap-02"
|
||||
|
||||
tests := map[string]struct {
|
||||
input string
|
||||
args []string
|
||||
expectedOutput string
|
||||
wantErr bool
|
||||
expectedErr string
|
||||
}{
|
||||
"happy path": {
|
||||
input: fmt.Sprintf(`
|
||||
"removes a configmap successfully": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: %s
|
||||
- name: test-cm-1
|
||||
files:
|
||||
- application.properties
|
||||
`, configMapName01),
|
||||
args: []string{configMapName01},
|
||||
`,
|
||||
args: []string{"test-cm-1"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"multiple": {
|
||||
input: fmt.Sprintf(`
|
||||
"removes multiple configmaps successfully": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: %s
|
||||
- name: test-cm-1
|
||||
files:
|
||||
- application.properties
|
||||
- name: %s
|
||||
- name: test-cm-2
|
||||
files:
|
||||
- application.properties
|
||||
`, configMapName01, configMapName02),
|
||||
args: []string{
|
||||
fmt.Sprintf("%s,%s", configMapName01, configMapName02),
|
||||
},
|
||||
`,
|
||||
args: []string{"test-cm-1,test-cm-2"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"miss": {
|
||||
input: fmt.Sprintf(`
|
||||
"removes a configmap successfully when single configmap name is specified, it exists, but is not the only configmap present": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: %s
|
||||
- name: test-cm-1
|
||||
namespace: test-ns
|
||||
files:
|
||||
- application.properties
|
||||
`, configMapName01),
|
||||
- name: test-cm-2
|
||||
namespace: default
|
||||
literals:
|
||||
- test-key=test-value
|
||||
`,
|
||||
args: []string{"test-cm-1", "--namespace=test-ns"},
|
||||
wantErr: false,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test-key=test-value
|
||||
name: test-cm-2
|
||||
namespace: default
|
||||
`,
|
||||
},
|
||||
"succeeds when one configmap name exists and one doesn't exist": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: test-cm-1
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
args: []string{"test-cm-1,foo"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"succeeds when one configmap name exists in the specified namespace": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: test-cm
|
||||
namespace: test-ns
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
wantErr: false,
|
||||
args: []string{"test-cm", "--namespace=test-ns"},
|
||||
},
|
||||
"handles empty namespace as default in the args": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: test-cm
|
||||
namespace: default
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
wantErr: false,
|
||||
args: []string{"test-cm"},
|
||||
},
|
||||
"handles empty namespace as default in the kustomization file": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: test-cm
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
wantErr: false,
|
||||
args: []string{"test-cm", "--namespace=default"},
|
||||
},
|
||||
"fails when single configmap name is specified and doesn't exist": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: test-cm-1
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
args: []string{"foo"},
|
||||
wantErr: true,
|
||||
expectedErr: "no specified configmap(s) were found",
|
||||
},
|
||||
"no configmap name specified": {
|
||||
args: []string{},
|
||||
expectedErr: "at least one configmap name must be specified",
|
||||
},
|
||||
"too many configmap names specified": {
|
||||
args: []string{"test1", "test2"},
|
||||
expectedErr: "too many arguments",
|
||||
},
|
||||
"one existing and one non-existing": {
|
||||
input: fmt.Sprintf(`
|
||||
"fails when single configmap name is specified and doesn't exist in the specified namespace": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: %s
|
||||
- name: test-cm-1
|
||||
namespace: test-ns
|
||||
files:
|
||||
- application.properties
|
||||
`, configMapName01),
|
||||
args: []string{fmt.Sprintf("%s,%s", configMapName01, "foo")},
|
||||
expectedOutput: `
|
||||
`,
|
||||
args: []string{"test-cm-1"},
|
||||
wantErr: true,
|
||||
expectedErr: "no specified configmap(s) were found",
|
||||
},
|
||||
|
||||
"fails when single configmap name is specified and doesn't exist in the specified namespace, and neither namespace is the default one": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- name: test-cm-1
|
||||
namespace: test-ns
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
args: []string{"test-cm-1", "--namespace=other-ns"},
|
||||
wantErr: true,
|
||||
expectedErr: "no specified configmap(s) were found",
|
||||
},
|
||||
"fails when no configmap name is specified": {
|
||||
args: []string{},
|
||||
wantErr: true,
|
||||
expectedErr: "at least one configmap name must be specified",
|
||||
},
|
||||
"fails when too many configmap names are specified": {
|
||||
args: []string{"test1", "test2"},
|
||||
wantErr: true,
|
||||
expectedErr: "too many arguments",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -99,9 +202,10 @@ kind: Kustomization
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, []byte(tc.input))
|
||||
cmd := newCmdRemoveConfigMap(fSys)
|
||||
err := cmd.RunE(cmd, tc.args)
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
|
||||
if tc.expectedErr != "" {
|
||||
if tc.wantErr {
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), tc.expectedErr)
|
||||
return
|
||||
|
||||
@@ -13,33 +13,50 @@ import (
|
||||
"sigs.k8s.io/kustomize/api/konfig"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
type removeSecretOptions struct {
|
||||
secretNamesToRemove []string
|
||||
namespace string
|
||||
}
|
||||
|
||||
// newCmdRemoveSecret removes secretGenerator(s) with the specified name(s).
|
||||
func newCmdRemoveSecret(fSys filesys.FileSystem) *cobra.Command {
|
||||
var o removeSecretOptions
|
||||
var flags removeSecretOptions
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "secret",
|
||||
Use: "secret NAME [,NAME] [--namespace=namespace-name]",
|
||||
Short: "Removes the specified secret(s) from " +
|
||||
konfig.DefaultKustomizationFileName(),
|
||||
Long: "",
|
||||
Long: `Removes the specified secret(s) from the ` + konfig.DefaultKustomizationFileName() + ` file in the specified namespace.
|
||||
If multiple secret names are specified, the command will not fail on secret names that were not found in the file,
|
||||
but will issue a warning for each name that wasn't found.`,
|
||||
Example: `
|
||||
remove secret my-secret
|
||||
`,
|
||||
# Removes a single secret named 'my-secret' in the default namespace from the ` + konfig.DefaultKustomizationFileName() + ` file
|
||||
kustomize edit remove secret my-secret
|
||||
|
||||
# Removes secrets named 'my-secret' and 'other-secret' in namespace 'test-namespace' from the ` + konfig.DefaultKustomizationFileName() + ` file
|
||||
kustomize edit remove secret my-secret,other-secret --namespace=test-namespace
|
||||
`,
|
||||
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
err := o.Validate(args)
|
||||
err := flags.Validate(args)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return o.RunRemoveSecret(fSys)
|
||||
return flags.RunRemoveSecret(fSys)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringVar(
|
||||
&flags.namespace,
|
||||
util.NamespaceFlag,
|
||||
"",
|
||||
"Namespace to remove Secret(s) from",
|
||||
)
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -69,14 +86,15 @@ func (o *removeSecretOptions) RunRemoveSecret(fSys filesys.FileSystem) error {
|
||||
}
|
||||
|
||||
foundSecrets := make(map[string]struct{})
|
||||
remainingSecrets := make([]types.SecretArgs, 0, len(m.SecretGenerator))
|
||||
|
||||
newSecrets := make([]types.SecretArgs, 0, len(m.SecretGenerator))
|
||||
for _, currentSecret := range m.SecretGenerator {
|
||||
if kustfile.StringInSlice(currentSecret.Name, o.secretNamesToRemove) {
|
||||
if kustfile.StringInSlice(currentSecret.Name, o.secretNamesToRemove) &&
|
||||
util.NamespaceEqual(currentSecret.Namespace, o.namespace) {
|
||||
foundSecrets[currentSecret.Name] = struct{}{}
|
||||
continue
|
||||
}
|
||||
newSecrets = append(newSecrets, currentSecret)
|
||||
remainingSecrets = append(remainingSecrets, currentSecret)
|
||||
}
|
||||
|
||||
if len(foundSecrets) == 0 {
|
||||
@@ -89,8 +107,8 @@ func (o *removeSecretOptions) RunRemoveSecret(fSys filesys.FileSystem) error {
|
||||
log.Printf("secret %s doesn't exist in kustomization file", name)
|
||||
}
|
||||
}
|
||||
m.SecretGenerator = newSecrets
|
||||
|
||||
m.SecretGenerator = remainingSecrets
|
||||
err = mf.Write(m)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write kustomization file: %w", err)
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
// Copyright 2023 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package remove //nolint:testpackage
|
||||
package remove
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -13,85 +12,188 @@ import (
|
||||
)
|
||||
|
||||
func TestRemoveSecret(t *testing.T) {
|
||||
const secretName01 = "example-secret-01"
|
||||
const secretName02 = "example-secret-02"
|
||||
|
||||
tests := map[string]struct {
|
||||
input string
|
||||
args []string
|
||||
expectedOutput string
|
||||
wantErr bool
|
||||
expectedErr string
|
||||
}{
|
||||
"happy path": {
|
||||
input: fmt.Sprintf(`
|
||||
"removes a secret successfully": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: %s
|
||||
- name: test-secret-1
|
||||
files:
|
||||
- longsecret.txt
|
||||
`, secretName01),
|
||||
args: []string{secretName01},
|
||||
`,
|
||||
args: []string{"test-secret-1"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"multiple": {
|
||||
input: fmt.Sprintf(`
|
||||
"removes multiple secrets successfully": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: %s
|
||||
- name: test-secret-1
|
||||
files:
|
||||
- longsecret.txt
|
||||
- name: %s
|
||||
- name: test-secret-2
|
||||
files:
|
||||
- longsecret.txt
|
||||
`, secretName01, secretName02),
|
||||
args: []string{
|
||||
fmt.Sprintf("%s,%s", secretName01, secretName02),
|
||||
},
|
||||
`,
|
||||
args: []string{"test-secret-1,test-secret-2"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"miss": {
|
||||
input: fmt.Sprintf(`
|
||||
"removes a secret successfully when single secret name is specified, it exists, but is not the only secret present": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: %s
|
||||
- name: test-secret-1
|
||||
namespace: test-ns
|
||||
files:
|
||||
- longsecret.txt
|
||||
`, secretName01),
|
||||
args: []string{"foo"},
|
||||
expectedErr: "no specified secret(s) were found",
|
||||
},
|
||||
"no secret name specified": {
|
||||
args: []string{},
|
||||
expectedErr: "at least one secret name must be specified",
|
||||
},
|
||||
"too many secret names specified": {
|
||||
args: []string{"test1", "test2"},
|
||||
expectedErr: "too many arguments",
|
||||
},
|
||||
"one existing and one non-existing": {
|
||||
input: fmt.Sprintf(`
|
||||
- name: test-secret-2
|
||||
namespace: default
|
||||
literals:
|
||||
- test-key=test-secret
|
||||
`,
|
||||
args: []string{"test-secret-1", "--namespace=test-ns"},
|
||||
wantErr: false,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: %s
|
||||
- literals:
|
||||
- test-key=test-secret
|
||||
name: test-secret-2
|
||||
namespace: default
|
||||
`,
|
||||
},
|
||||
"succeeds when one secret name exists and one doesn't exist": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret-1
|
||||
files:
|
||||
- application.properties
|
||||
`, secretName01),
|
||||
args: []string{fmt.Sprintf("%s,%s", secretName01, "foo")},
|
||||
`,
|
||||
args: []string{"test-secret-1,test-secret-2"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"succeeds when one secret name exists in the specified namespace": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret
|
||||
namespace: test-ns
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
args: []string{"test-secret", "--namespace=test-ns"},
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
},
|
||||
"handles empty namespace as default in the args": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret
|
||||
namespace: default
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
wantErr: false,
|
||||
args: []string{"test-secret"},
|
||||
},
|
||||
"handles empty namespace as default in the kustomization file": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret
|
||||
files:
|
||||
- application.properties
|
||||
`,
|
||||
expectedOutput: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
`,
|
||||
wantErr: false,
|
||||
args: []string{"test-secret", "--namespace=default"},
|
||||
},
|
||||
"fails when single secret name is specified and doesn't exist": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret-1
|
||||
files:
|
||||
- longsecret.txt
|
||||
`,
|
||||
args: []string{"foo"},
|
||||
wantErr: true,
|
||||
expectedErr: "no specified secret(s) were found",
|
||||
},
|
||||
"fails when single secret name is specified and doesn't exist in the specified namespace": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret-1
|
||||
namespace: test-ns
|
||||
files:
|
||||
- longsecret.txt
|
||||
`,
|
||||
args: []string{"test-secret-1"},
|
||||
wantErr: true,
|
||||
expectedErr: "no specified secret(s) were found",
|
||||
},
|
||||
|
||||
"fails when single secret name is specified and doesn't exist in the specified namespace, and neither namespace is the default one": {
|
||||
input: `
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
secretGenerator:
|
||||
- name: test-secret-1
|
||||
namespace: test-ns
|
||||
files:
|
||||
- longsecret.txt
|
||||
`,
|
||||
args: []string{"test-secret-1", "--namespace=other-ns"},
|
||||
wantErr: true,
|
||||
expectedErr: "no specified secret(s) were found",
|
||||
},
|
||||
"fails when no secret name is specified": {
|
||||
args: []string{},
|
||||
wantErr: true,
|
||||
expectedErr: "at least one secret name must be specified",
|
||||
},
|
||||
"fails when too many secret names are specified": {
|
||||
args: []string{"test1", "test2"},
|
||||
wantErr: true,
|
||||
expectedErr: "too many arguments",
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range tests {
|
||||
@@ -99,9 +201,10 @@ kind: Kustomization
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
testutils_test.WriteTestKustomizationWith(fSys, []byte(tc.input))
|
||||
cmd := newCmdRemoveSecret(fSys)
|
||||
err := cmd.RunE(cmd, tc.args)
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
|
||||
if tc.expectedErr != "" {
|
||||
if tc.wantErr {
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), tc.expectedErr)
|
||||
return
|
||||
|
||||
@@ -6,11 +6,17 @@ package set
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
// NewCmdSet returns an instance of 'set' subcommand.
|
||||
func NewCmdSet(fSys filesys.FileSystem, ldr ifc.KvLoader, v ifc.Validator) *cobra.Command {
|
||||
func NewCmdSet(
|
||||
fSys filesys.FileSystem,
|
||||
ldr ifc.KvLoader,
|
||||
v ifc.Validator,
|
||||
rf *resource.Factory,
|
||||
) *cobra.Command {
|
||||
c := &cobra.Command{
|
||||
Use: "set",
|
||||
Short: "Sets the value of different fields in kustomization file",
|
||||
@@ -26,6 +32,7 @@ func NewCmdSet(fSys filesys.FileSystem, ldr ifc.KvLoader, v ifc.Validator) *cobr
|
||||
}
|
||||
|
||||
c.AddCommand(
|
||||
newCmdSetConfigMap(fSys, ldr, rf),
|
||||
newCmdSetNamePrefix(fSys),
|
||||
newCmdSetNameSuffix(fSys),
|
||||
newCmdSetNamespace(fSys, v),
|
||||
|
||||
151
kustomize/commands/edit/set/setconfigmap.go
Normal file
151
kustomize/commands/edit/set/setconfigmap.go
Normal file
@@ -0,0 +1,151 @@
|
||||
// Copyright 2023 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package set
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/exp/slices"
|
||||
"sigs.k8s.io/kustomize/api/ifc"
|
||||
"sigs.k8s.io/kustomize/api/resource"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/util"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
func newCmdSetConfigMap(
|
||||
fSys filesys.FileSystem,
|
||||
ldr ifc.KvLoader,
|
||||
rf *resource.Factory,
|
||||
) *cobra.Command {
|
||||
var flags util.ConfigMapSecretFlagsAndArgs
|
||||
cmd := &cobra.Command{
|
||||
Use: "configmap NAME [--from-literal=key1=value1] [--namespace=namespace-name] [--new-namespace=new-namespace-name]",
|
||||
Short: "Edits the value for an existing key for a configmap in the kustomization file",
|
||||
Long: `Edits the value for an existing key in an existing configmap in the kustomization file.
|
||||
Both configmap name and key name must exist for this command to succeed.`,
|
||||
Example: `
|
||||
# Edits an existing configmap in the kustomization file, changing value of key1 to 2
|
||||
kustomize edit set configmap my-configmap --from-literal=key1=2
|
||||
|
||||
# Edits an existing configmap in the kustomization file, changing namespace to 'new-namespace'
|
||||
kustomize edit set configmap my-configmap --namespace=current-namespace --new-namespace=new-namespace
|
||||
`,
|
||||
RunE: func(_ *cobra.Command, args []string) error {
|
||||
return runEditSetConfigMap(flags, fSys, args, ldr, rf)
|
||||
},
|
||||
}
|
||||
|
||||
cmd.Flags().StringArrayVar(
|
||||
&flags.LiteralSources,
|
||||
util.FromLiteralFlag,
|
||||
[]string{},
|
||||
"Specify an existing key and a new value to update a ConfigMap (i.e. mykey=newvalue)")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.Namespace,
|
||||
util.NamespaceFlag,
|
||||
"",
|
||||
"Current namespace of the target ConfigMap")
|
||||
cmd.Flags().StringVar(
|
||||
&flags.NewNamespace,
|
||||
util.NewNamespaceFlag,
|
||||
"",
|
||||
"New namespace value for the target ConfigMap")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func runEditSetConfigMap(
|
||||
flags util.ConfigMapSecretFlagsAndArgs,
|
||||
fSys filesys.FileSystem,
|
||||
args []string,
|
||||
ldr ifc.KvLoader,
|
||||
rf *resource.Factory,
|
||||
) error {
|
||||
err := flags.ExpandFileSource(fSys)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to expand file source: %w", err)
|
||||
}
|
||||
|
||||
err = flags.ValidateSet(args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to validate flags: %w", err)
|
||||
}
|
||||
|
||||
// Load the kustomization file.
|
||||
mf, err := kustfile.NewKustomizationFile(fSys)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load kustomization file: %w", err)
|
||||
}
|
||||
|
||||
kustomization, err := mf.Read()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to read kustomization file: %w", err)
|
||||
}
|
||||
|
||||
// Updates the existing ConfigMap
|
||||
err = setConfigMap(ldr, kustomization, flags, rf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create configmap: %w", err)
|
||||
}
|
||||
|
||||
// Write out the kustomization file with added configmap.
|
||||
err = mf.Write(kustomization)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to write kustomization file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func setConfigMap(
|
||||
ldr ifc.KvLoader,
|
||||
k *types.Kustomization,
|
||||
flags util.ConfigMapSecretFlagsAndArgs,
|
||||
rf *resource.Factory,
|
||||
) error {
|
||||
args, err := findConfigMapArgs(k, flags.Name, flags.Namespace)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not set new ConfigMap value: %w", err)
|
||||
}
|
||||
|
||||
if len(flags.LiteralSources) > 0 {
|
||||
err := util.UpdateLiteralSources(&args.GeneratorArgs, flags)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update literal sources: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// update namespace to new one
|
||||
if flags.NewNamespace != "" {
|
||||
args.Namespace = flags.NewNamespace
|
||||
}
|
||||
|
||||
// Validate by trying to create corev1.configmap.
|
||||
args.Options = types.MergeGlobalOptionsIntoLocal(
|
||||
args.Options, k.GeneratorOptions)
|
||||
|
||||
_, err = rf.MakeConfigMap(ldr, args)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to validate ConfigMap structure: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// findConfigMapArgs finds the generator arguments corresponding to the specified
|
||||
// ConfigMap name. ConfigMap must exist for this command to be successful.
|
||||
func findConfigMapArgs(m *types.Kustomization, name, namespace string) (*types.ConfigMapArgs, error) {
|
||||
cmIndex := slices.IndexFunc(m.ConfigMapGenerator, func(cmArgs types.ConfigMapArgs) bool {
|
||||
return name == cmArgs.Name && util.NamespaceEqual(namespace, cmArgs.Namespace)
|
||||
})
|
||||
|
||||
if cmIndex == -1 {
|
||||
return nil, fmt.Errorf("unable to find ConfigMap with name '%q'", name)
|
||||
}
|
||||
|
||||
return &m.ConfigMapGenerator[cmIndex], nil
|
||||
}
|
||||
246
kustomize/commands/edit/set/setconfigmap_test.go
Normal file
246
kustomize/commands/edit/set/setconfigmap_test.go
Normal file
@@ -0,0 +1,246 @@
|
||||
// Copyright 2023 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package set
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/kv"
|
||||
"sigs.k8s.io/kustomize/api/pkg/loader"
|
||||
"sigs.k8s.io/kustomize/api/provider"
|
||||
"sigs.k8s.io/kustomize/kustomize/v5/commands/internal/kustfile"
|
||||
testutils_test "sigs.k8s.io/kustomize/kustomize/v5/commands/internal/testutils"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
func TestEditSetConfigMapError(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
pvd := provider.NewDefaultDepProvider()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
input string
|
||||
args []string
|
||||
expectedErrorMsg string
|
||||
}{
|
||||
{
|
||||
name: "fails to set a value because key doesn't exist",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
`,
|
||||
args: []string{"test-cm", "--from-literal=key3=val2"},
|
||||
expectedErrorMsg: "key 'key3' not found in resource",
|
||||
},
|
||||
{
|
||||
name: "fails to set a value because configmap doesn't exist",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
`,
|
||||
args: []string{"test-cm2", "--from-literal=key3=val2"},
|
||||
expectedErrorMsg: "unable to find ConfigMap with name '\"test-cm2\"'",
|
||||
},
|
||||
{
|
||||
name: "fails validation because no attributes are being changed",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
namespace: test-ns
|
||||
`,
|
||||
args: []string{"test-cm", "--namespace=test-ns"},
|
||||
expectedErrorMsg: "at least one of [--from-literal, --new-namespace] must be specified",
|
||||
},
|
||||
{
|
||||
name: "fails when a literal source doesn't have a key",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
`,
|
||||
args: []string{"test-cm", "--from-literal=value"},
|
||||
expectedErrorMsg: "literal values must be specified in the key=value format",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cmd := newCmdSetConfigMap(
|
||||
fSys,
|
||||
kv.NewLoader(
|
||||
loader.NewFileLoaderAtCwd(fSys),
|
||||
pvd.GetFieldValidator()),
|
||||
pvd.GetResourceFactory(),
|
||||
)
|
||||
|
||||
testutils_test.WriteTestKustomizationWith(fSys, []byte(tc.input))
|
||||
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), tc.expectedErrorMsg)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestEditSetConfigMapSuccess(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
pvd := provider.NewDefaultDepProvider()
|
||||
testCases := []struct {
|
||||
name string
|
||||
input string
|
||||
args []string
|
||||
expectedLiterals []string
|
||||
expectedNamespace string
|
||||
}{
|
||||
{
|
||||
name: "set a value successfully",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- key1=val1
|
||||
- test=value
|
||||
name: test-cm
|
||||
`,
|
||||
expectedLiterals: []string{"key1=val2", "test=value"},
|
||||
args: []string{"test-cm", "--from-literal=key1=val2"},
|
||||
},
|
||||
{
|
||||
name: "successfully update namespace of target configmap",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
namespace: test-ns
|
||||
`,
|
||||
args: []string{"test-cm", "--namespace=test-ns", "--new-namespace=test-new-ns"},
|
||||
expectedNamespace: "test-new-ns",
|
||||
},
|
||||
{
|
||||
name: "successfully update namespace of target configmap with empty namespace in file and namespace specified in command",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
`,
|
||||
args: []string{"test-cm", "--namespace=default", "--new-namespace=test-new-ns"},
|
||||
expectedNamespace: "test-new-ns",
|
||||
},
|
||||
{
|
||||
name: "successfully update namespace of target configmap with default namespace and no namespace specified in command",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
namespace: default
|
||||
`,
|
||||
args: []string{"test-cm", "--new-namespace=test-new-ns"},
|
||||
expectedNamespace: "test-new-ns",
|
||||
},
|
||||
{
|
||||
name: "successfully update literal source of target configmap with empty namespace in file and namespace specified in command",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
`,
|
||||
args: []string{"test-cm", "--namespace=default", "--from-literal=key1=val2"},
|
||||
expectedLiterals: []string{"test=value", "key1=val2"},
|
||||
},
|
||||
{
|
||||
name: "successfully update namespace of target configmap with default namespace and no namespace specified in command",
|
||||
input: `---
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
configMapGenerator:
|
||||
- literals:
|
||||
- test=value
|
||||
- key1=val1
|
||||
name: test-cm
|
||||
namespace: default
|
||||
`,
|
||||
args: []string{"test-cm", "--namespace=default", "--from-literal=key1=val2"},
|
||||
expectedLiterals: []string{"test=value", "key1=val2"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
cmd := newCmdSetConfigMap(
|
||||
fSys,
|
||||
kv.NewLoader(
|
||||
loader.NewFileLoaderAtCwd(fSys),
|
||||
pvd.GetFieldValidator()),
|
||||
pvd.GetResourceFactory(),
|
||||
)
|
||||
|
||||
testutils_test.WriteTestKustomizationWith(fSys, []byte(tc.input))
|
||||
|
||||
cmd.SetArgs(tc.args)
|
||||
err := cmd.Execute()
|
||||
|
||||
require.NoError(t, err)
|
||||
|
||||
_, err = testutils_test.ReadTestKustomization(fSys)
|
||||
require.NoError(t, err)
|
||||
|
||||
mf, err := kustfile.NewKustomizationFile(fSys)
|
||||
require.NoError(t, err)
|
||||
|
||||
kustomization, err := mf.Read()
|
||||
require.NoError(t, err)
|
||||
|
||||
require.NotNil(t, kustomization)
|
||||
require.NotEmpty(t, kustomization.ConfigMapGenerator)
|
||||
require.Greater(t, len(kustomization.ConfigMapGenerator), 0)
|
||||
|
||||
if tc.expectedNamespace != "" {
|
||||
require.Equal(t, tc.expectedNamespace, kustomization.ConfigMapGenerator[0].Namespace)
|
||||
}
|
||||
|
||||
if len(tc.expectedLiterals) > 0 {
|
||||
require.ElementsMatch(t, tc.expectedLiterals, kustomization.ConfigMapGenerator[0].LiteralSources)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
217
kustomize/commands/internal/util/configmapSecretFlagsAndArgs.go
Normal file
217
kustomize/commands/internal/util/configmapSecretFlagsAndArgs.go
Normal file
@@ -0,0 +1,217 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
const (
|
||||
FromFileFlag = "from-file"
|
||||
FromLiteralFlag = "from-literal"
|
||||
FromEnvFileFlag = "from-env-file"
|
||||
DisableNameSuffixHashFlag = "disableNameSuffixHash"
|
||||
BehaviorFlag = "behavior"
|
||||
NamespaceFlag = "namespace"
|
||||
NewNamespaceFlag = "new-namespace"
|
||||
FlagFormat = "--%s=%s"
|
||||
)
|
||||
|
||||
// ConfigMapSecretFlagsAndArgs encapsulates the options for add secret/configmap commands.
|
||||
type ConfigMapSecretFlagsAndArgs struct {
|
||||
// Name of ConfigMap/Secret (required)
|
||||
Name string
|
||||
// FileSources to derive the ConfigMap/Secret from (optional)
|
||||
FileSources []string
|
||||
// LiteralSources to derive the ConfigMap/Secret from (optional)
|
||||
LiteralSources []string
|
||||
// EnvFileSource to derive the ConfigMap/Secret from (optional)
|
||||
// TODO: Rationalize this name with Generic.EnvSource
|
||||
EnvFileSource string
|
||||
// Resource generation behavior (optional)
|
||||
Behavior string
|
||||
// Type of secret to create
|
||||
Type string
|
||||
// Namespace of ConfigMap/Secret (optional) -- if unspecified, default is assumed
|
||||
Namespace string
|
||||
// Disable name suffix
|
||||
DisableNameSuffixHash bool
|
||||
// NewNamespace for ConfigMap/Secret (optional) -- only for 'edit set' command
|
||||
NewNamespace string
|
||||
}
|
||||
|
||||
// ValidateAdd validates required fields are set to support structured generation for the
|
||||
// edit add command.
|
||||
func (a *ConfigMapSecretFlagsAndArgs) ValidateAdd(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("name must be specified once")
|
||||
}
|
||||
a.Name = args[0]
|
||||
|
||||
if len(a.EnvFileSource) == 0 && len(a.FileSources) == 0 && len(a.LiteralSources) == 0 {
|
||||
return fmt.Errorf("at least from-env-file, or from-file or from-literal must be set")
|
||||
}
|
||||
if len(a.EnvFileSource) > 0 && (len(a.FileSources) > 0 || len(a.LiteralSources) > 0) {
|
||||
return fmt.Errorf("from-env-file cannot be combined with from-file or from-literal")
|
||||
}
|
||||
if len(a.Behavior) > 0 && types.NewGenerationBehavior(a.Behavior) == types.BehaviorUnspecified {
|
||||
return fmt.Errorf(`invalid behavior: must be one of "%s", "%s", or "%s"`,
|
||||
types.BehaviorCreate, types.BehaviorMerge, types.BehaviorReplace)
|
||||
}
|
||||
// TODO: Should we check if the path exists? if it's valid, if it's within the same (sub-)directory?
|
||||
return nil
|
||||
}
|
||||
|
||||
// ValidateSet validates required fields are set to support structured generation for the
|
||||
// edit set command.
|
||||
func (a *ConfigMapSecretFlagsAndArgs) ValidateSet(args []string) error {
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("name must be specified once")
|
||||
}
|
||||
a.Name = args[0]
|
||||
|
||||
if len(a.LiteralSources) == 0 && a.NewNamespace == "" {
|
||||
return fmt.Errorf("at least one of [--from-literal, --new-namespace] must be specified")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// ExpandFileSource normalizes a string list, possibly
|
||||
// containing globs, into a validated, globless list.
|
||||
// For example, this list:
|
||||
// - some/path
|
||||
// - some/dir/a*
|
||||
// - bfile=some/dir/b*
|
||||
// becomes:
|
||||
// - some/path
|
||||
// - some/dir/airplane
|
||||
// - some/dir/ant
|
||||
// - some/dir/apple
|
||||
// - bfile=some/dir/banana
|
||||
// i.e. everything is converted to a key=value pair,
|
||||
// where the value is always a relative file path,
|
||||
// and the key, if missing, is the same as the value.
|
||||
// In the case where the key is explicitly declared,
|
||||
// the globbing, if present, must have exactly one match.
|
||||
func (a *ConfigMapSecretFlagsAndArgs) ExpandFileSource(fSys filesys.FileSystem) error {
|
||||
const numberComponentsWithKey = 2
|
||||
|
||||
var results []string
|
||||
for _, pattern := range a.FileSources {
|
||||
var patterns []string
|
||||
key := ""
|
||||
// check if the pattern is in `--from-file=[key=]source` format
|
||||
// and if so split it to send only the file-pattern to glob function
|
||||
s := strings.Split(pattern, "=")
|
||||
if len(s) == numberComponentsWithKey {
|
||||
patterns = append(patterns, s[1])
|
||||
key = s[0]
|
||||
} else {
|
||||
patterns = append(patterns, s[0])
|
||||
}
|
||||
result, err := GlobPatterns(fSys, patterns)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// if the format is `--from-file=[key=]source` accept only one result
|
||||
// and extend it with the `key=` prefix
|
||||
if key != "" {
|
||||
if len(result) != 1 {
|
||||
return fmt.Errorf(
|
||||
"'pattern '%s' catches files %v, should catch only one", pattern, result)
|
||||
}
|
||||
fileSource := fmt.Sprintf("%s=%s", key, result[0])
|
||||
results = append(results, fileSource)
|
||||
} else {
|
||||
results = append(results, result...)
|
||||
}
|
||||
}
|
||||
a.FileSources = results
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateLiteralSources looks for literal sources that already exist and tries
|
||||
// to replace their values with new values.
|
||||
// The key specified must exist in the target resource (ConfigMap or Secret).
|
||||
func UpdateLiteralSources(
|
||||
args *types.GeneratorArgs,
|
||||
flags ConfigMapSecretFlagsAndArgs,
|
||||
) error {
|
||||
sources := make(map[string]any)
|
||||
|
||||
for _, val := range args.LiteralSources {
|
||||
key, value, err := validateAndExtractLiteralSource(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update resource: %w", err)
|
||||
}
|
||||
sources[key] = value
|
||||
}
|
||||
|
||||
for _, val := range flags.LiteralSources {
|
||||
key, value, err := validateAndExtractLiteralSource(val)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update resource: %w", err)
|
||||
}
|
||||
|
||||
if _, ok := sources[key]; !ok {
|
||||
return fmt.Errorf("key '%s' not found in resource", key)
|
||||
}
|
||||
|
||||
sources[key] = value
|
||||
}
|
||||
|
||||
// re-assemble key-pairs
|
||||
newLiteralSources := make([]string, 0)
|
||||
for key, val := range sources {
|
||||
newLiteralSources = append(newLiteralSources, fmt.Sprintf("%s=%s", key, val))
|
||||
}
|
||||
|
||||
args.LiteralSources = newLiteralSources
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateAndExtractLiteralSource(val string) (string, string, error) {
|
||||
// This is the separator to be used as a boundary for the key/value pair
|
||||
const keyValueSeparator = "="
|
||||
// Maximum number of times the separator can appear in the string
|
||||
const maximumSeparatorNumber = 1
|
||||
|
||||
count := strings.Count(val, keyValueSeparator)
|
||||
if count <= 0 || count > maximumSeparatorNumber {
|
||||
return "", "", fmt.Errorf("invalid format: literal values must be specified in the key=value format")
|
||||
}
|
||||
|
||||
key, value, _ := strings.Cut(val, keyValueSeparator) // we don't need the value of found because of prior validation
|
||||
|
||||
return key, value, nil
|
||||
}
|
||||
|
||||
func MergeFlagsIntoGeneratorArgs(args *types.GeneratorArgs, flags ConfigMapSecretFlagsAndArgs) {
|
||||
if len(flags.LiteralSources) > 0 {
|
||||
args.LiteralSources = append(
|
||||
args.LiteralSources, flags.LiteralSources...)
|
||||
}
|
||||
if len(flags.FileSources) > 0 {
|
||||
args.FileSources = append(
|
||||
args.FileSources, flags.FileSources...)
|
||||
}
|
||||
if flags.EnvFileSource != "" {
|
||||
args.EnvSources = append(
|
||||
args.EnvSources, flags.EnvFileSource)
|
||||
}
|
||||
if flags.DisableNameSuffixHash {
|
||||
args.Options = &types.GeneratorOptions{
|
||||
DisableNameSuffixHash: true,
|
||||
}
|
||||
}
|
||||
if flags.Behavior != "" {
|
||||
args.Behavior = flags.Behavior
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
// Copyright 2019 The Kubernetes Authors.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"sigs.k8s.io/kustomize/api/types"
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
func TestValidateAdd(t *testing.T) {
|
||||
fa := ConfigMapSecretFlagsAndArgs{}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
wantErr func(require.TestingT, error, ...interface{})
|
||||
}{
|
||||
{
|
||||
"validateAdd with no arguments",
|
||||
[]string{},
|
||||
require.Error,
|
||||
},
|
||||
{
|
||||
"validateAdd with more than one name",
|
||||
[]string{"name", "othername"},
|
||||
require.Error,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.wantErr(t, fa.ValidateAdd(tc.args))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateSet(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
args []string
|
||||
fa ConfigMapSecretFlagsAndArgs
|
||||
wantErr func(require.TestingT, error, ...interface{})
|
||||
}{
|
||||
{
|
||||
// must have one single name
|
||||
name: "fails with no arguments",
|
||||
args: []string{},
|
||||
fa: ConfigMapSecretFlagsAndArgs{},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
// must have one single name
|
||||
name: "fails with more than one name",
|
||||
args: []string{"testname", "testname2"},
|
||||
fa: ConfigMapSecretFlagsAndArgs{},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
// must have at least --from-literal or --new-namespace
|
||||
name: "succeeds with --from-literal",
|
||||
args: []string{"test-configmap"},
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{"key1=value1"},
|
||||
},
|
||||
wantErr: require.NoError,
|
||||
},
|
||||
{
|
||||
// must have at least --from-literal or --new-namespace
|
||||
name: "succeeds with --new-namespace",
|
||||
args: []string{"test-configmap"},
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
NewNamespace: "new-namespace",
|
||||
},
|
||||
wantErr: require.NoError,
|
||||
},
|
||||
{
|
||||
// must have at least --from-literal or --new-namespace
|
||||
name: "succeeds with --new-namespace and --from-literal",
|
||||
args: []string{"test-configmap"},
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{"key1=value1"},
|
||||
NewNamespace: "new-namespace",
|
||||
},
|
||||
wantErr: require.NoError,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.wantErr(t, tc.fa.ValidateSet(tc.args))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDataConfigValidation_Flags(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
fa ConfigMapSecretFlagsAndArgs
|
||||
wantErr func(require.TestingT, error, ...interface{})
|
||||
}{
|
||||
{
|
||||
name: "env-file-source and literal are both set",
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{"one", "two"},
|
||||
EnvFileSource: "three",
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
name: "env-file-source and from-file are both set",
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
FileSources: []string{"one", "two"},
|
||||
EnvFileSource: "three",
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
name: "we don't have any option set",
|
||||
fa: ConfigMapSecretFlagsAndArgs{},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
name: "we have from-file and literal ",
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{"one", "two"},
|
||||
FileSources: []string{"three", "four"},
|
||||
},
|
||||
wantErr: require.NoError,
|
||||
},
|
||||
{
|
||||
name: "correct behavior",
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
EnvFileSource: "foo",
|
||||
Behavior: "merge",
|
||||
},
|
||||
wantErr: require.NoError,
|
||||
},
|
||||
{
|
||||
name: "incorrect behavior",
|
||||
fa: ConfigMapSecretFlagsAndArgs{
|
||||
EnvFileSource: "foo",
|
||||
Behavior: "merge-unknown",
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
test.wantErr(t, test.fa.ValidateAdd([]string{"name"}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandFileSource(t *testing.T) {
|
||||
fSys := filesys.MakeEmptyDirInMemory()
|
||||
_, err := fSys.Create("dir/fa1")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/fa2")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/readme")
|
||||
require.NoError(t, err)
|
||||
fa := ConfigMapSecretFlagsAndArgs{
|
||||
FileSources: []string{"dir/fa*"},
|
||||
}
|
||||
err = fa.ExpandFileSource(fSys)
|
||||
require.NoError(t, err)
|
||||
expected := []string{
|
||||
"dir/fa1",
|
||||
"dir/fa2",
|
||||
}
|
||||
if !reflect.DeepEqual(fa.FileSources, expected) {
|
||||
t.Fatalf("FileSources is not correctly expanded: %v", fa.FileSources)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandFileSourceWithKey(t *testing.T) {
|
||||
fSys := filesys.MakeEmptyDirInMemory()
|
||||
_, err := fSys.Create("dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/foobar")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/simplebar")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/readme")
|
||||
require.NoError(t, err)
|
||||
fa := ConfigMapSecretFlagsAndArgs{
|
||||
FileSources: []string{"foo-key=dir/fa*", "bar-key=dir/foobar", "dir/simplebar"},
|
||||
}
|
||||
err = fa.ExpandFileSource(fSys)
|
||||
require.NoError(t, err)
|
||||
expected := []string{
|
||||
"foo-key=dir/faaaaaaaaaabbbbbbbbbccccccccccccccccc",
|
||||
"bar-key=dir/foobar",
|
||||
"dir/simplebar",
|
||||
}
|
||||
if !reflect.DeepEqual(fa.FileSources, expected) {
|
||||
t.Fatalf("FileSources is not correctly expanded: %v", fa.FileSources)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExpandFileSourceWithKeyAndError(t *testing.T) {
|
||||
fSys := filesys.MakeFsInMemory()
|
||||
_, err := fSys.Create("dir/fa1")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/fa2")
|
||||
require.NoError(t, err)
|
||||
_, err = fSys.Create("dir/readme")
|
||||
require.NoError(t, err)
|
||||
fa := ConfigMapSecretFlagsAndArgs{
|
||||
FileSources: []string{"foo-key=dir/fa*"},
|
||||
}
|
||||
err = fa.ExpandFileSource(fSys)
|
||||
if err == nil {
|
||||
t.Fatalf("FileSources should not be correctly expanded: %v", fa.FileSources)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateLiteralSources(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
args *types.GeneratorArgs
|
||||
flags ConfigMapSecretFlagsAndArgs
|
||||
expectedArgs *types.GeneratorArgs
|
||||
wantErr func(require.TestingT, error, ...interface{})
|
||||
}{
|
||||
{
|
||||
name: "fails when key doesn't exist",
|
||||
args: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key1=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
flags: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{
|
||||
"key2=value",
|
||||
},
|
||||
},
|
||||
expectedArgs: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key1=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
name: "updates correctly an existing key",
|
||||
args: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
flags: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{
|
||||
"key2=value",
|
||||
},
|
||||
},
|
||||
expectedArgs: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=value", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
wantErr: require.NoError,
|
||||
},
|
||||
{
|
||||
name: "fails when format for literal sources is incorrect in flags",
|
||||
args: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
flags: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{
|
||||
"key2",
|
||||
},
|
||||
},
|
||||
expectedArgs: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{ // unlikely to happen
|
||||
name: "fails when format for literal sources is incorrect in existing args",
|
||||
args: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
flags: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{
|
||||
"key2=val2",
|
||||
},
|
||||
},
|
||||
expectedArgs: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{
|
||||
name: "fails when literal sources from flags contain more than one =",
|
||||
args: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
flags: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{
|
||||
"key2=val2=val3",
|
||||
},
|
||||
},
|
||||
expectedArgs: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
{ // unlikely to happen
|
||||
name: "fails when literal sources contain more than one = in existing args",
|
||||
args: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1=val3", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
flags: ConfigMapSecretFlagsAndArgs{
|
||||
LiteralSources: []string{
|
||||
"key2=val2",
|
||||
},
|
||||
},
|
||||
expectedArgs: &types.GeneratorArgs{
|
||||
KvPairSources: types.KvPairSources{
|
||||
LiteralSources: []string{"key2=val1=val3", "otherkey=value"},
|
||||
},
|
||||
},
|
||||
wantErr: require.Error,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.wantErr(t, UpdateLiteralSources(tc.args, tc.flags))
|
||||
require.ElementsMatch(t, tc.expectedArgs.LiteralSources, tc.args.LiteralSources)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,9 @@ import (
|
||||
"sigs.k8s.io/kustomize/kyaml/filesys"
|
||||
)
|
||||
|
||||
// DefaultNamespace is the default namespace name in Kubernetes.
|
||||
const DefaultNamespace = "default"
|
||||
|
||||
// GlobPatterns accepts a slice of glob strings and returns the set of
|
||||
// matching file paths.
|
||||
func GlobPatterns(fSys filesys.FileSystem, patterns []string) ([]string, error) {
|
||||
@@ -30,7 +33,7 @@ func GlobPatterns(fSys filesys.FileSystem, patterns []string) ([]string, error)
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// GlobPatterns accepts a slice of glob strings and returns the set of matching file paths.
|
||||
// GlobPatternsWithLoader accepts a slice of glob strings and returns the set of matching file paths.
|
||||
// If validation is skipped, then it will return the patterns as provided.
|
||||
// Otherwise, It will try to load the files from the filesystem.
|
||||
// If files are not found in the filesystem, it will try to load from remote.
|
||||
@@ -109,3 +112,18 @@ func trimQuotes(s string) string {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// NamespaceEqual checks if two namespaces are the same. It considers the empty namespace and the default namespace to
|
||||
// be the same. As such, when one namespace is the empty string ('""') and the other namespace is "default", this function
|
||||
// will return true.
|
||||
func NamespaceEqual(namespace string, otherNamespace string) bool {
|
||||
if "" == namespace {
|
||||
namespace = DefaultNamespace
|
||||
}
|
||||
|
||||
if "" == otherNamespace {
|
||||
otherNamespace = DefaultNamespace
|
||||
}
|
||||
|
||||
return namespace == otherNamespace
|
||||
}
|
||||
|
||||
@@ -86,6 +86,58 @@ func TestGlobPatternsWithLoaderRemoteFile(t *testing.T) {
|
||||
require.Equal(t, invalidURL, resources[0], "incorrect resources")
|
||||
}
|
||||
|
||||
func TestNamespaceEqual(t *testing.T) {
|
||||
testCases := []struct {
|
||||
name string
|
||||
namespace1 string
|
||||
namespace2 string
|
||||
want func(require.TestingT, bool, ...interface{})
|
||||
}{
|
||||
{
|
||||
name: "succeeds when namespaces are the same",
|
||||
namespace1: "ns1",
|
||||
namespace2: "ns1",
|
||||
want: require.True,
|
||||
},
|
||||
{
|
||||
name: "succeeds when namespaces are default and empty string",
|
||||
namespace1: "",
|
||||
namespace2: DefaultNamespace,
|
||||
want: require.True,
|
||||
},
|
||||
{
|
||||
name: "succeeds when namespaces are empty string and default",
|
||||
namespace1: DefaultNamespace,
|
||||
namespace2: "",
|
||||
want: require.True,
|
||||
},
|
||||
{
|
||||
name: "fails when namespaces are not the same",
|
||||
namespace1: "ns1",
|
||||
namespace2: "ns2",
|
||||
want: require.False,
|
||||
},
|
||||
{
|
||||
name: "fails when one is empty and other is different from default",
|
||||
namespace1: "",
|
||||
namespace2: "ns1",
|
||||
want: require.False,
|
||||
},
|
||||
{
|
||||
name: "fails when one is different from default and other is empty",
|
||||
namespace1: "ns1",
|
||||
namespace2: "",
|
||||
want: require.False,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.want(t, NamespaceEqual(tc.namespace1, tc.namespace2))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
type fakeLoader struct {
|
||||
path string
|
||||
}
|
||||
|
||||
@@ -7,11 +7,12 @@ require (
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.8.1
|
||||
golang.org/x/text v0.8.0
|
||||
sigs.k8s.io/kustomize/api v0.14.0
|
||||
sigs.k8s.io/kustomize/cmd/config v0.12.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.15.0
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
|
||||
golang.org/x/text v0.13.0
|
||||
sigs.k8s.io/kustomize/api v0.15.0
|
||||
sigs.k8s.io/kustomize/cmd/config v0.13.0
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0
|
||||
sigs.k8s.io/yaml v1.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -33,11 +34,10 @@ require (
|
||||
github.com/pmezard/go-difflib v1.0.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
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/evanphx/json-patch.v5 v5.6.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20230601164746-7562a1006961 // indirect
|
||||
)
|
||||
|
||||
@@ -66,11 +66,14 @@ 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=
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
||||
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/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
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=
|
||||
@@ -83,8 +86,6 @@ gopkg.in/evanphx/json-patch.v5 v5.6.0 h1:BMT6KIwBD9CaU91PJCZIe46bDmBWa9ynTQgJIOp
|
||||
gopkg.in/evanphx/json-patch.v5 v5.6.0/go.mod h1:/kvTRh1TVm5wuM6OkHxqXtE/1nUZZpihg29RtuIyfvk=
|
||||
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.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=
|
||||
@@ -92,9 +93,9 @@ 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=
|
||||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
|
||||
sigs.k8s.io/kustomize/cmd/config v0.12.0 h1:EXkXg7Bq/wPaEe5sdNbLRI5J6eG+WarKNo5LRD+gCWU=
|
||||
sigs.k8s.io/kustomize/cmd/config v0.12.0/go.mod h1:Ct/f74OFOVCO4KQ8PVGUXHQDjZO6yqwxhrvL/b/DkBM=
|
||||
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/kustomize/cmd/config v0.13.0 h1:Z/bRyFQupMIqGz1KlRkLimK/VjtE4/Oj/DinJmQqTDc=
|
||||
sigs.k8s.io/kustomize/cmd/config v0.13.0/go.mod h1:YlsZ9JysiHN7OjSmIZ17zvq9kl1oN2Osn+3wVyERkcM=
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0 h1:6J33uKSoATlKZH16unr2XOhDI+otoe2sR3M8PDzW3K0=
|
||||
sigs.k8s.io/kustomize/kyaml v0.16.0/go.mod h1:xOK/7i+vmE14N2FdFyugIshB8eF6ALpy7jI87Q2nRh4=
|
||||
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