1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

[Feature] Add new fields to ID Group (#653)

This commit is contained in:
Adam Janikowski 2020-10-30 12:14:20 +01:00 committed by GitHub
parent 841af834f2
commit a49d25b3d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 8 deletions

View file

@ -3,6 +3,7 @@
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
- Allow to mount EmptyDir
- Allow to specify initContainers in pods
- Add serviceAccount, resources and securityContext fields to ID Group
## [1.1.0](https://github.com/arangodb/kube-arangodb/tree/master) (2020-10-14)
- Change NumberOfCores and MemoryOverride flags to be set to true by default

View file

@ -38,6 +38,12 @@ type ServerIDGroupSpec struct {
Affinity *core.PodAffinity `json:"affinity,omitempty"`
// NodeAffinity specified additional nodeAffinity settings in ArangoDB Pod definitions
NodeAffinity *core.NodeAffinity `json:"nodeAffinity,omitempty"`
// ServiceAccountName specifies the name of the service account used for Pods in this group.
ServiceAccountName *string `json:"serviceAccountName,omitempty"`
// SecurityContext specifies security context for group
SecurityContext *ServerGroupSpecSecurityContext `json:"securityContext,omitempty"`
// Resources holds resource requests & limits
Resources *core.ResourceRequirements `json:"resources,omitempty"`
}
func (s *ServerIDGroupSpec) Get() ServerIDGroupSpec {
@ -47,3 +53,22 @@ func (s *ServerIDGroupSpec) Get() ServerIDGroupSpec {
return ServerIDGroupSpec{}
}
func (s *ServerIDGroupSpec) GetServiceAccountName() string {
if s == nil || s.ServiceAccountName == nil {
return ""
}
return *s.ServiceAccountName
}
func (s *ServerIDGroupSpec) GetResources() core.ResourceRequirements {
if s == nil || s.Resources == nil {
return core.ResourceRequirements{
Limits: make(core.ResourceList),
Requests: make(core.ResourceList),
}
}
return *s.Resources
}

View file

@ -1302,6 +1302,11 @@ func (in *ServerGroupSpec) DeepCopyInto(out *ServerGroupSpec) {
*out = new(PVCResizeMode)
**out = **in
}
if in.VolumeAllowShrink != nil {
in, out := &in.VolumeAllowShrink, &out.VolumeAllowShrink
*out = new(bool)
**out = **in
}
if in.AntiAffinity != nil {
in, out := &in.AntiAffinity, &out.AntiAffinity
*out = new(corev1.PodAntiAffinity)
@ -1648,6 +1653,21 @@ func (in *ServerIDGroupSpec) DeepCopyInto(out *ServerIDGroupSpec) {
*out = new(corev1.NodeAffinity)
(*in).DeepCopyInto(*out)
}
if in.ServiceAccountName != nil {
in, out := &in.ServiceAccountName, &out.ServiceAccountName
*out = new(string)
**out = **in
}
if in.SecurityContext != nil {
in, out := &in.SecurityContext, &out.SecurityContext
*out = new(ServerGroupSpecSecurityContext)
(*in).DeepCopyInto(*out)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = new(corev1.ResourceRequirements)
(*in).DeepCopyInto(*out)
}
return
}

View file

@ -235,10 +235,7 @@ func (a *ArangoDImageUpdateContainer) GetProbes() (*core.Probe, *core.Probe, err
}
func (a *ArangoDImageUpdateContainer) GetResourceRequirements() core.ResourceRequirements {
return core.ResourceRequirements{
Limits: make(core.ResourceList),
Requests: make(core.ResourceList),
}
return a.spec.ID.GetResources()
}
func (a *ArangoDImageUpdateContainer) GetImage() string {
@ -351,7 +348,7 @@ func (i *ImageUpdatePod) GetNodeSelector() map[string]string {
}
func (i *ImageUpdatePod) GetServiceAccountName() string {
return ""
return i.spec.ID.GetServiceAccountName()
}
func (a *ArangoDImageUpdateContainer) GetPorts() []core.ContainerPort {
@ -365,9 +362,7 @@ func (a *ArangoDImageUpdateContainer) GetPorts() []core.ContainerPort {
}
func (a *ArangoDImageUpdateContainer) GetSecurityContext() *core.SecurityContext {
// Default security context
var v api.ServerGroupSpecSecurityContext
return v.NewSecurityContext()
return a.spec.ID.Get().SecurityContext.NewSecurityContext()
}
func (i *ImageUpdatePod) GetPodAntiAffinity() *core.PodAntiAffinity {