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

[patch] Move MAS instance Mongo data wipe job to sync-jobs application #176

Merged
merged 22 commits into from
Jul 31, 2024

Conversation

tomklapiscak
Copy link
Contributor

@tomklapiscak tomklapiscak commented Jul 26, 2024

https://jsw.ibm.com/browse/MASCORE-3100

The PostDelete annotated secret necessary for running this Job in the mongocfg application was causing deprovisioning to hang due to a known issue in ArgoCD.

The approach we've taken for PostDelete jobs that depend on other resources (e.g. secrets) is to move them to the sync-jobs application. This has a supporting application sync-res that contains the secret needed by this job. Since sync-res is in an earlier syncwave than sync-jobs, the resources will persist until after any PostDelete hooks in sync-jobs have completed.

This approach seemed appropriate here. In fact, the existing PostDelete-aws-docdb-remove-user_Job seems like a good fit for performing the mongo data wipe.

The PR also fixes an additional issue in PostDelete-aws-docdb-remove-user_Job where only the first Mongo host was being passed into the aws_documentdb_user role. If this host did not happen to be the primary, the role would fail to execute. With these changes, all known hosts are passed to the role.

NOTE: The code in this PR is built on top of the mascore3340 branch (since I wanted to test everything together in a single deployment). This PR currently targets mascore3340. mascore3340 should be merged into master first, then this PR should be updated to target master before being merged.

Supporting changes to the CLI are here: ibm-mas/cli#1144

Testing

  • Verify mongocfg application can now be successfully pruned
  • Verify the new logic in PostDelete-aws-docdb-remove-user_Job works as expected (need an AWS env for this)
  • Verify ArgoCD can apply these changes over a 2.0.0 instance smoothly

Verified new job logic in fvtsaas. On deleting mas-instance-base.yaml from the gitops repo, the postdelete hook runs:
image
and completes successfully:
image

Example job logs: https://ibm.box.com/s/250l1o4pfx1xzpg2uwpmh5lsx4ufthhz

Tom Klapiscak added 18 commits July 25, 2024 16:48
This means ArgoCD will not delete the namespace when the application is deleted. This is the safer option, but it does mean that the namespace will have to be cleaned up manually.

MASCORE-3303
This reverts commit 6b8a29e.
…ng to move this logic to the sync-jobs application instead)
…attempting to remove the MAS user

This ensures that the role has access to the primary host.

This was copied from the existing add-user_Job which already did this.
@tomklapiscak tomklapiscak marked this pull request as draft July 26, 2024 16:54
@tomklapiscak tomklapiscak changed the title [patch] MAS instance Mongo data wipe job to sync-jobs application [patch] Move MAS instance Mongo data wipe job to sync-jobs application Jul 26, 2024
@tomklapiscak tomklapiscak changed the base branch from mascore3340 to dev July 31, 2024 17:26
@tomklapiscak tomklapiscak marked this pull request as ready for review July 31, 2024 17:29
@tomklapiscak tomklapiscak merged commit ce312c6 into dev Jul 31, 2024
3 checks passed
@tomklapiscak tomklapiscak deleted the mascore3100 branch July 31, 2024 17:56
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.

1 participant