Skip to content

Commit 6aaa93a

Browse files
authored
[Feature] Pass Arguments to ID Group (#1551)
1 parent d482e42 commit 6aaa93a

File tree

9 files changed

+106
-9
lines changed

9 files changed

+106
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
- (Feature) (ML) Support for deployments with JWT auth enabled
4040
- (Feature) (ML) GPU Jobs
4141
- (Feature) (ML) Container Envs
42+
- (Feature) Pass Arguments to ID Group
4243

4344
## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06)
4445
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks

docs/api/ArangoDeployment.V1.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,7 +2979,7 @@ Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.
29792979

29802980
### .spec.id.affinity
29812981

2982-
Type: `core.PodAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L44)</sup>
2982+
Type: `core.PodAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L48)</sup>
29832983

29842984
Affinity specified additional affinity settings in ArangoDB Pod definitions
29852985

@@ -2990,7 +2990,7 @@ Links:
29902990

29912991
### .spec.id.antiAffinity
29922992

2993-
Type: `core.PodAntiAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L40)</sup>
2993+
Type: `core.PodAntiAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L44)</sup>
29942994

29952995
AntiAffinity specified additional antiAffinity settings in ArangoDB Pod definitions
29962996

@@ -2999,6 +2999,16 @@ Links:
29992999

30003000
***
30013001

3002+
### .spec.id.args
3003+
3004+
Type: `[]string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L32)</sup>
3005+
3006+
Args setting specifies additional command-line arguments passed to all servers of this group.
3007+
3008+
Default Value: `[]`
3009+
3010+
***
3011+
30023012
### .spec.id.entrypoint
30033013

30043014
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L28)</sup>
@@ -3009,7 +3019,7 @@ Entrypoint overrides container executable
30093019

30103020
### .spec.id.nodeAffinity
30113021

3012-
Type: `core.NodeAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L48)</sup>
3022+
Type: `core.NodeAffinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L52)</sup>
30133023

30143024
NodeAffinity specified additional nodeAffinity settings in ArangoDB Pod definitions
30153025

@@ -3020,23 +3030,23 @@ Links:
30203030

30213031
### .spec.id.nodeSelector
30223032

3023-
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L34)</sup>
3033+
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L38)</sup>
30243034

30253035
NodeSelector specifies a set of selectors for nodes
30263036

30273037
***
30283038

30293039
### .spec.id.priorityClassName
30303040

3031-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L36)</sup>
3041+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L40)</sup>
30323042

30333043
PriorityClassName specifies a priority class name
30343044

30353045
***
30363046

30373047
### .spec.id.resources
30383048

3039-
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L56)</sup>
3049+
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L60)</sup>
30403050

30413051
Resources holds resource requests & limits
30423052

@@ -3173,15 +3183,15 @@ sysctls:
31733183

31743184
### .spec.id.serviceAccountName
31753185

3176-
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L50)</sup>
3186+
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L54)</sup>
31773187

31783188
ServiceAccountName specifies the name of the service account used for Pods in this group.
31793189

31803190
***
31813191

31823192
### .spec.id.tolerations
31833193

3184-
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L32)</sup>
3194+
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.35/pkg/apis/deployment/v1/server_id_group_spec.go#L36)</sup>
31853195

31863196
Tolerations specifies the tolerations added to Pods in this group.
31873197

pkg/apis/deployment/v1/server_id_group_spec.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ import core "k8s.io/api/core/v1"
2626
type ServerIDGroupSpec struct {
2727
// Entrypoint overrides container executable
2828
Entrypoint *string `json:"entrypoint,omitempty"`
29+
// Args setting specifies additional command-line arguments passed to all servers of this group.
30+
// +doc/type: []string
31+
// +doc/default: []
32+
Args []string `json:"args,omitempty"`
2933
// Tolerations specifies the tolerations added to Pods in this group.
3034
// +doc/type: []core.Toleration
3135
// +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core

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

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

pkg/apis/deployment/v2alpha1/server_id_group_spec.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ import core "k8s.io/api/core/v1"
2626
type ServerIDGroupSpec struct {
2727
// Entrypoint overrides container executable
2828
Entrypoint *string `json:"entrypoint,omitempty"`
29+
// Args setting specifies additional command-line arguments passed to all servers of this group.
30+
// +doc/type: []string
31+
// +doc/default: []
32+
Args []string `json:"args,omitempty"`
2933
// Tolerations specifies the tolerations added to Pods in this group.
3034
// +doc/type: []core.Toleration
3135
// +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core

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

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

pkg/crd/crds/database-deployment.schema.generated.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6461,6 +6461,11 @@ v1:
64616461
type: object
64626462
type: array
64636463
type: object
6464+
args:
6465+
description: Args setting specifies additional command-line arguments passed to all servers of this group.
6466+
items:
6467+
type: string
6468+
type: array
64646469
entrypoint:
64656470
description: Entrypoint overrides container executable
64666471
type: string
@@ -19620,6 +19625,11 @@ v1alpha:
1962019625
type: object
1962119626
type: array
1962219627
type: object
19628+
args:
19629+
description: Args setting specifies additional command-line arguments passed to all servers of this group.
19630+
items:
19631+
type: string
19632+
type: array
1962319633
entrypoint:
1962419634
description: Entrypoint overrides container executable
1962519635
type: string
@@ -32779,6 +32789,11 @@ v2alpha1:
3277932789
type: object
3278032790
type: array
3278132791
type: object
32792+
args:
32793+
description: Args setting specifies additional command-line arguments passed to all servers of this group.
32794+
items:
32795+
type: string
32796+
type: array
3278232797
entrypoint:
3278332798
description: Entrypoint overrides container executable
3278432799
type: string

pkg/deployment/images.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ type ContainerIdentity struct {
7070
type ArangoDIdentity struct {
7171
interfaces.ContainerCreator
7272
input pod.Input
73+
ID *api.ServerIDGroupSpec
7374
License *string
7475
ipAddress string
7576
}
@@ -238,6 +239,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
238239
image: image,
239240
imagePullPolicy: ib.Spec.GetImagePullPolicy(),
240241
},
242+
ID: ib.Spec.ID,
241243
License: license,
242244
ipAddress: ib.Spec.GetListenAddr(),
243245
},
@@ -460,7 +462,12 @@ func (a *ArangoDIdentity) GetCommand() ([]string, error) {
460462
// Security
461463
options.Merge(pod.Security().Args(a.input))
462464

463-
return options.Copy().Sort().AsArgsWithCommand(a.GetExecutor()), nil
465+
args := options.Copy().Sort().AsArgsWithCommand(a.GetExecutor())
466+
if added := a.ID.Get().Args; len(added) > 0 {
467+
args = append(args, added...)
468+
}
469+
470+
return args, nil
464471
}
465472

466473
// GetEnvs returns environment variables for Arango identity containers.

pkg/deployment/images_test.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,52 @@ func TestEnsureImages(t *testing.T) {
112112
},
113113
},
114114
},
115+
{
116+
Name: "Image has been changed with custom args",
117+
ArangoDeployment: &api.ArangoDeployment{
118+
Spec: api.DeploymentSpec{
119+
Image: util.NewType[string](testNewImage),
120+
121+
ID: &api.ServerIDGroupSpec{
122+
Args: []string{
123+
"--my-custom-arg",
124+
},
125+
},
126+
},
127+
},
128+
RetrySoon: true,
129+
ExpectedPod: core.Pod{
130+
Spec: core.PodSpec{
131+
Volumes: []core.Volume{
132+
k8sutil.CreateVolumeEmptyDir(shared.ArangodVolumeName),
133+
},
134+
Containers: []core.Container{
135+
{
136+
Name: shared.ServerContainerName,
137+
Image: testNewImage,
138+
Command: append(createTestCommandForImageUpdatePod(), "--my-custom-arg"),
139+
Ports: createTestPorts(api.ServerGroupAgents),
140+
Resources: core.ResourceRequirements{
141+
Limits: make(core.ResourceList),
142+
Requests: make(core.ResourceList),
143+
},
144+
VolumeMounts: []core.VolumeMount{
145+
k8sutil.ArangodVolumeMount(),
146+
},
147+
ImagePullPolicy: core.PullIfNotPresent,
148+
SecurityContext: securityContext.NewSecurityContext(),
149+
},
150+
},
151+
RestartPolicy: core.RestartPolicyNever,
152+
Tolerations: getTestTolerations(),
153+
TerminationGracePeriodSeconds: &terminationGracePeriodSeconds,
154+
Hostname: hostname,
155+
Subdomain: testDeploymentName + "-int",
156+
Affinity: k8sutil.CreateAffinity(testDeploymentName,
157+
api.ServerGroupImageDiscovery.AsRole(), false, ""),
158+
},
159+
},
160+
},
115161
{
116162
Before: func(t *testing.T, deployment *Deployment) {
117163
c := deployment.acs.CurrentClusterCache()

0 commit comments

Comments
 (0)