Skip to content

Commit

Permalink
fix syntax error
Browse files Browse the repository at this point in the history
  • Loading branch information
DjangoPeng committed Oct 12, 2017
1 parent 6c7235d commit 24435a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/deployment_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create_deployment_object():
container = client.V1Container()
container.name = "nginx"
container.image = "nginx:1.7.9"
contianer.ports = [client.V1containerPort(container_port=80)]
container.ports = [client.V1ContainerPort(container_port=80)]
spec.template.spec.containers = [container]
# Assign spec section into deployment.spec
deployment.spec = spec
Expand All @@ -56,7 +56,7 @@ def create_deployment(api_instance, deployment):

def update_deployment(api_instance, deployment):
# Update container image
deployment.container.image = "nginx:1.9.1"
deployment.spec.template.spec.containers[0].image = "nginx:1.9.1"
# Update the deployment
api_response = api_instance.patch_namespaced_deployment(
name=DEPLOYMENT_NAME,
Expand All @@ -80,15 +80,14 @@ def roll_back_deployment(api_instance):
name=DEPLOYMENT_NAME,
namespace="default",
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(
name=DEPLOYMENT_NAME,
namespace="default",
client.V1DeleteOptions(propagation_policy='Foreground',
body=client.V1DeleteOptions(propagation_policy='Foreground',
grace_period_seconds=5))
print("Deployment deleted. status='%s'" % str(api_response.status))

Expand Down

0 comments on commit 24435a5

Please sign in to comment.