-
Notifications
You must be signed in to change notification settings - Fork 71
fix: set-image
with more matching rules
#909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zyy98
wants to merge
10
commits into
kptdev:master
Choose a base branch
from
zyy98:image_extra
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
81d9a73
add more fields in Image, change matching rules, change validate
zyy98 41ff9d1
add more fields in Image, change matching rules, change validate
zyy98 8e1c858
add one more example
zyy98 9d3eea2
change example name
zyy98 4ca936e
validate first, then update
zyy98 91a3022
avoid code duplicate
zyy98 937384c
go-simple fix
zyy98 cac3754
empty resource
zyy98 ee86656
and changes to select local-config
zyy98 b05d482
simplify local-config
zyy98 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
tests/set-image/containerName-mismatch/.expected/diff.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
diff --git a/resources.yaml b/resources.yaml | ||
index f674e0b..ae7d829 100644 | ||
--- a/resources.yaml | ||
+++ b/resources.yaml | ||
@@ -5,6 +5,6 @@ metadata: | ||
spec: | ||
containers: | ||
- name: server | ||
- image: nginx:1.20.2 | ||
+ image: bar:v1.0 | ||
- name: store | ||
- image: nginx:14.1 | ||
\ No newline at end of file | ||
+ image: bar:v1.0 |
19 changes: 19 additions & 0 deletions
19
tests/set-image/containerName-mismatch/.expected/results.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: kpt.dev/v1 | ||
kind: FunctionResultList | ||
metadata: | ||
name: fnresults | ||
exitCode: 0 | ||
items: | ||
- image: gcr.io/kpt-fn/set-image:unstable | ||
exitCode: 0 | ||
results: | ||
- message: container name `server` does not match `store`, only image name matches | ||
severity: warning | ||
resourceRef: | ||
apiVersion: v1 | ||
kind: Pod | ||
name: app1 | ||
file: | ||
path: resources.yaml | ||
- message: 'summary: updated a total of 2 image(s)' | ||
severity: info |
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
apiVersion: kpt.dev/v1 | ||
kind: Kptfile | ||
metadata: | ||
name: example | ||
pipeline: | ||
mutators: | ||
- image: gcr.io/kpt-fn/set-image:unstable | ||
configMap: | ||
imageName: nginx | ||
containerName: server | ||
newName: bar | ||
newTag: v1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: app1 | ||
spec: | ||
containers: | ||
- name: server | ||
image: nginx:1.20.2 | ||
- name: store | ||
image: nginx:14.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: kpt.dev/v1 | ||
kind: FunctionResultList | ||
metadata: | ||
name: fnresults | ||
exitCode: 0 | ||
items: | ||
- image: gcr.io/kpt-fn/set-image:unstable | ||
exitCode: 0 | ||
results: | ||
- message: no input resources | ||
severity: info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.expected |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: kpt.dev/v1 | ||
kind: Kptfile | ||
metadata: | ||
name: example | ||
annotations: | ||
config.kubernetes.io/local-config: "true" | ||
pipeline: | ||
mutators: | ||
- image: gcr.io/kpt-fn/set-image:unstable | ||
configMap: | ||
imageName: nginx | ||
containerName: server | ||
newName: bar | ||
newTag: v1.0 |
Empty file.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/set-image/nonunique-image-with-no-image-name-input/.krmignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.expected |
File renamed without changes.
10 changes: 10 additions & 0 deletions
10
tests/set-image/nonunique-image-with-no-image-name-input/resources.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: app1 | ||
spec: | ||
containers: | ||
- name: server | ||
image: nginx:1.20.2 | ||
- name: store | ||
image: postgres:14.1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest adding it back to the main
Run
method. This part belongs to the main logic so it's better to be replaced in the main functionUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run
method already uses this functiongetContianers
, I have this as a separate function because I feel I need to iterate containers twice, once for validating user input if image name is not provided, once for update container images. To reduce code duplication, I have this function here.