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

[Feature] Pass Arguments to ID Group (#1551)

This commit is contained in:
Adam Janikowski 2023-12-27 10:15:22 +01:00 committed by GitHub
parent d482e4283a
commit 6aaa93ae5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 106 additions and 9 deletions

View file

@ -39,6 +39,7 @@
- (Feature) (ML) Support for deployments with JWT auth enabled - (Feature) (ML) Support for deployments with JWT auth enabled
- (Feature) (ML) GPU Jobs - (Feature) (ML) GPU Jobs
- (Feature) (ML) Container Envs - (Feature) (ML) Container Envs
- (Feature) Pass Arguments to ID Group
## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06) ## [1.2.35](https://github.com/arangodb/kube-arangodb/tree/1.2.35) (2023-11-06)
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks - (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks

View file

@ -2979,7 +2979,7 @@ Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.
### .spec.id.affinity ### .spec.id.affinity
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> 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>
Affinity specified additional affinity settings in ArangoDB Pod definitions Affinity specified additional affinity settings in ArangoDB Pod definitions
@ -2990,7 +2990,7 @@ Links:
### .spec.id.antiAffinity ### .spec.id.antiAffinity
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> 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>
AntiAffinity specified additional antiAffinity settings in ArangoDB Pod definitions AntiAffinity specified additional antiAffinity settings in ArangoDB Pod definitions
@ -2999,6 +2999,16 @@ Links:
*** ***
### .spec.id.args
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>
Args setting specifies additional command-line arguments passed to all servers of this group.
Default Value: `[]`
***
### .spec.id.entrypoint ### .spec.id.entrypoint
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> 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
### .spec.id.nodeAffinity ### .spec.id.nodeAffinity
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> 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>
NodeAffinity specified additional nodeAffinity settings in ArangoDB Pod definitions NodeAffinity specified additional nodeAffinity settings in ArangoDB Pod definitions
@ -3020,7 +3030,7 @@ Links:
### .spec.id.nodeSelector ### .spec.id.nodeSelector
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> 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>
NodeSelector specifies a set of selectors for nodes NodeSelector specifies a set of selectors for nodes
@ -3028,7 +3038,7 @@ NodeSelector specifies a set of selectors for nodes
### .spec.id.priorityClassName ### .spec.id.priorityClassName
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> 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>
PriorityClassName specifies a priority class name PriorityClassName specifies a priority class name
@ -3036,7 +3046,7 @@ PriorityClassName specifies a priority class name
### .spec.id.resources ### .spec.id.resources
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> 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>
Resources holds resource requests & limits Resources holds resource requests & limits
@ -3173,7 +3183,7 @@ sysctls:
### .spec.id.serviceAccountName ### .spec.id.serviceAccountName
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> 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>
ServiceAccountName specifies the name of the service account used for Pods in this group. ServiceAccountName specifies the name of the service account used for Pods in this group.
@ -3181,7 +3191,7 @@ ServiceAccountName specifies the name of the service account used for Pods in th
### .spec.id.tolerations ### .spec.id.tolerations
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> 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>
Tolerations specifies the tolerations added to Pods in this group. Tolerations specifies the tolerations added to Pods in this group.

View file

@ -26,6 +26,10 @@ import core "k8s.io/api/core/v1"
type ServerIDGroupSpec struct { type ServerIDGroupSpec struct {
// Entrypoint overrides container executable // Entrypoint overrides container executable
Entrypoint *string `json:"entrypoint,omitempty"` 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. // Tolerations specifies the tolerations added to Pods in this group.
// +doc/type: []core.Toleration // +doc/type: []core.Toleration
// +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core // +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core

View file

@ -2961,6 +2961,11 @@ func (in *ServerIDGroupSpec) DeepCopyInto(out *ServerIDGroupSpec) {
*out = new(string) *out = new(string)
**out = **in **out = **in
} }
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Tolerations != nil { if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations in, out := &in.Tolerations, &out.Tolerations
*out = make([]corev1.Toleration, len(*in)) *out = make([]corev1.Toleration, len(*in))

View file

@ -26,6 +26,10 @@ import core "k8s.io/api/core/v1"
type ServerIDGroupSpec struct { type ServerIDGroupSpec struct {
// Entrypoint overrides container executable // Entrypoint overrides container executable
Entrypoint *string `json:"entrypoint,omitempty"` 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. // Tolerations specifies the tolerations added to Pods in this group.
// +doc/type: []core.Toleration // +doc/type: []core.Toleration
// +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core // +doc/link: Documentation of core.Toleration|https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core

View file

@ -2961,6 +2961,11 @@ func (in *ServerIDGroupSpec) DeepCopyInto(out *ServerIDGroupSpec) {
*out = new(string) *out = new(string)
**out = **in **out = **in
} }
if in.Args != nil {
in, out := &in.Args, &out.Args
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Tolerations != nil { if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations in, out := &in.Tolerations, &out.Tolerations
*out = make([]v1.Toleration, len(*in)) *out = make([]v1.Toleration, len(*in))

View file

@ -6461,6 +6461,11 @@ v1:
type: object type: object
type: array type: array
type: object type: object
args:
description: Args setting specifies additional command-line arguments passed to all servers of this group.
items:
type: string
type: array
entrypoint: entrypoint:
description: Entrypoint overrides container executable description: Entrypoint overrides container executable
type: string type: string
@ -19620,6 +19625,11 @@ v1alpha:
type: object type: object
type: array type: array
type: object type: object
args:
description: Args setting specifies additional command-line arguments passed to all servers of this group.
items:
type: string
type: array
entrypoint: entrypoint:
description: Entrypoint overrides container executable description: Entrypoint overrides container executable
type: string type: string
@ -32779,6 +32789,11 @@ v2alpha1:
type: object type: object
type: array type: array
type: object type: object
args:
description: Args setting specifies additional command-line arguments passed to all servers of this group.
items:
type: string
type: array
entrypoint: entrypoint:
description: Entrypoint overrides container executable description: Entrypoint overrides container executable
type: string type: string

View file

@ -70,6 +70,7 @@ type ContainerIdentity struct {
type ArangoDIdentity struct { type ArangoDIdentity struct {
interfaces.ContainerCreator interfaces.ContainerCreator
input pod.Input input pod.Input
ID *api.ServerIDGroupSpec
License *string License *string
ipAddress string ipAddress string
} }
@ -238,6 +239,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
image: image, image: image,
imagePullPolicy: ib.Spec.GetImagePullPolicy(), imagePullPolicy: ib.Spec.GetImagePullPolicy(),
}, },
ID: ib.Spec.ID,
License: license, License: license,
ipAddress: ib.Spec.GetListenAddr(), ipAddress: ib.Spec.GetListenAddr(),
}, },
@ -460,7 +462,12 @@ func (a *ArangoDIdentity) GetCommand() ([]string, error) {
// Security // Security
options.Merge(pod.Security().Args(a.input)) options.Merge(pod.Security().Args(a.input))
return options.Copy().Sort().AsArgsWithCommand(a.GetExecutor()), nil args := options.Copy().Sort().AsArgsWithCommand(a.GetExecutor())
if added := a.ID.Get().Args; len(added) > 0 {
args = append(args, added...)
}
return args, nil
} }
// GetEnvs returns environment variables for Arango identity containers. // GetEnvs returns environment variables for Arango identity containers.

View file

@ -112,6 +112,52 @@ func TestEnsureImages(t *testing.T) {
}, },
}, },
}, },
{
Name: "Image has been changed with custom args",
ArangoDeployment: &api.ArangoDeployment{
Spec: api.DeploymentSpec{
Image: util.NewType[string](testNewImage),
ID: &api.ServerIDGroupSpec{
Args: []string{
"--my-custom-arg",
},
},
},
},
RetrySoon: true,
ExpectedPod: core.Pod{
Spec: core.PodSpec{
Volumes: []core.Volume{
k8sutil.CreateVolumeEmptyDir(shared.ArangodVolumeName),
},
Containers: []core.Container{
{
Name: shared.ServerContainerName,
Image: testNewImage,
Command: append(createTestCommandForImageUpdatePod(), "--my-custom-arg"),
Ports: createTestPorts(api.ServerGroupAgents),
Resources: core.ResourceRequirements{
Limits: make(core.ResourceList),
Requests: make(core.ResourceList),
},
VolumeMounts: []core.VolumeMount{
k8sutil.ArangodVolumeMount(),
},
ImagePullPolicy: core.PullIfNotPresent,
SecurityContext: securityContext.NewSecurityContext(),
},
},
RestartPolicy: core.RestartPolicyNever,
Tolerations: getTestTolerations(),
TerminationGracePeriodSeconds: &terminationGracePeriodSeconds,
Hostname: hostname,
Subdomain: testDeploymentName + "-int",
Affinity: k8sutil.CreateAffinity(testDeploymentName,
api.ServerGroupImageDiscovery.AsRole(), false, ""),
},
},
},
{ {
Before: func(t *testing.T, deployment *Deployment) { Before: func(t *testing.T, deployment *Deployment) {
c := deployment.acs.CurrentClusterCache() c := deployment.acs.CurrentClusterCache()