browsertrix/backend/btrixcloud/migrations/migration_0029_remove_workflow_configmaps.py
Ilya Kreymer 3cd52342a7
Remove Crawl Workflow Configmaps (#1894)
Fixes #1893 

- Removes crawl workflow-scoped configmaps, and replaces with operator-controlled
per-crawl configmaps that only contain the json config passed to Browsertrix
Crawler (as a volume).
- Other configmap settings replaced are replaced the custom CrawlJob options
(mostly already were, just added profile_filename and storage_filename)
- Cron jobs also updated to create CrawlJob without relying on configmaps,
querying the db for additional settings.
- The `userid` associated with cron jobs is set to the user that last modified
 the schedule of the crawl, rather than whomever last modified the workflow
- Various functions that deal with updating configmaps have been removed,
including in migrations.
- New migration 0029 added to remove all crawl workflow configmaps
2024-06-28 15:25:23 -07:00

25 lines
674 B
Python

"""
Migration 0028 - Page files and errors
"""
from btrixcloud.migrations import BaseMigration
from btrixcloud.crawlmanager import CrawlManager
MIGRATION_VERSION = "0029"
class Migration(BaseMigration):
"""Migration class."""
# pylint: disable=unused-argument
def __init__(self, mdb, **kwargs):
super().__init__(mdb, migration_version=MIGRATION_VERSION)
async def migrate_up(self):
"""delete all workflow-scoped configmaps"""
crawl_manager = CrawlManager()
await crawl_manager.core_api.delete_collection_namespaced_config_map(
namespace=crawl_manager.namespace, label_selector="btrix.crawlconfig"
)