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

Add support for easier YAML loading. #207

Merged
merged 1 commit into from
Mar 7, 2018

Conversation

brendandburns
Copy link
Contributor

@brendandburns brendandburns commented Mar 4, 2018

Closes #170

@kondapally1989 @zysimplelife @lwander

Code now looks like:

V1Pod pod = (V1Pod) Yaml.load(new File("my-file.yaml"));

@brendandburns
Copy link
Contributor Author

Merging because of a lack of reviews...

@brendandburns brendandburns merged commit 3b53b68 into kubernetes-client:master Mar 7, 2018
@mmmaks
Copy link
Contributor

mmmaks commented Mar 13, 2018

How to load in to an specific namespace ??

@brendandburns
Copy link
Contributor Author

brendandburns commented Mar 13, 2018 via email

@mmmaks
Copy link
Contributor

mmmaks commented Mar 21, 2018

V1Pod pod = (V1Pod) Yaml.load(new File("my-file.yaml"));
After this how can we feed this pod to kubernetes cluster ?
Using this :
V1Pod result = apiInstance.createNamespacedPod(namespace, body, pretty); ??

@brendandburns
Copy link
Contributor Author

brendandburns commented Mar 21, 2018 via email

@mmmaks
Copy link
Contributor

mmmaks commented Mar 21, 2018

V1Pod pod = (V1Pod) Yaml.load(new File("my-file.yaml"));
Error : Cannot resolve method 'load(java.io.File)'

import for yaml :
import org.yaml.snakeyaml.Yaml;

Any help ??

@karthikkondapally
Copy link
Contributor

@mmmaks
can you paste entire error?
and did you pull latest code and generate jar

@karthikkondapally
Copy link
Contributor

import for YAML:
import io.kubernetes.client.util.Yaml;

@mmmaks
Copy link
Contributor

mmmaks commented Mar 21, 2018

import io.kubernetes.client.util.Yaml;
It shows : cannot resolve symbol 'Yaml'

pom :

<dependency>
    <groupId>io.kubernetes</groupId>
    <artifactId>client-java</artifactId>
    <version>LATEST</version>
    <scope>compile</scope>
</dependency>

@karthikkondapally
Copy link
Contributor

i think maven release doesn't contain this pull request yet
see #210.
either you have to wait for new release or clone this repo and generate jar.

@mmmaks
Copy link
Contributor

mmmaks commented Mar 26, 2018

There is no single argument constructor in Quantity.
So when I am trying give resource limits as :

resources:
   requests:
     cpu: 1
     memory: 2Gi
   limits:
     cpu: 1
     memory: 2Gi

It shows :
org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for class io.kubernetes.client.custom.Quantity : null

@mmmaks
Copy link
Contributor

mmmaks commented Mar 27, 2018

Also, while creating Kubernetes Job, with yaml :
kind: Job
apiVersion: batch/v1
Error :

java.io.IOException: Unknown apiVersionKind: batch/v1/Job known kinds are:

and then a list of known kinds.
But here shows apiVersion: batch/v1 for job.

Also, when I try to create Job with yaml :
kind: Job
apiVersion: v1

Error :
io.kubernetes.client.ApiException: Bad Request at io.kubernetes.client.ApiClient.handleResponse(ApiClient.java:882) at io.kubernetes.client.ApiClient.execute(ApiClient.java:798) at io.kubernetes.client.apis.BatchV1Api.createNamespacedJobWithHttpInfo(BatchV1Api.java:160) at io.kubernetes.client.apis.BatchV1Api.createNamespacedJob(BatchV1Api.java:144)

please help !!

@karthikkondapally
Copy link
Contributor

karthikkondapally commented Mar 27, 2018

@mmmaks some mappings of Kind and apiVersion are missing. getApiGroupVersion() doesn't contain V1Job -> batch/v1
I will try to add few mapping and create pull request
.

can you open issue instead of adding comments on pull request. it will be helpful/visible to others and they may quickly identify the issue

@karthikkondapally
Copy link
Contributor

on a 2nd look, it seems HashMap classes is never loaded with key batch/v1/Job because pojo/DTO for job is V1Job.java but not BatchV1Job.java
this will also apply to:
Job, JobCondition, JobList, JobSpec, JobStatus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants