-
-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Labels
apiApi abstraction relatedApi abstraction relatedinvalidrejected as a valid issuerejected as a valid issue
Description
Running minikube v1.8.1
, and with
kube = "0.30.0"
k8s-openapi = { version = "0.7.1", features = ["v1_15"] }
(same with v1_17
)
use k8s_openapi::{
apimachinery::pkg::apis::meta::v1::ObjectMeta,
api::batch::v1beta1::{CronJob, CronJobSpec, CronJobStatus, JobTemplateSpec},
api::batch::v1::JobSpec,
api::core::v1::{PodTemplateSpec, PodSpec, Container},
};
use kube::{Api, api::PostParams, client::APIClient, config::load_kube_config};
let config = load_kube_config().await.context(err::KubeError)?;
let client = APIClient::new(config);
let api = Api::<CronJob>::all(client);
api.create(
&PostParams::default(),
&CronJob {
metadata: Some(ObjectMeta {
labels: Some(BTreeMap::from_iter(
[("name".into(), name.clone())].iter().cloned()
)),
..Default::default()
}),
spec: Some(CronJobSpec {
schedule: schedule.frequency.clone(),
job_template: JobTemplateSpec {
spec: Some(JobSpec {
template: PodTemplateSpec {
spec: Some(PodSpec {
containers: vec![
Container {
name: "hello".into(),
image: Some("busybox".into()),
args: Some(vec!["/bin/sh".into(),
"-c".into(),
"date; echo Hello".into()]),
..Default::default()
}
],
restart_policy: Some("OnFailure".into()),
..Default::default()
}),
metadata: None,
},
..Default::default()
}),
metadata: None,
},
..Default::default()
}),
status: None,
}).await.context(err::KubeError)?;
I get error:
KubeError { source: Api(ErrorResponse { status: "Failure", message: "the server does not allow this method on the requested resource", reason: "MethodNotAllowed", code: 405 }) }
dseynaev and dag-andersen
Metadata
Metadata
Assignees
Labels
apiApi abstraction relatedApi abstraction relatedinvalidrejected as a valid issuerejected as a valid issue