question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Find API call to create object from yaml config

See original GitHub issue

I have a yaml file containing configs that I would like to apply as kubectl apply -f my_file.yml would. It is possible to pass configs loaded from yaml unmodified to API calls as discussed in https://github.com/kubernetes-incubator/client-python/issues/63 and illustrated in the create_deployment.py example. However, if you have a collection of objects you have to figure out which call to make on which API version to apply each item of config, while the apiVersion and kind keys in the config, which carry this information, get ignored.

Is there any way to find the right API version object and function given the apiVersion and kind values other than to have a mapping in my own code? If not, would it be possible to add such a thing, and maybe generic create and delete calls that read those attributes from the body, thus behaving similarly to kubectl?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:24
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nielsolecommented, Jul 11, 2018

As this is the most requested feature in this repo by far I thought I nudge it to the top of the issues. (https://github.com/kubernetes-client/python/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc) Does someone have a plan on how to implement this? pykube handles this by having a mapping: https://github.com/kelproject/pykube/blob/master/pykube/objects.py I guess kubectl also has this mapping internally? or does it create a list of possible objects and their endpoints each time by querying the server?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working in YAML (OpenAPI tutorial) - Idratherbewriting.com
In other words, the OpenAPI document you create is a JSON object, but you have the option of expressing the JSON using either...
Read more >
YAML Tutorial: Everything You Need to Get Started in Minutes
Here's a YAML tutorial to get you started quickly. ... It's often used as a format for configuration files, but its object serialization ......
Read more >
YAML to List of Objects in Spring Boot - Baeldung
Spring Boot provides the @ConfigurationProperties annotation to simplify the logic of mapping external configuration data into an object model.
Read more >
Understanding Kubernetes Objects
In the .yaml file for the Kubernetes object you want to create, ... For example, see the spec field for the Pod API...
Read more >
YAML Tutorial - A Comprehensive Guide To YAML Using Python
This process of constructing Python objects from the text input is called Deserialisation. Write YAML File In Python. Open config.py and add the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found