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:
parent
841af834f2
commit
a49d25b3d5
4 changed files with 49 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
20
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
20
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue