https://blueprints.launchpad.net/karbor/+spec/kubernetes-pods-protection-plugin
With the rapid development of cloud computing, there is a trend of explosive growth in cloud data over recent years. Cloud data backup and recovery has become an urgent topic which the customers concern. Running Kubernetes on OpenStack becames more and more popular. The data protection of the application on Kubernetes also need be considered.
In this spec we would like to introduce a plugin in Karbor to protect your application deployed in Kubernetes which runs on top of OpenStack. The application data protected by Karbor include the configurations and metadata in etcd service, and the persistent volume provided by Cinder.
The kubernetes cluster can run on openstack instances using Openstack cloud provider, the pods can be created with persistent volumes provided by Cinder. This bp adds kubernetes pods with persistent volumes protection plugin in Karbor.
A new protectable plugin about The kubernetes pod need be implemented. The type of resource the kubernetes pod is “OS::Kubernetes::Pod”. It will be added to the constant RESOURCE_TYPES in Karbor.
The parent resource types: PROJECT_RESOURCE_TYPE
list the resources:
This interface of plugin will call the ‘list_pod_for_all_namespaces’ API method in the kubernetes python client[1].
show the resource:
This interface of plugin will call the ‘read_namespaced_pod’ method API method in the kubernetes python client. The parameter is a pod id.
get dependent resources:
The parameter parent_resource is a project, this interface of plugin will return the kubernetes pod in this project.
Add a new parent resource types: “OS::Kubernetes::Pod”
get dependent resources:
The parameter parent_resource is a kubernetes pod, this interface of plugin will return the persistent volumes list provided by Cinder in the this parent resource pod.
A new protection plugin about the kubernetes pod need be implemented.
Protect Operation: The configurations and metadata in etcd service about the pod will be saved to the bank of Karbor.
Restore Operation: The persistent volumes of the pod will be restored by Cinder Volume plugins.
Get the configurations and metadata in etcd service about the pod from bank, and create a new pod with restored persistent volumes from cinder in the kubernetes cluster.
Delete Operation:
The configurations and metadata about the pod will be deleted from the bank. The backup data of persistent volumes will be deleted from Cinder.
OPTIONS_SCHEMA = {
"title": "The kubernetes pod Protection Options",
"type": "object",
"properties": {
"backup_name": {
"type": "string",
"title": "Backup Name",
"description": "The name of the kubernetes pod backup."
},
"description": {
"type": "string",
"title": "Description",
"description": "The description of the kubernetes pod backup."
}
},
"required": ["backup_name", "description"]
}
RESTORE_SCHEMA = {
"title": "The kubernetes pod Protection Restore",
"type": "object",
"properties": {
"restore_name": {
"type": "string",
"title": "Restore Name",
"description": "The name of the restored kubernetes pod.",
"default": None
},
"restore_description": {
"type": "string",
"title": "Restore Description",
"description": "The description of the restored kubernetes pod.",
"default": None
}
}
}
None
None
None
None
None
None
None
Add the kubernetes pod protection plugin endpoint to setup.cfg. Add the kubernetes pod protection plugin configuration to provider file.
None
None
Unit tests in Karbor.
Add a usage example about kubernetes pod protection.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.