@@ -201,6 +201,7 @@ func (w *podSecurityContextWrapper) SetFSGroup(v *int64) {
201
201
w .podSC .FSGroup = v
202
202
}
203
203
204
+ // ContainerSecurityContextAccessor allows reading the values of a SecurityContext object
204
205
type ContainerSecurityContextAccessor interface {
205
206
Capabilities () * api.Capabilities
206
207
Privileged () * bool
@@ -213,6 +214,7 @@ type ContainerSecurityContextAccessor interface {
213
214
AllowPrivilegeEscalation () * bool
214
215
}
215
216
217
+ // ContainerSecurityContextMutator allows reading and writing the values of a SecurityContext object
216
218
type ContainerSecurityContextMutator interface {
217
219
ContainerSecurityContextAccessor
218
220
@@ -228,10 +230,14 @@ type ContainerSecurityContextMutator interface {
228
230
SetAllowPrivilegeEscalation (* bool )
229
231
}
230
232
233
+ // NewContainerSecurityContextAccessor returns an accessor for the provided container security context
234
+ // May be initialized with a nil SecurityContext
231
235
func NewContainerSecurityContextAccessor (containerSC * api.SecurityContext ) ContainerSecurityContextAccessor {
232
236
return & containerSecurityContextWrapper {containerSC : containerSC }
233
237
}
234
238
239
+ // NewContainerSecurityContextMutator returns a mutator for the provided container security context
240
+ // May be initialized with a nil SecurityContext
235
241
func NewContainerSecurityContextMutator (containerSC * api.SecurityContext ) ContainerSecurityContextMutator {
236
242
return & containerSecurityContextWrapper {containerSC : containerSC }
237
243
}
@@ -365,10 +371,14 @@ func (w *containerSecurityContextWrapper) SetAllowPrivilegeEscalation(v *bool) {
365
371
w .containerSC .AllowPrivilegeEscalation = v
366
372
}
367
373
374
+ // NewEffectiveContainerSecurityContextAccessor returns an accessor for reading effective values
375
+ // for the provided pod security context and container security context
368
376
func NewEffectiveContainerSecurityContextAccessor (podSC PodSecurityContextAccessor , containerSC ContainerSecurityContextMutator ) ContainerSecurityContextAccessor {
369
377
return & effectiveContainerSecurityContextWrapper {podSC : podSC , containerSC : containerSC }
370
378
}
371
379
380
+ // NewEffectiveContainerSecurityContextMutator returns a mutator for reading and writing effective values
381
+ // for the provided pod security context and container security context
372
382
func NewEffectiveContainerSecurityContextMutator (podSC PodSecurityContextAccessor , containerSC ContainerSecurityContextMutator ) ContainerSecurityContextMutator {
373
383
return & effectiveContainerSecurityContextWrapper {podSC : podSC , containerSC : containerSC }
374
384
}
0 commit comments