-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[address #4717] Re-do create template/metadata when using includeTemplates if not present #4805
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
662ccf1
add test for resources with no template
aibarbetta 4dcc040
create template/metadata in includeTemplates if not present
aibarbetta e2196d9
separate template specific field specs and use in includeTemplates
aibarbetta 344b257
add tests for other kinds
aibarbetta 2b9ef61
error wraps for linter
aibarbetta c750c00
use fmt instead of errors
aibarbetta eb1529b
use %w to format errors
aibarbetta acba8ff
Update api/krusty/inlinelabels_test.go
aibarbetta d14dfb6
Use WrapPrefixf
aibarbetta 7b84613
Use fewer labels to ease reading
aibarbetta 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 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 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 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 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 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,51 @@ | ||
// Copyright 2019 The Kubernetes Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package builtinpluginconsts | ||
|
||
const metadataLabelsFieldSpecs = ` | ||
- path: metadata/labels | ||
create: true | ||
|
||
- path: spec/template/metadata/labels | ||
create: true | ||
version: v1 | ||
kind: ReplicationController | ||
|
||
- path: spec/template/metadata/labels | ||
create: true | ||
kind: Deployment | ||
|
||
- path: spec/template/metadata/labels | ||
create: true | ||
kind: ReplicaSet | ||
|
||
- path: spec/template/metadata/labels | ||
create: true | ||
kind: DaemonSet | ||
|
||
- path: spec/template/metadata/labels | ||
create: true | ||
group: apps | ||
kind: StatefulSet | ||
|
||
- path: spec/volumeClaimTemplates[]/metadata/labels | ||
create: true | ||
group: apps | ||
kind: StatefulSet | ||
|
||
- path: spec/template/metadata/labels | ||
create: true | ||
group: batch | ||
kind: Job | ||
|
||
- path: spec/jobTemplate/metadata/labels | ||
create: true | ||
group: batch | ||
kind: CronJob | ||
|
||
- path: spec/jobTemplate/spec/template/metadata/labels | ||
create: true | ||
group: batch | ||
kind: CronJob | ||
` |
This file contains 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,8 @@ | ||
// Copyright 2019 The Kubernetes Authors. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package builtinpluginconsts | ||
|
||
const templateLabelFieldSpecs = ` | ||
templateLabels: | ||
` + metadataLabelsFieldSpecs |
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.
"github.com/pkg/errors"
looks like an already unmaintained and archived.Could you think of using
fmt.Errorf()
instead oferrors.Wrap()
if you don't have any reason?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.
done! thanks for making me aware of that
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.
FYI the other errors package we often use in Kustomize is our own "sigs.k8s.io/kustomize/kyaml/errors", which provides
errors.WrapPrefixf(err, msg, args...)
for situations like these. We have plenty offmt.Errorf
usage as well though, so I don't feel strongly about this.