Skip to content
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

Change error to warning if internal autoname annotation is set #1337

Merged
merged 2 commits into from
Oct 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

- Update Helm v3 mod to v3.3.2 (https://github.com/pulumi/pulumi-kubernetes/pull/1326)
- Update Helm v3 mod to v3.3.3 (https://github.com/pulumi/pulumi-kubernetes/pull/1328)
- Change error to warning if internal autoname annotation is set (https://github.com/pulumi/pulumi-kubernetes/pull/1337)

## 2.6.1 (September 16, 2020)

Expand Down
15 changes: 9 additions & 6 deletions provider/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,15 @@ func (k *kubeProvider) Check(ctx context.Context, req *pulumirpc.CheckRequest) (

var failures []*pulumirpc.CheckFailure

// If annotations with a reserved internal prefix exist, report that as error.
for k := range newInputs.GetAnnotations() {
if metadata.IsInternalAnnotation(k) {
failures = append(failures, &pulumirpc.CheckFailure{
Reason: fmt.Sprintf("invalid use of reserved internal annotation %q", k),
})
// If annotations with a reserved internal prefix exist, ignore them by removing the key from the input.
for key := range newInputs.GetAnnotations() {
if metadata.IsInternalAnnotation(key) {
_ = k.host.Log(ctx, diag.Warning, urn,
fmt.Sprintf("ignoring user-specified value for internal annotation %q", key))
metadataRaw := newInputs.Object["metadata"]
if metadataMap, ok := metadataRaw.(map[string]interface{}); ok {
delete(metadataMap, key)
}
}
}

Expand Down