/
server_id_group_spec.go
96 lines (85 loc) · 3.85 KB
/
server_id_group_spec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//
// DISCLAIMER
//
// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany
//
package v2alpha1
import core "k8s.io/api/core/v1"
// ServerIDGroupSpec contains the specification for Image Discovery image.
type ServerIDGroupSpec struct {
// Entrypoint overrides container executable
Entrypoint *string `json:"entrypoint,omitempty"`
// Args setting specifies additional command-line arguments passed to all servers of this group.
// +doc/type: []string
// +doc/default: []
Args []string `json:"args,omitempty"`
// Tolerations specifies the tolerations added to Pods in this group.
// +doc/type: []core.Toleration
// +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#toleration-v1-core
Tolerations []core.Toleration `json:"tolerations,omitempty"`
// NodeSelector specifies a set of selectors for nodes
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// PriorityClassName specifies a priority class name
PriorityClassName string `json:"priorityClassName,omitempty"`
// AntiAffinity specified additional antiAffinity settings in ArangoDB Pod definitions
// +doc/type: core.PodAntiAffinity
// +doc/link: Documentation of core.Pod.AntiAffinity|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#podantiaffinity-v1-core
AntiAffinity *core.PodAntiAffinity `json:"antiAffinity,omitempty"`
// Affinity specified additional affinity settings in ArangoDB Pod definitions
// +doc/type: core.PodAffinity
// +doc/link: Documentation of core.PodAffinity|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#podaffinity-v1-core
Affinity *core.PodAffinity `json:"affinity,omitempty"`
// NodeAffinity specified additional nodeAffinity settings in ArangoDB Pod definitions
// +doc/type: core.NodeAffinity
// +doc/link: Documentation of code.NodeAffinity|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#nodeaffinity-v1-core
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
// +doc/type: core.ResourceRequirements
// +doc/link: Documentation of core.ResourceRequirements|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#resourcerequirements-v1-core
Resources *core.ResourceRequirements `json:"resources,omitempty"`
}
func (s *ServerIDGroupSpec) Get() ServerIDGroupSpec {
if s != nil {
return *s
}
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
}
func (s *ServerIDGroupSpec) GetEntrypoint(defaultEntrypoint string) string {
if s == nil || s.Entrypoint == nil {
return defaultEntrypoint
}
return *s.Entrypoint
}