@@ -24,7 +24,7 @@ var ErrAnnotationExpansionConflict = errors.New("annotation expansion conflict")
2424var ErrGenericAnnotationConflict = errors .New ("specified annotations conflict" )
2525
2626// ProcessAnnotations expands annotations into their corresponding annotation groups.
27- func ProcessAnnotations (ctx context.Context , s * specs. Spec ) error {
27+ func ProcessAnnotations (ctx context.Context , specAnnotations map [ string ] string ) error {
2828 // Named `Process` and not `Expand` since this function may be expanded (pun intended) to
2929 // deal with other annotation issues and validation.
3030
@@ -36,11 +36,11 @@ func ProcessAnnotations(ctx context.Context, s *specs.Spec) error {
3636 var errs []error
3737 for key , exps := range annotations .AnnotationExpansionMap () {
3838 // check if annotation is present
39- if val , ok := s . Annotations [key ]; ok {
39+ if val , ok := specAnnotations [key ]; ok {
4040 // ideally, some normalization would occur here (ie, "True" -> "true")
4141 // but strings may be case-sensitive
4242 for _ , k := range exps {
43- if v , ok := s . Annotations [k ]; ok && val != v {
43+ if v , ok := specAnnotations [k ]; ok && val != v {
4444 err := fmt .Errorf ("%w: %q = %q and %q = %q" , ErrAnnotationExpansionConflict , key , val , k , v )
4545 errs = append (errs , err )
4646 log .G (ctx ).WithFields (logrus.Fields {
@@ -51,26 +51,26 @@ func ProcessAnnotations(ctx context.Context, s *specs.Spec) error {
5151 }).WithError (err ).Warning ("annotation expansion would overwrite conflicting value" )
5252 continue
5353 }
54- s . Annotations [k ] = val
54+ specAnnotations [k ] = val
5555 }
5656 }
5757 }
5858
5959 // validate host process containers annotations are not conflicting
60- disableHPC := ParseAnnotationsBool (ctx , s . Annotations , annotations .DisableHostProcessContainer , false )
61- enableHPC := ParseAnnotationsBool (ctx , s . Annotations , annotations .HostProcessContainer , false )
60+ disableHPC := ParseAnnotationsBool (ctx , specAnnotations , annotations .DisableHostProcessContainer , false )
61+ enableHPC := ParseAnnotationsBool (ctx , specAnnotations , annotations .HostProcessContainer , false )
6262 if disableHPC && enableHPC {
6363 err := fmt .Errorf ("%w: host process container annotations %q = %q and %q = %q" ,
6464 ErrGenericAnnotationConflict ,
65- annotations .DisableHostProcessContainer , s . Annotations [annotations .DisableHostProcessContainer ],
66- annotations .HostProcessContainer , s . Annotations [annotations .HostProcessContainer ])
65+ annotations .DisableHostProcessContainer , specAnnotations [annotations .DisableHostProcessContainer ],
66+ annotations .HostProcessContainer , specAnnotations [annotations .HostProcessContainer ])
6767 errs = append (errs , err )
6868
6969 log .G (ctx ).WithFields (logrus.Fields {
7070 logfields .OCIAnnotation : annotations .DisableHostProcessContainer ,
71- logfields .Value : s . Annotations [annotations .DisableHostProcessContainer ],
71+ logfields .Value : specAnnotations [annotations .DisableHostProcessContainer ],
7272 logfields .OCIAnnotation + "-conflict" : annotations .HostProcessContainer ,
73- logfields .Value + "-conflict" : s . Annotations [annotations .HostProcessContainer ],
73+ logfields .Value + "-conflict" : specAnnotations [annotations .HostProcessContainer ],
7474 }).WithError (err ).Warning ("Host process container and disable host process container cannot both be true" )
7575 }
7676
@@ -204,10 +204,10 @@ func parseAdditionalRegistryValues(ctx context.Context, a map[string]string) []h
204204 return slices .Clip (rvs )
205205}
206206
207- // parseHVSocketServiceTable extracts any additional Hyper-V socket service configurations from annotations.
207+ // ParseHVSocketServiceTable extracts any additional Hyper-V socket service configurations from annotations.
208208//
209209// Like the [parseAnnotation*] functions, this logs errors but does not return them.
210- func parseHVSocketServiceTable (ctx context.Context , a map [string ]string ) map [string ]hcsschema.HvSocketServiceConfig {
210+ func ParseHVSocketServiceTable (ctx context.Context , a map [string ]string ) map [string ]hcsschema.HvSocketServiceConfig {
211211 sc := make (map [string ]hcsschema.HvSocketServiceConfig )
212212 // TODO(go1.23) use range over functions to implement a functional `filter | map $ a`
213213 for k , v := range a {
0 commit comments