-
Notifications
You must be signed in to change notification settings - Fork 115
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
Support for metadata.generateName (CSA) #2594
Conversation
Does the PR have any schema changes?Looking good! No breaking changes found. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #2594 +/- ##
==========================================
- Coverage 23.41% 23.30% -0.12%
==========================================
Files 48 48
Lines 9629 9679 +50
==========================================
+ Hits 2255 2256 +1
- Misses 7224 7272 +48
- Partials 150 151 +1 ☔ View full report in Codecov by Sentry. |
@lblackstone could you give me some feedback on this PR? Two aspects of note:
|
|
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.
I think these changes generally look ok, but with the caveats about possible behavior changes I mentioned earlier. The await code has been mostly stable for 3+ years, and is a core part of many resource updates, so this is an area to tread carefully. Particular testing care is needed for preview differences with computed inputs, and for resources that change between static names and the auto-named varieties.
This comment was marked as outdated.
This comment was marked as outdated.
disallow generateName for SSA and for yaml mode. use resource name rather than object name in certain error messages.
02f8c0b
to
db4891f
Compare
allow implicit to explicit name specification.
@@ -0,0 +1,36 @@ | |||
// Copyright 2016-2019, Pulumi Corporation. |
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.
nit: outdated copyright
@@ -301,19 +301,19 @@ func untilAppsDeploymentDeleted(config deleteAwaitConfig) error { | |||
specReplicas, _ := deploymentSpecReplicas(d) | |||
|
|||
return watcher.RetryableError( | |||
fmt.Errorf("deployment %q still exists (%d / %d replicas exist)", config.currentInputs.GetName(), | |||
fmt.Errorf("deployment %q still exists (%d / %d replicas exist)", d.GetName(), |
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.
Should we introduce a new method for our config structs that returns the name of the deployment object? This refactor would make it less error-prone when deciding on the deployment name to use, and will make it easier in the future should we decide on a different strategy for the deployment name (say, reverting back to using inputs).
if newObj.GetName() == "" && IsAutonamed(oldObj) { | ||
contract.Assertf(oldObj.GetName() != "", "expected nonempty name for object: %s", oldObj) |
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.
Incorrect formatting here? The unstructured object won't be nicely formatted into a string. Should the resource URN be printed here instead?
Closing this PR in favor of: |
Proposed changes
Closes #2539
This PR implements support for
.metadata.generateName
in CSA mode, based on #2790..metadata.generateName
to be a variant of auto-naming. Pulumi will not assign an auto-name to a new resource that hasgenerateName
, and upon delete will use the replace-then-delete technique.Tests
A new integration test is provided to test the use of
metadata.generateName
. It tests creation, update, replacement, and promotion from.generateName
to.name
. (ref)The existing autonaming test is enhanced to test how autonaming takes precedence over generateName, in the update case. This is to ensure backwards compatibility, e.g. in the edge case that an existing object has a
generateName
field (which Pulumi ignored until now). (ref)Related issues (optional)