@@ -365,48 +365,51 @@ mod tests {
365365 . win_run_as_user_name ( "winuser" )
366366 . build ( ) ;
367367
368- assert_eq ! ( context, PodSecurityContext {
369- fs_group: Some ( 1000 ) ,
370- fs_group_change_policy: Some ( "policy" . to_string( ) ) ,
371- run_as_user: Some ( 1001 ) ,
372- run_as_group: Some ( 1001 ) ,
373- run_as_non_root: Some ( true ) ,
374- supplemental_groups: Some ( vec![ 1002 , 1003 ] ) ,
375- se_linux_options: Some ( SELinuxOptions {
376- level: Some ( "level" . to_string( ) ) ,
377- role: Some ( "role" . to_string( ) ) ,
378- type_: Some ( "type" . to_string( ) ) ,
379- user: Some ( "user" . to_string( ) ) ,
380- } ) ,
381- seccomp_profile: Some ( SeccompProfile {
382- localhost_profile: Some ( "localhost" . to_string( ) ) ,
383- type_: "type" . to_string( ) ,
384- } ) ,
385- sysctls: Some ( vec![
386- Sysctl {
387- name: "param1" . to_string( ) ,
388- value: "value1" . to_string( ) ,
389- } ,
390- Sysctl {
391- name: "param2" . to_string( ) ,
392- value: "value2" . to_string( ) ,
393- } ,
394- ] ) ,
395- windows_options: Some ( WindowsSecurityContextOptions {
396- gmsa_credential_spec: Some ( "spec" . to_string( ) ) ,
397- gmsa_credential_spec_name: Some ( "name" . to_string( ) ) ,
398- run_as_user_name: Some ( "winuser" . to_string( ) ) ,
399- ..Default :: default ( )
400- } ) ,
401- // This attribute is supported starting with Kubernetes 1.30.
402- // Because we support older Kubernetes versions as well, we can
403- // not use it for now, as we would not work on older Kubernetes
404- // clusters.
405- app_armor_profile: None ,
406- // This attribute is supported starting with Kubernetes 1.31.
407- supplemental_groups_policy: None ,
408- // This attribute is supported starting with Kubernetes 1.32.
409- se_linux_change_policy: None ,
410- } ) ;
368+ assert_eq ! (
369+ context,
370+ PodSecurityContext {
371+ fs_group: Some ( 1000 ) ,
372+ fs_group_change_policy: Some ( "policy" . to_string( ) ) ,
373+ run_as_user: Some ( 1001 ) ,
374+ run_as_group: Some ( 1001 ) ,
375+ run_as_non_root: Some ( true ) ,
376+ supplemental_groups: Some ( vec![ 1002 , 1003 ] ) ,
377+ se_linux_options: Some ( SELinuxOptions {
378+ level: Some ( "level" . to_string( ) ) ,
379+ role: Some ( "role" . to_string( ) ) ,
380+ type_: Some ( "type" . to_string( ) ) ,
381+ user: Some ( "user" . to_string( ) ) ,
382+ } ) ,
383+ seccomp_profile: Some ( SeccompProfile {
384+ localhost_profile: Some ( "localhost" . to_string( ) ) ,
385+ type_: "type" . to_string( ) ,
386+ } ) ,
387+ sysctls: Some ( vec![
388+ Sysctl {
389+ name: "param1" . to_string( ) ,
390+ value: "value1" . to_string( ) ,
391+ } ,
392+ Sysctl {
393+ name: "param2" . to_string( ) ,
394+ value: "value2" . to_string( ) ,
395+ } ,
396+ ] ) ,
397+ windows_options: Some ( WindowsSecurityContextOptions {
398+ gmsa_credential_spec: Some ( "spec" . to_string( ) ) ,
399+ gmsa_credential_spec_name: Some ( "name" . to_string( ) ) ,
400+ run_as_user_name: Some ( "winuser" . to_string( ) ) ,
401+ ..Default :: default ( )
402+ } ) ,
403+ // This attribute is supported starting with Kubernetes 1.30.
404+ // Because we support older Kubernetes versions as well, we can
405+ // not use it for now, as we would not work on older Kubernetes
406+ // clusters.
407+ app_armor_profile: None ,
408+ // This attribute is supported starting with Kubernetes 1.31.
409+ supplemental_groups_policy: None ,
410+ // This attribute is supported starting with Kubernetes 1.32.
411+ se_linux_change_policy: None ,
412+ }
413+ ) ;
411414 }
412415}
0 commit comments