Skip to content

Instantly share code, notes, and snippets.

@denismakogon
Last active December 23, 2015 04:29
Show Gist options
  • Save denismakogon/6580664 to your computer and use it in GitHub Desktop.
Save denismakogon/6580664 to your computer and use it in GitHub Desktop.
Cluster API implemenation
Create cluster call
- Define specific stuff for each instance: security group/ruls, dns entry, floating IP etc.
- Connect node group into common network (VLAN, tunneling, flat network)
- Spin-up guestagent on each instance.
- Check statuses of each instance. Generate cluster status.
- Verify by updating cluster status at DВ.
List clusters call
- Collect clusters.
- Lookup over cluster nodes.
- Collect list of IDs
-------------------------------------------------------------
Detailed list cluster call
- Collect clusters.
- Lookup over cluster nodes.
- Retrieve instances information.
- Collect instance specific info.
-------------------------------------------------------------
* info could be defined by passing a dict of instance object attributes
** this could be the same function. Just pass flag detailed=True/False
Drop instance
- Lookup for cluster.
- Lookup for instance.
- Check permissions for minimum nodes.
- If permissions allows to drop, than do. Update status at DB.
- Perform cluster lookup, redefine group of instances. **
-------------------------------------------------------------
* this function could drop more than one instance at the same time,
if each drop process will be wrapped into single thread, just another task-to-do
** This mechanism is custom for each service engine
Add instance to cluster/replication
- Spin-up instance.
- Connect instance to cluster network
- Mark instance with cluster ID.
- Update clusters meta-data with new instance ID.
- Update cluster(next steps are based on implementation) **
- Verify statuses.
-------------------------------------------------------------
** This mechanism is custom for each service engine
Promotion
- If cluster type allows to do that.
- If no master.
- Update cluster.**
- Spin-up cluster.
- Verify statuses.
-------------------------------------------------------------
** This mechanism is custom for each service engine
Restart
- If cluster exists
- If status is not Busy/Error/Building etc.
- If each of nodes are not busy.
- Do restart of each instance.
- Collect statuses.
- Verify cluster status.
Backup cluster
- If cluster exists.
- Discover instances.
- Mark cluster with Busy status.
- Do async backup of each instance.
- Create cluster backup DB entry.
- Verify backup statuses.
Restore cluster from backup
- If backup.
- If backup of each instance.
- If new cluster size is the same as in backup.
- Create each instance from backup.
- Verify statuses.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment