-
Notifications
You must be signed in to change notification settings - Fork 119
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
passing k8s_resources to pod.set_spec does not work #293
Comments
I believe we can create a YAML file and pass that in instead. Right now we have: def pod_spec_set(self, spec, k8s_resources):
tmpdir = Path(tempfile.mkdtemp('-pod-spec-set'))
try:
spec_path = tmpdir / 'spec.json'
spec_path.write_text(json.dumps(spec))
args = ['--file', str(spec_path)]
if k8s_resources:
k8s_res_path = tmpdir / 'k8s-resources.json'
k8s_res_path.write_text(json.dumps(k8s_resources))
args.extend(['--k8s-resources', str(k8s_res_path)])
self._run('pod-spec-set', *args)
finally:
shutil.rmtree(str(tmpdir)) we already depend on YAML being installed, so we can use that instead. |
chipaca
added a commit
to chipaca/operator
that referenced
this issue
Aug 10, 2020
chipaca
added a commit
that referenced
this issue
Aug 12, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Per https://bugs.launchpad.net/juju/+bug/1880637, pod-spec-set ignores --k8s-resources when the supplied files are JSON. The operator framework creates the files that it passes to pod-spec-set in JSON format.
One of the Juju developers tells me that pod-spec-set concatenates the files internally before parsing, which would explain why JSON doesn't work but YAML does work.
Please consider writing the files as YAML instead, which should work properly.
In the meantime, this can be worked around by placing the Kubernetes resources in the "kubernetesResources" slot of the pod spec itself.
The text was updated successfully, but these errors were encountered: