Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update Examples to stop using deprecated versions #1155

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

Merged
merged 2 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 6 additions & 72 deletions examples/notebooks/create_deployment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"outputs": [],
"source": [
"config.load_kube_config()\n",
"apps_api = client.AppsV1beta1Api()"
"apps_api = client.AppsV1Api()"
]
},
{
Expand All @@ -70,7 +70,7 @@
},
"outputs": [],
"source": [
"deployment = client.AppsV1beta1Deployment()"
"deployment = client.V1Deployment()"
]
},
{
Expand All @@ -93,7 +93,7 @@
},
"outputs": [],
"source": [
"deployment.api_version = \"apps/v1beta1\"\n",
"deployment.api_version = \"apps/v1\"\n",
"deployment.kind = \"Deployment\"\n",
"deployment.metadata = client.V1ObjectMeta(name=\"nginx-deployment\")"
]
Expand All @@ -118,7 +118,7 @@
},
"outputs": [],
"source": [
"spec = client.AppsV1beta1DeploymentSpec()\n",
"spec = client.V1DeploymentSpec()\n",
"spec.replicas = 3"
]
},
Expand Down Expand Up @@ -258,62 +258,7 @@
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Create DeploymentRollback object\n",
"This object is used to rollback to a previous version of the deployment."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"rollback = client.AppsV1beta1DeploymentRollback()\n",
"rollback.api_version = \"apps/v1beta1\"\n",
"rollback.kind = \"DeploymentRollback\"\n",
"rollback.rollback_to = client.AppsV1beta1RollbackConfig()\n",
"rollback.rollback_to.revision = 0\n",
"rollback.name = \"nginx-deployment\""
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"source": [
"### Execute RollBack"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"extension.create_namespaced_deployment_rollback_rollback(name=\"nginx-deployment\", namespace=\"default\", body=rollback)"
]
},
{
"cell_type": "markdown",
"metadata": {
"deletable": true,
"editable": true
},
"metadata": {},
"source": [
"### Delete Deployment"
]
Expand All @@ -328,19 +273,8 @@
},
"outputs": [],
"source": [
"extension.delete_namespaced_deployment(name=\"nginx-deployment\", namespace=\"default\", body=client.V1DeleteOptions(propagation_policy=\"Foreground\", grace_period_seconds=5))"
"apps_api.delete_namespaced_deployment(name=\"nginx-deployment\", namespace=\"default\", body=client.V1DeleteOptions(propagation_policy=\"Foreground\", grace_period_seconds=5))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
6 changes: 3 additions & 3 deletions examples/notebooks/intro_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
},
"outputs": [],
"source": [
"api_instance = client.AppsV1beta1Api()\n",
"dep = client.AppsV1beta1Deployment()\n",
"spec = client.AppsV1beta1DeploymentSpec()"
"api_instance = client.AppsV1Api()\n",
"dep = client.V1Deployment()\n",
"spec = client.V1DeploymentSpec()"
]
},
{
Expand Down