Added additional examples#898
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ratanboddu The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/assign @roycaihw |
roycaihw
left a comment
There was a problem hiding this comment.
Thanks for contributing! I think the examples will be super helpful. I went through half of them and left some comments.
Since these examples are standalone, could you split this PR into smaller pieces (maybe 2~3 PRs, each containing a couple of exampels), which will be easier to review and keep track of?
| @@ -0,0 +1,45 @@ | |||
| # Copyright 2016 The Kubernetes Authors. | |||
| name="kube-client-test" | ||
| ) | ||
| ) | ||
| ) |
There was a problem hiding this comment.
the indentation looks weird. I'm surprised that pycodestyle doesn't catch this
| ) | ||
|
|
||
| # Listing pods in the namespace that we created | ||
| list_namespaces = v1.list_namespaced_pod("kube-client") |
There was a problem hiding this comment.
the namespace being queried is different from the namespace you just created before kube-client-test
| i.status.pod_ip, | ||
| i.metadata.namespace, | ||
| i.metadata.name) | ||
| ) |
There was a problem hiding this comment.
for a new namespace there will be no pod in it. I don't think printing pod information will show meaningful information. Maybe just GET the namespace above instead?
| # Fetching and loading Kubernetes Information | ||
| config.load_kube_config() | ||
| # For incluster details | ||
| # config.incluster_kube_config() |
| extension = client.ExtensionsV1beta1Api() | ||
|
|
||
| body = client.ExtensionsV1beta1Ingress( | ||
| api_version="v1beta1", |
There was a problem hiding this comment.
missing api group in api_version field
| ) | ||
|
|
||
| extension.create_namespaced_ingress( | ||
| namespace="kube-client", |
There was a problem hiding this comment.
this requires the kube-client namespace to be created first. I'd suggest using the default namespace for a standalone example (also in the other files)
| # For incluster details | ||
| # config.incluster_kube_config() | ||
|
|
||
| extension = client.BatchV1Api() |
There was a problem hiding this comment.
name the api object corresponding to the api being used, e.g. batch_v1
| # Container | ||
| container = client.V1Container( | ||
| name="jobtest", | ||
| image="nginx:1.7.9", |
There was a problem hiding this comment.
running nginx doesn't sound like a good use case for job to me
| extension.create_namespaced_job( | ||
| namespace="kube-client", | ||
| body=job | ||
| ) |
There was a problem hiding this comment.
will the example print some information showing the job succeeded?
I'd suggest creating the job template in the official doc and print the pod logs. I have a snippet written for the first step already #872 (comment)
As suggested I've raised a PR for creating an Ingress #933 and will create more PR's for the remaining examples in the coming days |
|
@ratanboddu can you close this PR since you are splitting it out into other PRs? |
|
@roycaihw I still could not figure out the secret like docker secret. How do you pass the docker secret to authenticate the job to download from docker hub? |
Added the following examples :
-Ramped
-Recreate