-
Notifications
You must be signed in to change notification settings - Fork 3.4k
#884: Cleanup examples folder #938
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Python Client Examples | ||
|
||
This directory contains various examples how to use the Python client. Please | ||
read the description at the top of each script for more information about what | ||
scottilee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
it does and any prequisite steps. Most scripts also include comments throughout | ||
the code. | ||
|
||
## Setup | ||
scottilee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
These scripts require Python 2.7 or 3.5+ and the Kubernetes client which can be | ||
installed via the directions | ||
scottilee marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
[here](https://github.com/kubernetes-client/python#installation). | ||
|
||
## Contributions | ||
|
||
If you find a problem please file an | ||
[issue](https://github.com/kubernetes-client/python/issues). |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,37 +12,38 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This example use an example CRD from this tutorial: | ||
# https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ | ||
# | ||
# The following yaml manifest has to be applied first: | ||
# | ||
# apiVersion: apiextensions.k8s.io/v1beta1 | ||
# kind: CustomResourceDefinition | ||
# metadata: | ||
# name: crontabs.stable.example.com | ||
# spec: | ||
# group: stable.example.com | ||
# versions: | ||
# - name: v1 | ||
# served: true | ||
# storage: true | ||
# scope: Namespaced | ||
# names: | ||
# plural: crontabs | ||
# singular: crontab | ||
# kind: CronTab | ||
# shortNames: | ||
# - ct | ||
""" | ||
Uses a Custom Resource Definition (CRD) to create a custom object, in this case | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this first sentence needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what you're asking? Let me know if you'd prefer something else. |
||
a CronTab. This example use an example CRD from this tutorial: | ||
https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/ | ||
|
||
The following yaml manifest has to be applied first: | ||
|
||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: crontabs.stable.example.com | ||
spec: | ||
group: stable.example.com | ||
versions: | ||
- name: v1 | ||
served: true | ||
storage: true | ||
scope: Namespaced | ||
names: | ||
plural: crontabs | ||
singular: crontab | ||
kind: CronTab | ||
shortNames: | ||
- ct | ||
""" | ||
|
||
from pprint import pprint | ||
|
||
from kubernetes import client, config | ||
|
||
|
||
def main(): | ||
|
||
config.load_kube_config() | ||
|
||
api = client.CustomObjectsApi() | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.