update for pep8
@@ -20,6 +20,7 @@ from kubernetes import client, config
DEPLOYMENT_NAME = "nginx-deployment"
+
def create_deployment_object():
# Instantiate an empty deployment object
deployment = client.ExtensionsV1beta1Deployment()
@@ -44,6 +45,7 @@ def create_deployment_object():
return deployment
+
def create_deployment(api_instance, deployment):
# Create deployement
api_response = api_instance.create_namespaced_deployment(
@@ -51,6 +53,7 @@ def create_deployment(api_instance, deployment):
namespace="default")
print("Deployment created. status='%s'" % str(api_response.status))
+
def update_deployment(api_instance, deployment):
# Update container image
deployment.container.image = "nginx:1.9.1"
@@ -61,6 +64,7 @@ def update_deployment(api_instance, deployment):
body=deployment)
print("Deployment updated. status='%s'" % str(api_response.status))
+
def roll_back_deployment(api_instance):
# Instanciate an empty DeploymentRollback object
rollback = client.ExtensionsV1beta1DeploymentRollback()
@@ -78,6 +82,7 @@ def roll_back_deployment(api_instance):
body=rollback)
print("Deployment rolled back. status='%s'" % str(api_response.status))
+
def delete_deployment(api_instance):
# Delete deployment
api_response = api_instance.delete_namespaced_deployment(
@@ -106,5 +111,6 @@ def main():
delete_deployment(extensions_v1beta1)
+
if __name__ == '__main__':
main()
