★ wanayoo — archive 1999 https://github.com/kubernetes-client/python/pull/345Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add examples of deployment object #345

Merged
merged 6 commits into from Oct 18, 2017
Merged

Conversation

@DjangoPeng
Copy link
Contributor

DjangoPeng commented Sep 24, 2017 •

Add 4 examples of deployment object, including:

  1. Create deployment object with client-python API
  2. Create deployment
  3. Update deployment
  4. Cascading delete deployment

@mbohlool Please check the PR. Refer this issue

@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Sep 26, 2017

Ping @mbohlool .I have updated the code style for PEP8. Now, it's ready to be reviewed.

# Update container image
deployment.container.image = "nginx:1.9.1"
# Update the deployment
api_response = api_instance.replace_namespaced_deployment(

This comment has been minimized.

@mbohlool

mbohlool Sep 27, 2017

Member

I suggest you use patch_namespaced_deployment here as it is the recommended way to update an API object. Replace can have unintentional consequences.

This comment has been minimized.

@DjangoPeng

DjangoPeng Sep 27, 2017

Author Contributor

Good suggestion.

@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Sep 27, 2017

@mbohlool Updated. Plz review.

@mbohlool
Copy link
Member

mbohlool commented Sep 28, 2017 •

Have you actually tried this code? specially the patch that you just changed? I just want to make sure it is working for you before merging it into master. I will see if I can give it a try tomorrow.

@mbohlool
Copy link
Member

mbohlool commented Oct 11, 2017

@DjangoPeng I tried these examples and they gave me syntax errors. That could be because of the new client generation. Can you please take a look at them and make sure that they can be run?

@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Oct 12, 2017

@mbohlool I have fixed the error and tested all examples by myself. Please review and check.

@mbohlool
Copy link
Member

mbohlool commented Oct 12, 2017

@DjangoPeng The branch is out of date. The new client has some differences (like you need to provide required fields on model creation, etc.). Please rebase to master and run the examples again. An example failure I get:

ValueError: Invalid value for `template`, must not be `None`
@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Oct 13, 2017

@mbohlool Ok, I'll test it today .

@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Oct 13, 2017 •

I run all examples on Kubernetes 1.7 with client-python 3.0, and I attached the stdout as below. It looks like all is well. Should I try it on Kubernetes 1.8, or what?

$ python deployment_examples.py
Deployment created. status='{'available_replicas': None,
 'collision_count': None,
 'conditions': None,
 'observed_generation': None,
 'ready_replicas': None,
 'replicas': None,
 'unavailable_replicas': None,
 'updated_replicas': None}'
Deployment updated. status='{'available_replicas': None,
 'collision_count': None,
 'conditions': [{'last_transition_time': datetime.datetime(2017, 10, 13, 1, 30, 1, tzinfo=tzutc()),
                 'last_update_time': datetime.datetime(2017, 10, 13, 1, 30, 1, tzinfo=tzutc()),
                 'message': 'Deployment does not have minimum availability.',
                 'reason': 'MinimumReplicasUnavailable',
                 'status': 'False',
                 'type': 'Available'}],
 'observed_generation': 1,
 'ready_replicas': None,
 'replicas': None,
 'unavailable_replicas': 3,
 'updated_replicas': None}'
Deployment deleted. status='{u'observedGeneration': 1, u'unavailableReplicas': 3, u'conditions': [{u'status': u'False', u'lastUpdateTime': u'2017-10-13T01:30:01Z', u'lastTransitionTime': u'2017-10-13T01:30:01Z', u'reason': u'MinimumReplicasUnavailable', u'message': u'Deployment does not have minimum availability.', u'type': u'Available'}]}'
@mbohlool
Copy link
Member

mbohlool commented Oct 13, 2017

Use master. You can goto root folder of repo and call python -m examples.deploment_examples. just make sure you rebase to the latest code.

@k8s-ci-robot k8s-ci-robot added size/M and removed size/L labels Oct 13, 2017
@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Oct 13, 2017

@mbohlool Now, it works on latest master branch. I delete the rollback example because there is a error that I'm debugging and identifying. When I solve it, I'll make a new PR to append the rollback example.

@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Oct 18, 2017

@mbohlool Please review the PR. I think it's ready to be merged.

@mbohlool
Copy link
Member

mbohlool commented Oct 18, 2017 •

@DjangoPeng Thanks. Great work.

@mbohlool mbohlool merged commit 8665a76 into kubernetes-client:master Oct 18, 2017
2 checks passed
2 checks passed
cla/linuxfoundation DjangoPeng authorized
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@DjangoPeng
Copy link
Contributor Author

DjangoPeng commented Oct 19, 2017 •

I have updated the description of the PR. Welcome to append the rollback example of Deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.