initContainers[1].lifecycle: Forbidden: may not be set for init containers without restartPolicy=Always", Reason:"Invalid", Details:(*v1.StatusDetails)(0xc000cb2d80), Code:422} #3794
Labels
kind/bug
Categorizes issue or PR as related to a bug.
Description
Using Volcano V1.10.0 on Kubenetes V1.30.5, after adding sidecar in a container in InitContainers, I met the following error:
E1015 16:14:16.078922 1 job_controller_actions.go:407] Failed to create pod ip-model-1000000046-spec0-0 for Job ip-model-1000000046, err &errors.StatusError{ErrStatus:v1.Status{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ListMeta:v1.ListMeta{SelfLink:"", ResourceVersion:"", Continue:"", RemainingItemCount:(*int64)(nil)}, Status:"Failure", Message:"Pod "ip-model-1000000046-spec0-0" is invalid: spec.initContainers[1].lifecycle: Forbidden: may not be set for init containers without restartPolicy=Always", Reason:"Invalid", Details:(*v1.StatusDetails)(0xc000cb2d80), Code:422}}
Let's call the the second container( initContainers[1) in task[0].Template.Spec.InitContainers as C2.
I do set restartPolicy=Always in C2.
I call job's create functio in volcano.sh/[email protected]/pkg/client/clientset/versioned/typed/batch/v1alpha1/job.go in order to create a job.
Before err = c.client.Post().
Namespace(c.ns).
Resource("jobs").
VersionedParams(&opts, scheme.ParameterCodec).
Body(job).
Do(ctx).
Into(result),
I print the C2's RestartPolicy and it shows Always.
Backgroud:
Steps to reproduce the issue
Describe the results you received and expected
I met the following error:
E1015 16:14:16.078922 1 job_controller_actions.go:407] Failed to create pod ip-model-1000000046-spec0-0 for Job ip-model-1000000046, err &errors.StatusError{ErrStatus:v1.Status{TypeMeta:v1.TypeMeta{Kind:"", APIVersion:""}, ListMeta:v1.ListMeta{SelfLink:"", ResourceVersion:"", Continue:"", RemainingItemCount:(*int64)(nil)}, Status:"Failure", Message:"Pod "ip-model-1000000046-spec0-0" is invalid: spec.initContainers[1].lifecycle: Forbidden: may not be set for init containers without restartPolicy=Always", Reason:"Invalid", Details:(*v1.StatusDetails)(0xc000cb2d80), Code:422}}
What I expected:
I can create job successfully with the the sidecar feature when setting lifecycle and restartPolicy=Always in C2.
What version of Volcano are you using?
1.10.0
Any other relevant information
kubectl version
Client Version: v1.30.5
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.5
cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
uname -a
Linux m12345 5.15.0-97-generic #107-Ubuntu SMP Wed Feb 7 13:26:48 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: