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

Purge Newer Applications Deployed on Rollback #352

Merged
merged 15 commits into from
Sep 1, 2021

Conversation

jonathan-innis
Copy link
Contributor

  • We still need to add purging of dependent applications as it's possible that there are dependencies between the newer applications that are rolled out.
  • Let's discuss how we can handle this scenario

Copy link
Contributor

@nitishm nitishm left a comment

Choose a reason for hiding this comment

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

Check for out-of-bounds if when removing last application in the Remove() function

@nitishm
Copy link
Contributor

nitishm commented Jun 27, 2021

Looks good overall - maybe a few test cases for the Remove() function or rather the getDiff() function would be good.

@jonathan-innis
Copy link
Contributor Author

I'm slightly concerned about this in the context of HelmReleases with dependencies. If we were to purge HelmReleases due to a rollback for things that have dependencies between each other, is it possible that we may end up in a state where something can't be deleted? Would we have to build a reverse dependency graph for this as well? @nitishm any thoughts on this?

@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2021

Codecov Report

Merging #352 (485dcb7) into main (0088d40) will increase coverage by 35.44%.
The diff coverage is 79.23%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #352       +/-   ##
===========================================
+ Coverage   32.55%   68.00%   +35.44%     
===========================================
  Files          13        8        -5     
  Lines         596      350      -246     
===========================================
+ Hits          194      238       +44     
+ Misses        396      104      -292     
- Partials        6        8        +2     
Impacted Files Coverage Δ
pkg/templates/templates.go 65.65% <16.00%> (ø)
pkg/templates/utils.go 50.00% <50.00%> (ø)
pkg/graph/graph.go 95.91% <95.91%> (ø)
pkg/utils/helpers.go 47.61% <100.00%> (+4.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 256ba46...485dcb7. Read the comment docs.

@nitishm
Copy link
Contributor

nitishm commented Jun 28, 2021

I'm slightly concerned about this in the context of HelmReleases with dependencies. If we were to purge HelmReleases due to a rollback for things that have dependencies between each other, is it possible that we may end up in a state where something can't be deleted? Would we have to build a reverse dependency graph for this as well? @nitishm any thoughts on this?

Can you walk me through a scenario? Do you mean deleting a DAG node with child node(s) and parent node(s)?

@jonathan-innis
Copy link
Contributor Author

I'm slightly concerned about this in the context of HelmReleases with dependencies. If we were to purge HelmReleases due to a rollback for things that have dependencies between each other, is it possible that we may end up in a state where something can't be deleted? Would we have to build a reverse dependency graph for this as well? @nitishm any thoughts on this?

Can you walk me through a scenario? Do you mean deleting a DAG node with child node(s) and parent node(s)?

Yes, as in I deploy applications through AppGroup with the following:

Applications
-----
A

Then we deploy the following set of applications in generation 2 with the following dependency structure

Applications
-----
A -> B -> C -> D

This rollout fails on D so we purge everything. However, would it not be possible that C needs B to be present for removal so this purging would fail?

@nitishm
Copy link
Contributor

nitishm commented Jun 28, 2021

Yep it seems like removal should use the reversal DAG as well.

@nitishm
Copy link
Contributor

nitishm commented Jun 28, 2021

app-removal-rollback

Removal Scenarios:

  1. Root Node,
  2. Leaf Node,
  3. Middle Node
  4. DAG (leaf)

Solution:

  • Build reverse DAG
  • Mark applications to be removed in reverse DAG
  • Delete marked applications only following reverse DAG
  • Reapply last successful spec

@jonathan-innis
Copy link
Contributor Author

app-removal-rollback

Removal Scenarios:

  1. Root Node,
  2. Leaf Node,
  3. Middle Node
  4. DAG (leaf)

Solution:

  • Build reverse DAG
  • Mark applications to be removed in reverse DAG
  • Delete marked applications only following reverse DAG
  • Reapply last successful spec

Yep, this is what I was thinking about 😃

@nitishm
Copy link
Contributor

nitishm commented Jun 28, 2021

app-removal-rollback
Removal Scenarios:

  1. Root Node,
  2. Leaf Node,
  3. Middle Node
  4. DAG (leaf)

Solution:

  • Build reverse DAG
  • Mark applications to be removed in reverse DAG
  • Delete marked applications only following reverse DAG
  • Reapply last successful spec

Yep, this is what I was thinking about 😃

Let's try to enhance the existing delete-all using reversal to support this case (i.e delete-all means mark all nodes)

@jonathan-innis jonathan-innis added the bug Something isn't working label Jul 16, 2021
@jonathan-innis jonathan-innis force-pushed the prev-application branch 5 times, most recently from 2362c6f to b0fb13d Compare August 27, 2021 06:18
@jonathan-innis jonathan-innis force-pushed the prev-application branch 3 times, most recently from 8a5bc01 to 9af803b Compare August 28, 2021 19:31
@jonathan-innis jonathan-innis force-pushed the prev-application branch 4 times, most recently from 5cf5cd2 to efdcfe1 Compare August 28, 2021 23:01
@jonathan-innis jonathan-innis marked this pull request as ready for review August 31, 2021 00:03
Copy link
Contributor

@nitishm nitishm left a comment

Choose a reason for hiding this comment

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

🚀 Brilliant stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants