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

Unable to pass in custom values for values.yaml #204

Open
padas2 opened this issue Nov 4, 2019 · 1 comment
Open

Unable to pass in custom values for values.yaml #204

padas2 opened this issue Nov 4, 2019 · 1 comment

Comments

@padas2
Copy link

padas2 commented Nov 4, 2019

Hi,

First of all, thank you for writing this library.
This reduced a lot of my work.

However, I am stuck at a point and need some help.
I have a helm chart which has the structure of typical helm chart.
A Chart.yaml, a value.yaml, a templates directory which has all the templates for launching the K8 components etc. etc.

I am able to launch this helm chart (when all the required values are pre-populated) using the Java Sdk without any problem.
However, when I try to pass in values at runtime, the chart gets launched but values are not substituted, resulting in an improper deployment where the image is not even pulled.

Following is the code I am using.

final Map<String, String> yaml = new LinkedHashMap<>()
yaml.put("imageName", "<Name-of-image>")
final String yamlString = new Yaml().dump(yaml);

final InstallReleaseRequest.Builder installReleaseRequestBuilder = InstallReleaseRequest.newBuilder();
installReleaseRequestBuilder.setName('sleeping-panda')
installReleaseRequestBuilder.getValuesBuilder().setRaw(yamlString)

ChartOuterClass.Chart.Builder chartBuilder = null;
Path validChartPath = Paths.get('<Absolute-path-to-helm-chart-location-in-local-workspace>')
chartBuilder = new DirectoryChartLoader().load(validChartPath)

final Future<hapi.services.tiller.Tiller.InstallReleaseResponse> releaseFuture = chartManager.install(installReleaseRequestBuilder, chartBuilder)
final ReleaseOuterClass.Release release = releaseFuture.get().getRelease();

I observed that in one of the previous issues, you have mentioned to refer a link which pointed to a Kubernetes Slack channel.

But, for some reason, I am unable to login to that slack channel.
Hence requesting your assistance.

@NMSVishal
Copy link

Same issue is coming for me when I am trying to pass custom values.yaml file its getting failed with below exception:
Caused by: io.grpc.StatusRuntimeException: UNKNOWN: error unmarshaling JSON: json: cannot unmarshal string into Go value of type chartutil.Values
at io.grpc.Status.asRuntimeException(Status.java:526)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:467)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1$1.onClose(CensusStatsModule.java:684)
at io.grpc.ForwardingClientCallListener.onClose(ForwardingClientCallListener.java:41)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1$1.onClose(CensusTracingModule.java:391)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:475)
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:63)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:557)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:478)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:590)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

and below is the code snippet:

final InstallReleaseRequest.Builder requestBuilder = InstallReleaseRequest.newBuilder();
chart = loadChart(chartLocation);
String data=new String(downloadFile(yamlFileUrl));
final String yamlString = new Yaml().dump(data);
requestBuilder.getValuesBuilder().setRaw(yamlString);

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

No branches or pull requests

2 participants