Skip to content

Commit 3d16713

Browse files
authored
[Feature] Allow to customize Security Context (#588)
1 parent 490e8b8 commit 3d16713

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Allow to customize ID Pod selectors
1010
- Add Label and Envs Pod customization
1111
- Improved JWT Rotation
12+
- Allow to customize Security Context in pods
1213

1314
## [1.0.3](https://github.com/arangodb/kube-arangodb/tree/1.0.3) (2020-05-25)
1415
- Prevent deletion of not known PVC's

pkg/apis/deployment/v1/server_group_spec.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ type ServerGroupSpecSecurityContext struct {
100100
DropAllCapabilities *bool `json:"dropAllCapabilities,omitempty"`
101101
// AddCapabilities add new capabilities to containers
102102
AddCapabilities []core.Capability `json:"addCapabilities,omitempty"`
103+
104+
AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty"`
105+
Privileged *bool `json:"privileged,omitempty"`
106+
ReadOnlyRootFilesystem *bool `json:"readOnlyFileSystem,omitempty"`
107+
RunAsNonRoot *bool `json:"runAsNonRoot,omitempty"`
108+
RunAsUser *int64 `json:"runAsUser,omitempty"`
109+
RunAsGroup *int64 `json:"runAsGroup,omitempty"`
103110
}
104111

105112
// GetDropAllCapabilities returns flag if capabilities should be dropped
@@ -134,6 +141,15 @@ func (s *ServerGroupSpecSecurityContext) GetAddCapabilities() []core.Capability
134141
func (s *ServerGroupSpecSecurityContext) NewSecurityContext() *core.SecurityContext {
135142
r := &core.SecurityContext{}
136143

144+
if s != nil {
145+
r.AllowPrivilegeEscalation = s.AllowPrivilegeEscalation
146+
r.Privileged = s.Privileged
147+
r.ReadOnlyRootFilesystem = s.ReadOnlyRootFilesystem
148+
r.RunAsNonRoot = s.RunAsNonRoot
149+
r.RunAsUser = s.RunAsUser
150+
r.RunAsGroup = s.RunAsGroup
151+
}
152+
137153
capabilities := &core.Capabilities{}
138154

139155
if s.GetDropAllCapabilities() {

pkg/apis/deployment/v1/zz_generated.deepcopy.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)