I have a charm that creates this CRD:
https://github.com/kubeflow/manifests/blob/v1.0-branch/profiles/base/crd.yaml
Manually kubectl applying it works fine, but either the creation of the CRD, or the creation of the Custom Resource itself is causing issues:
2020-02-11 15:11:30 ERROR juju-log kubeflow-profiles:9: pod-spec-set encountered an error: `ERROR json: unknown field "conversion"`
2020-02-11 15:11:30 ERROR juju-log kubeflow-profiles:9: Hook error:
Traceback (most recent call last):
File "lib/charms/reactive/__init__.py", line 74, in main
bus.dispatch(restricted=restricted_mode)
File "lib/charms/reactive/bus.py", line 390, in dispatch
_invoke(other_handlers)
File "lib/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "lib/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-kubeflow-dashboard-0/charm/reactive/kubeflow_dashboard.py", line 115, in start_charm
'spec': {'owner': {'kind': 'User', 'name': profile}},
File "lib/charms/layer/caas_base.py", line 22, in pod_spec_set
run(['pod-spec-set'], stdout=PIPE, stderr=PIPE, check=True, input=spec.encode('utf-8'))
File "/usr/lib/python3.6/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['pod-spec-set']' returned non-zero exit status 1.
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed Traceback (most recent call last):
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "/var/lib/juju/agents/unit-kubeflow-dashboard-0/charm/hooks/kubeflow-profiles-relation-changed", line 19, in <module>
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed main()
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "lib/charms/reactive/__init__.py", line 74, in main
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed bus.dispatch(restricted=restricted_mode)
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "lib/charms/reactive/bus.py", line 390, in dispatch
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed _invoke(other_handlers)
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "lib/charms/reactive/bus.py", line 359, in _invoke
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed handler.invoke()
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "lib/charms/reactive/bus.py", line 181, in invoke
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed self._action(*args)
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "/var/lib/juju/agents/unit-kubeflow-dashboard-0/charm/reactive/kubeflow_dashboard.py", line 115, in start_charm
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed 'spec': {'owner': {'kind': 'User', 'name': profile}},
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "lib/charms/layer/caas_base.py", line 22, in pod_spec_set
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed run(['pod-spec-set'], stdout=PIPE, stderr=PIPE, check=True, input=spec.encode('utf-8'))
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed File "/usr/lib/python3.6/subprocess.py", line 438, in run
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed output=stdout, stderr=stderr)
2020-02-11 15:11:30 DEBUG kubeflow-profiles-relation-changed subprocess.CalledProcessError: Command '['pod-spec-set']' returned non-zero exit status 1.
2020-02-11 15:11:30 ERROR juju.worker.uniter.operation runhook.go:132 hook "kubeflow-profiles-relation-changed" failed: exit status 1
Here's the relevant section of the pod-spec-set YAML:
{
'kubernetesResources': {
'customResourceDefinitions': {
crd['metadata']['name']: crd['spec']
for crd in yaml.safe_load_all(Path("files/crds.yaml").read_text())
},
'customResources': {
'profiles.kubeflow.org': [
{
'apiVersion': 'kubeflow.org/v1beta1',
'kind': 'Profile',
'metadata': {'name': profile},
'spec': {'owner': {'kind': 'User', 'name': profile}},
}
]
},
}
},
Looks like this is because Juju parses the CRD YAML using the beta1 API extensions and there's now a non-beta version, which includes support for new fields, eg "conversion".