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

add pending_cluster_management status for embedded clusters #4461

Merged
merged 5 commits into from Feb 22, 2024

Conversation

cbodonnell
Copy link
Member

What this PR does / why we need it:

This PR adds a new version status pending_cluster_management for embedded clusters to represent the state during an initial install when the user must confirm their cluster management settings. All embedded cluster installs will have the initial version set to this state prior to completing the cluster management step. Once that step is completed, the version status will either be set to pending_config, pending_preflight, or pending, depending on whether or not there is any app configuration or preflights defined.

This fixes an issue where an application without required configuration would automatically deploy in embedded clusters, which was not the desired behavior.

Which issue(s) this PR fixes:

https://app.shortcut.com/replicated/story/99681/disable-autodeploy

Special notes for your reviewer:

Steps to reproduce

Does this PR introduce a user-facing change?


Does this PR require documentation?

@cbodonnell cbodonnell added type::bug Something isn't working bug::normal labels Feb 21, 2024
}
pendingVersion := downstreamVersions.PendingVersions[0]

if pendingVersion.Status == storetypes.VersionPendingClusterManagement {
Copy link
Member

Choose a reason for hiding this comment

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

what do you think if we return an error if the version status is something different?

Copy link
Member Author

Choose a reason for hiding this comment

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

added 400 response as this endpoint should not be called if the version is not pending_cluster_management

return
}

downstreamVersionStatus := storetypes.VersionPending
Copy link
Member

Choose a reason for hiding this comment

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

is there any possibility to make this a shared function/logic instead of duplicating this code?

Copy link
Member Author

Choose a reason for hiding this comment

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

we may be able to pull out this snippet into a function to getDownstreamStatus or something: https://github.com/replicatedhq/kots/blob/cbo/sc-99681/dont-auto-deploy-in-embedded-cluster/pkg/store/kotsstore/version_store.go#L621-L639

the logic is more complex for the non-embedded scenario since you can also skip preflights. i'll see what it would look like

@@ -337,15 +337,15 @@ function AppDetailPage(props: Props) {
const firstVersion = downstream.pendingVersions.find(
(version: Version) => version?.sequence === 0
);
if (firstVersion?.status === "unknown" && props.isEmbeddedCluster) {
if (
Copy link
Member

Choose a reason for hiding this comment

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

would this ever be unknown now?

Copy link
Member Author

Choose a reason for hiding this comment

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

i think we could remove that. probably left over from an early implementation?

@@ -360,6 +362,50 @@ const EmbeddedClusterManagement = ({
}, [nodesData?.nodes?.toString()]);
// #endregion

const onContinueClick = async () => {
const res = await fetch(
`${process.env.API_ENDPOINT}/embedded-cluster/confirm`,
Copy link
Member

Choose a reason for hiding this comment

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

this route name seems ambiguous or generic. not sure what's a better name though...

Copy link
Member Author

Choose a reason for hiding this comment

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

/embedded-cluster/management?

@cbodonnell cbodonnell merged commit dce1244 into main Feb 22, 2024
104 checks passed
@cbodonnell cbodonnell deleted the cbo/sc-99681/dont-auto-deploy-in-embedded-cluster branch February 22, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug::normal type::bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants