volcano-sh / volcano

A Cloud Native Batch System (Project under CNCF)
https://volcano.sh
Apache License 2.0
4.23k stars 970 forks source link

initContainers[1].lifecycle: Forbidden: may not be set for init containers without restartPolicy=Always", Reason:"Invalid", Details:(*v1.StatusDetails)(0xc000cb2d80), Code:422} #3794

Open geek1250 opened 3 weeks ago

geek1250 commented 3 weeks ago

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/apis@v1.10.0/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: 1) I installed Volcano V1.7 previously, and changed images of volcano-controllers and volcano-scheduler with Volcano V1.10.0's official images. 2) The sidecar feature of k8s works fine as I can create a job with sidecar feature when writing a yaml file without using Volcano.

Steps to reproduce the issue

1. 2. 3.

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

Monokaix commented 3 weeks ago

Hi, please use helm upgrade to upgrade volcano version, deatils https://github.com/volcano-sh/helm-charts: )

Monokaix commented 4 days ago

has your problem beed solved?