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

Error when load yaml with parameters #1979

Closed
marlonpatrick opened this issue Feb 2, 2020 · 4 comments
Closed

Error when load yaml with parameters #1979

marlonpatrick opened this issue Feb 2, 2020 · 4 comments

Comments

@marlonpatrick
Copy link

To reproduce the error run the code below with an multi-document yaml. Parameters must have the format ${param1}.

public static void main(String[] args) {
	try(DefaultKubernetesClient client = new DefaultKubernetesClient()){
		
    	Map<String, String> parameters = new HashMap<>();
    	parameters.put("param1", "value1");
    	parameters.put("param2", "value2");

        client.load(MyClass.class.getResourceAsStream("/my-multiple-document.yaml"))
            	.withParameters(parameters).inNamespace("myNamespace").get();
	}
}

Log:

io.fabric8.kubernetes.client.KubernetesClientException: An error has occurred.
        at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:64)
        at io.fabric8.kubernetes.client.KubernetesClientException.launderThrowable(KubernetesClientException.java:53)
        at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:134)
        at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:95)
        at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.<init>(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java:228)
        at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.withParameters(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java:185)
        at io.fabric8.kubernetes.client.dsl.internal.NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.withParameters(NamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl.java:64)

Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
 at [Source: (BufferedInputStream); line: 1, column: 1]
        at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
        at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1442)
        at com.fasterxml.jackson.databind.ObjectReader._initForReading(ObjectReader.java:360)
        at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1704)
        at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1228)
        at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:132)
        ... 25 more

@rohanKanojia
Copy link
Member

Hmm, I'm not sure whether we supported replacing parameters earlier in Kubernetes manifests, it was only specific for templates I think(I might be wrong). Was it working for you in previous versions? If not, I think it's not a bad idea to support this in regular manifests too.

@manusa
Copy link
Member

manusa commented Feb 3, 2020

Relates to:

@marlonpatrick
Copy link
Author

Hmm, I'm not sure whether we supported replacing parameters earlier in Kubernetes manifests, it was only specific for templates I think(I might be wrong). Was it working for you in previous versions? If not, I think it's not a bad idea to support this in regular manifests too.

Hey guy,

I had never tested it in other versions, but the same document works when using Serialization.unmarshal.

So, from what I looked at quickly, it is as if he had been calling the method Serialization.unmarshal 2 times, once with the empty string which causes the error.

@stale
Copy link

stale bot commented May 6, 2020

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

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

No branches or pull requests

3 participants