Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Documentation creates steep learning curve. #601

Copy link
Copy link
Open
@gyennie

Description

@gyennie
Issue body actions

My guess is that most of those who use settle on python as their k8s client are doing so due to python being their dominant language. The clean programming pattern for this client appears to be relying on the structs of each component needed to build request bodies and not combining structs with python dicts to generate requests. There are a lot of structs to choose from. Point being: the pythonic way of implementing the client is not necessarily obvious and users can benefit from documentation that points them to a clean programming pattern.

My request is to break out documentation into a similar format to k8s concepts docs https://kubernetes.io/docs/concepts/ and subtopic the same resources and have tutorials to manage said resources. As an example:

If I were looking to use the python client to create a job programmatically, I could navigate to:

Workloads
        |___Controllers
                    |___ Jobs

Where there is a clean tutorial that can show you how to build a job using only the structs required.

For example, to build the jobs in the k8s documentation https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/

apiVersion: batch/v1
kind: Job
metadata:
  name: pi
spec:
  template:
    spec:
      containers:
      - name: pi
        image: perl
        command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
      restartPolicy: Never
  backoffLimit: 4

The tutorial can show code like so:

from kubernetes import client
container = client.V1Container(name="pi")
container.image = "perl"
container.command = ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
temp_spec = client.V1PodSpec(containers=[container])
temp_spec.restart_policy = "Never"
template = client.V1beta1JobTemplateSpec()
template.spec = temp_spec
spec = client.V1JobSpec(template=template)
spec.backoff_limit = 4
job = client.V1Job()
job.spec = spec
meta = client.V1ObjectMeta()
meta.name = "pi"
job.metadata = meta

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/documentationCategorizes issue or PR as related to documentation.Categorizes issue or PR as related to documentation.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.Indicates that an issue or PR should not be auto-closed due to staleness.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.