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

feat: provisioner idempotence changes #1795

Merged
merged 9 commits into from
Jun 14, 2024
Merged

Conversation

oddgrd
Copy link
Contributor

@oddgrd oddgrd commented Jun 10, 2024

Description of change

This moves resourcestate to common, since the runner will also need it.

How has this been tested? (if applicable)

Tested on my stack.

let state = ResourceState::from_str(value)?;
Ok(state)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Feels like there should be a better way to do this. 🤔 Not a must.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The better way to do it would be to use an enum on Postgres I feel like.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or doesn't https://users.rust-lang.org/t/sqlx-how-to-deserialize-an-enum-value/107215/4 work ? Though it has to be repeated in the query, so not ideal..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll reconsider this as I implement RDS. We could use an enum, I just want to see if we need to add more states in the RDS PR first (I don't expect that, but it doesn't hurt to wait).

@@ -549,6 +550,7 @@ async fn provision(
*bytes = serde_json::to_vec(&ShuttleResourceOutput {
output: new_secrets.clone(),
custom: shuttle_resource.custom,
state: ResourceState::Ready
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might not be worth changing this model on alpha. Consider using a Beta copy of it, but we also have time to re-think how we record resources.

Copy link
Contributor Author

@oddgrd oddgrd Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed I agree that it's not ideal, since the old platform isn't concerned with resourec state, nor is the new runtime, but it's not a breaking change. So I think we can leave it like this, and see if we change it as we iterate on the resources.

Edit: it was a breaking change for new version of c-s with older versions of deployer, so I made it an option to avoid that issue.

let state = ResourceState::from_str(value)?;
Ok(state)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The better way to do it would be to use an enum on Postgres I feel like.

let state = ResourceState::from_str(value)?;
Ok(state)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or doesn't https://users.rust-lang.org/t/sqlx-how-to-deserialize-an-enum-value/107215/4 work ? Though it has to be repeated in the query, so not ideal..

@oddgrd oddgrd merged commit 0de2730 into main Jun 14, 2024
29 of 32 checks passed
@oddgrd oddgrd deleted the feat/provisioning-idempotency branch June 14, 2024 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants