@@ -6092,6 +6092,46 @@ spec:
60926092 Expect (kube ).Should (ExitWithError (125 , "annotation " + define .VolumesFromAnnotation + " without target volume is reserved for internal use" ))
60936093 })
60946094
6095+ It ("test with keep-groups OCI annotation round trip" , func () {
6096+ SkipIfRemote ("the --group-add keep-groups option is not supported in remote mode" )
6097+
6098+ ctr := "ctr-keep-groups"
6099+ ctrNameInKubePod := ctr + "-pod-" + ctr
6100+ outputFile := filepath .Join (podmanTest .TempDir , "pod.yaml" )
6101+ kubeAnnotation := define .KubeKeepOriginalGroupsAnnotation + "/" + ctr
6102+
6103+ podmanTest .PodmanExitCleanly ("create" , "--name" , ctr , "--group-add" , "keep-groups" , CITEST_IMAGE , "top" )
6104+ podmanTest .PodmanExitCleanly ("kube" , "generate" , "-f" , outputFile , ctr )
6105+
6106+ kubeYaml , err := os .ReadFile (outputFile )
6107+ Expect (err ).ToNot (HaveOccurred ())
6108+ Expect (kubeYaml ).ToNot (ContainSubstring (define .RunOCIKeepOriginalGroups + "/" + ctr ))
6109+ Expect (kubeYaml ).To (ContainSubstring (kubeAnnotation + `: "1"` ))
6110+
6111+ podmanTest .PodmanExitCleanly ("kube" , "play" , "--start=false" , outputFile )
6112+ inspect := podmanTest .PodmanExitCleanly ("inspect" , "-f" , "{{ index .Config.Annotations \" " + define .RunOCIKeepOriginalGroups + "\" }}" , ctrNameInKubePod )
6113+ Expect (inspect .OutputToString ()).To (Equal ("1" ))
6114+ })
6115+
6116+ It ("test with mount-context-type OCI annotation round trip" , func () {
6117+ ctr := "ctr-mount-context"
6118+ ctrNameInKubePod := ctr + "-pod-" + ctr
6119+ outputFile := filepath .Join (podmanTest .TempDir , "pod.yaml" )
6120+ kubeAnnotation := define .KubeMountContextTypeAnnotation + "/" + ctr
6121+
6122+ podmanTest .PodmanExitCleanly ("create" , "--name" , ctr , "--annotation" , define .RunOCIMountContextType + "=rootcontext" , CITEST_IMAGE , "top" )
6123+ podmanTest .PodmanExitCleanly ("kube" , "generate" , "-f" , outputFile , ctr )
6124+
6125+ kubeYaml , err := os .ReadFile (outputFile )
6126+ Expect (err ).ToNot (HaveOccurred ())
6127+ Expect (kubeYaml ).ToNot (ContainSubstring (define .RunOCIMountContextType + "/" + ctr ))
6128+ Expect (kubeYaml ).To (ContainSubstring (kubeAnnotation + `: rootcontext` ))
6129+
6130+ podmanTest .PodmanExitCleanly ("kube" , "play" , "--start=false" , outputFile )
6131+ inspect := podmanTest .PodmanExitCleanly ("inspect" , "-f" , "{{ index .Config.Annotations \" " + define .RunOCIMountContextType + "\" }}" , ctrNameInKubePod )
6132+ Expect (inspect .OutputToString ()).To (Equal ("rootcontext" ))
6133+ })
6134+
60956135 It ("test with reserved autoremove annotation in yaml" , func () {
60966136 ctr := "ctr"
60976137 ctrNameInKubePod := ctr + "-pod-" + ctr
0 commit comments