1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 15:45:08 +01:00

Merge pull request #27791 from ninja-quokka/kube_play_image_validation

[play_kube] Add validation to container image field
This commit is contained in:
Matt Heon
2025-12-22 14:43:56 -05:00
committed by GitHub
2 changed files with 31 additions and 0 deletions

View File

@@ -283,6 +283,20 @@ spec:
- containerPort: 80
`
var podWithoutAnImage = `
apiVersion: v1
kind: Pod
metadata:
labels:
app: podDoesntHaveAnImage
name: podDoesntHaveAnImage
spec:
containers:
- name: podDoesntHaveAnImage
ports:
- containerPort: 80
`
var subpathTestNamedVolume = `
apiVersion: v1
kind: Pod
@@ -2637,6 +2651,15 @@ var _ = Describe("Podman kube play", func() {
Expect(kube).Should(ExitWithError(125, "pod does not have a name"))
})
It("should error if pod doesn't have an image", func() {
err := writeYaml(podWithoutAnImage, kubeYaml)
Expect(err).ToNot(HaveOccurred())
kube := podmanTest.Podman([]string{"kube", "play", kubeYaml})
kube.WaitWithDefaultTimeout()
Expect(kube).Should(ExitWithError(125, `container "podDoesntHaveAnImage" is missing the required 'image' field`))
})
It("support container liveness probe", func() {
err := writeYaml(livenessProbePodYaml, kubeYaml)
Expect(err).ToNot(HaveOccurred())