@@ -237,7 +237,7 @@ func (g Generator) AddAnnotation(s string) error {
237237
238238 pair := strings .Split (s , "=" )
239239 if len (pair ) != 2 {
240- return fmt .Errorf ("incorrectly specified sysctl : %s" , s )
240+ return fmt .Errorf ("incorrectly specified annotation : %s" , s )
241241 }
242242 g .spec .Annotations [pair [0 ]] = pair [1 ]
243243 return nil
@@ -855,10 +855,10 @@ func (g Generator) SetupPrivileged(privileged bool) {
855855
856856func checkCap (c string ) error {
857857 isValid := false
858- cp := fmt . Sprintf ( "CAP_%s" , c )
858+ cp := strings . ToUpper ( c )
859859
860860 for _ , cap := range capability .List () {
861- if strings . ToUpper ( cp ) == strings .ToUpper (cap .String ()) {
861+ if cp == strings .ToUpper (cap .String ()) {
862862 isValid = true
863863 break
864864 }
@@ -881,10 +881,10 @@ func (g Generator) AddProcessCapability(c string) error {
881881 return err
882882 }
883883
884- cp := fmt .Sprintf ("CAP_%s" , c )
884+ cp := fmt .Sprintf ("CAP_%s" , strings . ToUpper ( c ) )
885885
886886 for _ , cap := range g .spec .Process .Capabilities {
887- if strings .ToUpper (cap ) == strings . ToUpper ( cp ) {
887+ if strings .ToUpper (cap ) == cp {
888888 return nil
889889 }
890890 }
@@ -899,10 +899,10 @@ func (g Generator) DropProcessCapability(c string) error {
899899 return err
900900 }
901901
902- cp := fmt .Sprintf ("CAP_%s" , c )
902+ cp := fmt .Sprintf ("CAP_%s" , strings . ToUpper ( c ) )
903903
904904 for i , cap := range g .spec .Process .Capabilities {
905- if strings .ToUpper (cap ) == strings . ToUpper ( cp ) {
905+ if strings .ToUpper (cap ) == cp {
906906 g .spec .Process .Capabilities = append (g .spec .Process .Capabilities [:i ], g .spec .Process .Capabilities [i + 1 :]... )
907907 return nil
908908 }
0 commit comments