How cdsl-research/roll-update works
Project Type & Purpose
• This repository is a specialized tool for managing rolling updates on a WordPress application deployed in a Kubernetes (k3s) environment.
• It contains YAML configuration files that define the desired state for WordPress and its MySQL backing service, plus Python scripts that automate the update process (switching image versions and triggering a rollout).
File Structure
• The top-level files include:
• README.md (documentation)
• kustomization.yaml, mysql-deployment.yaml, wordpress-deployment.yaml (Kubernetes configuration files)
• rollupdate_611_631.py and rollupdate_621_631.py (Python scripts for updating from different source versions to 6.3.1)
• This file organization suggests separation between configuration (declarative YAML) and operational automation/business logic (Python scripts).
Key Components
a. External Actor (Operator/User):
• Initiates the rolling update by executing one of the Python scripts.
b. Python Update Controller:
• Contains the logic to delete existing WordPress and MySQL deployments, prompt for inputs (replicas, maxSurge, maxUnavailable), and invoke Kubernetes CLI (kubectl) commands.
• Two versions of the script (rollupdate_611_631.py and rollupdate_621_631.py) indicate variant handling for different starting versions.
c. Kubernetes Cluster (k3s Environment):
• Namespace “roll” where the deployments are applied.
• Two main deployments:
• WordPress Deployment: Managed via wordpress-deployment.yaml – its image tag is updated from an earlier version (6.1.1 or 6.2.1) to 6.3.1.
• MySQL Deployment: Configured by mysql-deployment.yaml.
• Additional YAML file: kustomization.yaml helps in applying and managing these resources in Kubernetes.
d. Rolling Update Process:
• Flow steps:
1. Deletion stage: The scripts first issue commands to delete existing WordPress and MySQL deployments and pods.
2. Deployment stage: The initial deployment is re-applied with the current version.
3. Update stage: The YAML file is edited (changing the image version) to trigger a rolling update.
4. Monitoring stage: The outcome (time taken, CPU usage) is recorded and output.