Skip to content

Commit a49d25b

Browse files
authored
[Feature] Add new fields to ID Group (#653)
1 parent 841af83 commit a49d25b

File tree

4 files changed

+49
-8
lines changed

4 files changed

+49
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
44
- Allow to mount EmptyDir
55
- Allow to specify initContainers in pods
6+
- Add serviceAccount, resources and securityContext fields to ID Group
67

78
## [1.1.0](https://github.com/arangodb/kube-arangodb/tree/master) (2020-10-14)
89
- Change NumberOfCores and MemoryOverride flags to be set to true by default

pkg/apis/deployment/v1/server_id_group_spec.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ type ServerIDGroupSpec struct {
3838
Affinity *core.PodAffinity `json:"affinity,omitempty"`
3939
// NodeAffinity specified additional nodeAffinity settings in ArangoDB Pod definitions
4040
NodeAffinity *core.NodeAffinity `json:"nodeAffinity,omitempty"`
41+
// ServiceAccountName specifies the name of the service account used for Pods in this group.
42+
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
43+
// SecurityContext specifies security context for group
44+
SecurityContext *ServerGroupSpecSecurityContext `json:"securityContext,omitempty"`
45+
// Resources holds resource requests & limits
46+
Resources *core.ResourceRequirements `json:"resources,omitempty"`
4147
}
4248

4349
func (s *ServerIDGroupSpec) Get() ServerIDGroupSpec {
@@ -47,3 +53,22 @@ func (s *ServerIDGroupSpec) Get() ServerIDGroupSpec {
4753

4854
return ServerIDGroupSpec{}
4955
}
56+
57+
func (s *ServerIDGroupSpec) GetServiceAccountName() string {
58+
if s == nil || s.ServiceAccountName == nil {
59+
return ""
60+
}
61+
62+
return *s.ServiceAccountName
63+
}
64+
65+
func (s *ServerIDGroupSpec) GetResources() core.ResourceRequirements {
66+
if s == nil || s.Resources == nil {
67+
return core.ResourceRequirements{
68+
Limits: make(core.ResourceList),
69+
Requests: make(core.ResourceList),
70+
}
71+
}
72+
73+
return *s.Resources
74+
}

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

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

pkg/deployment/images.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,7 @@ func (a *ArangoDImageUpdateContainer) GetProbes() (*core.Probe, *core.Probe, err
235235
}
236236

237237
func (a *ArangoDImageUpdateContainer) GetResourceRequirements() core.ResourceRequirements {
238-
return core.ResourceRequirements{
239-
Limits: make(core.ResourceList),
240-
Requests: make(core.ResourceList),
241-
}
238+
return a.spec.ID.GetResources()
242239
}
243240

244241
func (a *ArangoDImageUpdateContainer) GetImage() string {
@@ -351,7 +348,7 @@ func (i *ImageUpdatePod) GetNodeSelector() map[string]string {
351348
}
352349

353350
func (i *ImageUpdatePod) GetServiceAccountName() string {
354-
return ""
351+
return i.spec.ID.GetServiceAccountName()
355352
}
356353

357354
func (a *ArangoDImageUpdateContainer) GetPorts() []core.ContainerPort {
@@ -365,9 +362,7 @@ func (a *ArangoDImageUpdateContainer) GetPorts() []core.ContainerPort {
365362
}
366363

367364
func (a *ArangoDImageUpdateContainer) GetSecurityContext() *core.SecurityContext {
368-
// Default security context
369-
var v api.ServerGroupSpecSecurityContext
370-
return v.NewSecurityContext()
365+
return a.spec.ID.Get().SecurityContext.NewSecurityContext()
371366
}
372367

373368
func (i *ImageUpdatePod) GetPodAntiAffinity() *core.PodAntiAffinity {

0 commit comments

Comments
 (0)