-
According to the docs this function accepts "Raw string YAML" but I cannot find the obvious way to use it. My code (minimized): fn foo(namespace: &str, raw_template: String) -> anyhow::Result<()> {
let k8s_client = Client::try_default().await?;
let api = Api::namespaced(k8s_client, &namespace);
api.create(&PostParams::default(), &raw_template)
.await?;
} shows an error:
My use case is trying to deploy YAMLs that contain multiple resources separated by |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
if the yaml are arbitrary resources, then you'd probably want to use the dynamic api. Take a look at the kubectl example in the apply section: Lines 156 to 181 in 7ff120a i suspect that's pretty similar to what you want (it's using server-side apply - via api.patch rather than api.create, but this should be better than using create anyway) |
Beta Was this translation helpful? Give feedback.
if the yaml are arbitrary resources, then you'd probably want to use the dynamic api.
Take a look at the kubectl example in the apply section:
kube/examples/kubectl.rs
Lines 156 to 181 in 7ff120a