Skip to content

Commit

Permalink
Merge pull request kubernetes-client#1155 from MoShitrit/fix-issue-967
Browse files Browse the repository at this point in the history
Update Examples to stop using deprecated versions
  • Loading branch information
k8s-ci-robot authored May 12, 2020
2 parents d63282e + 6e62c3d commit cef5e9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 75 deletions.
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

0 comments on commit cef5e9b

Please sign in to comment.