Skip to content

Commit

Permalink
Pass security context as pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzhongyi committed Jun 13, 2024
1 parent 5372cc8 commit ae95659
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func main() {
gsController := gameservers.NewController(controllerHooks, health,
ctlConf.PortRanges, ctlConf.SidecarImage, ctlConf.AlwaysPullSidecar,
ctlConf.SidecarCPURequest, ctlConf.SidecarCPULimit,
ctlConf.SidecarMemoryRequest, ctlConf.SidecarMemoryLimit, securityCtx, ctlConf.SdkServiceAccount,
ctlConf.SidecarMemoryRequest, ctlConf.SidecarMemoryLimit, &securityCtx, ctlConf.SdkServiceAccount,
kubeClient, kubeInformerFactory, extClient, agonesClient, agonesInformerFactory)
gsSetController := gameserversets.NewController(health, gsCounter,
kubeClient, extClient, agonesClient, agonesInformerFactory)
Expand Down
6 changes: 3 additions & 3 deletions pkg/gameservers/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type Controller struct {
sidecarCPULimit resource.Quantity
sidecarMemoryRequest resource.Quantity
sidecarMemoryLimit resource.Quantity
sidecarSecurityCtx corev1.SecurityContext
sidecarSecurityCtx *corev1.SecurityContext
sdkServiceAccount string
crdGetter apiextclientv1.CustomResourceDefinitionInterface
podGetter typedcorev1.PodsGetter
Expand Down Expand Up @@ -115,7 +115,7 @@ func NewController(
sidecarCPULimit resource.Quantity,
sidecarMemoryRequest resource.Quantity,
sidecarMemoryLimit resource.Quantity,
sidecarSecurityCtx corev1.SecurityContext,
sidecarSecurityCtx *corev1.SecurityContext,
sdkServiceAccount string,
kubeClient kubernetes.Interface,
kubeInformerFactory informers.SharedInformerFactory,
Expand Down Expand Up @@ -767,7 +767,7 @@ func (c *Controller) sidecar(gs *agonesv1.GameServer) corev1.Container {
sidecar.ImagePullPolicy = corev1.PullAlways
}

sidecar.SecurityContext = &c.sidecarSecurityCtx
sidecar.SecurityContext = c.sidecarSecurityCtx

return sidecar
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/gameservers/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@ func newFakeController() (*Controller, agtesting.Mocks) {
map[string]portallocator.PortRange{agonesv1.DefaultPortRange: {MinPort: 10, MaxPort: 20}},
"sidecar:dev", false,
resource.MustParse("0.05"), resource.MustParse("0.1"),
resource.MustParse("50Mi"), resource.MustParse("100Mi"), securityCtx, "sdk-service-account",
resource.MustParse("50Mi"), resource.MustParse("100Mi"), &securityCtx, "sdk-service-account",
m.KubeClient, m.KubeInformerFactory, m.ExtClient, m.AgonesClient, m.AgonesInformerFactory)
c.recorder = m.FakeRecorder
return c, m
Expand Down

0 comments on commit ae95659

Please sign in to comment.