-
Notifications
You must be signed in to change notification settings - Fork 211
feat: Adds tier attribute to stream processor resource and datasource #3969
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
base: master
Are you sure you want to change the base?
Conversation
750d83e to
64f909b
Compare
|
APIx bot: a message has been sent to Docs Slack channel |
QuiqueSanMongo
left a comment
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.
LGTM!
| startWithOptions.SetTier(plan.Tier.ValueString()) | ||
| } | ||
|
|
||
| _, err := connV2.StreamsApi.StartStreamProcessorWith(ctx, projectID, workspaceOrInstanceName, processorName, startWithOptions).Execute() |
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.
Create function is getting very long, consider extracting some parts into functions
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'll create a follow-up ticket to explore this. I believe we have an existing action item on our end to go through this api flow but I'll reply back here
| }, | ||
| "tier": schema.StringAttribute{ | ||
| Optional: true, | ||
| Computed: true, |
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.
is it Computed, because Atlas will return the value if not provided by client?
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.
Yes that is correct. Today each stream processor has a tier set even without user input. And we have made changes to return the tier. But now the client can provide the tier to override that
| Computed: true, | ||
| MarkdownDescription: "Selected tier for the Stream Processor. Configures Memory / VCPU allowances. Valid options are SP2, SP5, SP10, SP30, and SP50.", | ||
| PlanModifiers: []planmodifier.String{ | ||
| stringplanmodifier.UseStateForUnknown(), |
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.
q: why are we using UseStateForUnknown?
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.
Since this is optional to provide, my thought was that if a user removes the tier from the config, we should not show a plan change. If I have unnecessarily used or missed UseStateForUnknown, I can remove it
For our apis, when a user stops/starts a stream processor, we always use the last tier that the stream processor was running on unless the user explicitly provides an option to override it i.e. we won't go back to the workspace default unless the user explicitly specifies to do so
| }, | ||
| ).Execute() | ||
| startWithOptions := &admin.StreamsStartStreamProcessorWith{} | ||
| if plan.Tier.ValueString() != "" { |
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.
It looks like you're only changing Create, can the attribute be Updated?
If it can't, it should have the customplanmodifier.CreateOnly() plan modifier. With the current implementation, I think that if customer tries to change the tier value, they will get an "inconsistency error" because the updated value won't match the initial value
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.
can the attribute be Updated?
If it can, would also consider how it behaves if a stream processor is configured as started vs stopped when modifying tier.
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.
The attribute can be updated. I had a couple of checks that I updated and added tests for the same. I believe the logic is complete for Create and Update now
|
|
||
| **NOTE** When a Stream Processor is updated without specifying the state, it is stopped and then restored to previous state upon update completion. | ||
| - `stats` (String) The stats associated with the stream processor. Refer to the [MongoDB Atlas Docs](https://www.mongodb.com/docs/atlas/atlas-stream-processing/manage-stream-processor/#view-statistics-of-a-stream-processor) for more information. | ||
| - `tier` (String) Selected tier for the Stream Processor. Configures Memory / VCPU allowances. Valid options are SP2, SP5, SP10, SP30, and SP50. |
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.
can tier change at some moment, e.g. Atlas decides to scale it up/down? Or it'll always have the value that client used to create the processor? (or alternatively the value decided by Atlas if not sent by client in Create)
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.
As of today, the tier cannot change. It is always the value that the client has set.
It is worth noting that in the future, this could not be the case when we add autoscaling. When that happens, the idea is that the flag to allow autoscaling will not be allowed to be used with this defined tier field. But I am still discussing that with the team
|
This PR has gone 7 days without any activity and meets the project’s definition of "stale". This will be auto-closed if there is no new activity over the next 7 days. If the issue is still relevant and active, you can simply comment with a "bump" to keep it open, or add the label "not_stale". Thanks for keeping our repository healthy! |
Description
CLOUDP-359071
This PR does 2 things:
startWithendpoint instead of thestartendpoint. This does not reduce any functionality for the user but allows us to do the next point.tierattribute for the stremprocessor resource and datasource. This attribute can be used to start a stream processor on a given tier rather than forcing the processor to default to the workspace settingType of change:
Required Checklist:
Further comments