Skip to content
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

Utility functions to generate common resources #142

Open
jacobtomlinson opened this issue Aug 25, 2023 · 0 comments
Open

Utility functions to generate common resources #142

jacobtomlinson opened this issue Aug 25, 2023 · 0 comments
Labels
enhancement New feature or request idea

Comments

@jacobtomlinson
Copy link
Member

Which project are you requesting an enhancement for?

kr8s

What do you need?

This comment dask/dask-kubernetes#805 (comment) got me thinking. Could/should we provide some utility functions that generate resources using sensible defaults?

The goal would be that for the 90% of resources that follow a standard convention can we auto-generate that?

E.g could we have something like this

from kr8s import gen_pod
pod = gen_pod(name="nginx", image="nginx:stable", ports=[80])

# which is equivalent to

from kr8s.objects import Pod
pod = Pod({
  "apiVersion": "v1",
  "kind": "Pod",
  "metadata": {
    "name": "nginx"
  },
  "spec": {
    "containers": [
      {
        "name": "nginx",
        "image": "nginx:stable",
        "ports": [
          {
            "containerPort": 80,
            "name": "http"
          }
        ]
      }
    ]
  }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request idea
Projects
None yet
Development

No branches or pull requests

1 participant