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:
parent
d482e4283a
commit
6aaa93ae5d
9 changed files with 106 additions and 9 deletions
|
@ -39,6 +39,7 @@
|
|||
- (Feature) (ML) Support for deployments with JWT auth enabled
|
||||
- (Feature) (ML) GPU Jobs
|
||||
- (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)
|
||||
- (Maintenance) Update go-driver to v1.6.0, update IsNotFound() checks
|
||||
|
|
|
@ -2979,7 +2979,7 @@ Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.
|
|||
|
||||
### .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
|
||||
|
||||
|
@ -2990,7 +2990,7 @@ Links:
|
|||
|
||||
### .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
|
||||
|
||||
|
@ -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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
@ -3020,7 +3030,7 @@ Links:
|
|||
|
||||
### .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
|
||||
|
||||
|
@ -3028,7 +3038,7 @@ NodeSelector specifies a set of selectors for nodes
|
|||
|
||||
### .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
|
||||
|
||||
|
@ -3036,7 +3046,7 @@ PriorityClassName specifies a priority class name
|
|||
|
||||
### .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
|
||||
|
||||
|
@ -3173,7 +3183,7 @@ sysctls:
|
|||
|
||||
### .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.
|
||||
|
||||
|
@ -3181,7 +3191,7 @@ ServiceAccountName specifies the name of the service account used for Pods in th
|
|||
|
||||
### .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.
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ import core "k8s.io/api/core/v1"
|
|||
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.26/#toleration-v1-core
|
||||
|
|
5
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
5
pkg/apis/deployment/v1/zz_generated.deepcopy.go
generated
|
@ -2961,6 +2961,11 @@ func (in *ServerIDGroupSpec) DeepCopyInto(out *ServerIDGroupSpec) {
|
|||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Args != nil {
|
||||
in, out := &in.Args, &out.Args
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Tolerations != nil {
|
||||
in, out := &in.Tolerations, &out.Tolerations
|
||||
*out = make([]corev1.Toleration, len(*in))
|
||||
|
|
|
@ -26,6 +26,10 @@ import core "k8s.io/api/core/v1"
|
|||
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.26/#toleration-v1-core
|
||||
|
|
|
@ -2961,6 +2961,11 @@ func (in *ServerIDGroupSpec) DeepCopyInto(out *ServerIDGroupSpec) {
|
|||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Args != nil {
|
||||
in, out := &in.Args, &out.Args
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Tolerations != nil {
|
||||
in, out := &in.Tolerations, &out.Tolerations
|
||||
*out = make([]v1.Toleration, len(*in))
|
||||
|
|
|
@ -6461,6 +6461,11 @@ v1:
|
|||
type: object
|
||||
type: array
|
||||
type: object
|
||||
args:
|
||||
description: Args setting specifies additional command-line arguments passed to all servers of this group.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
entrypoint:
|
||||
description: Entrypoint overrides container executable
|
||||
type: string
|
||||
|
@ -19620,6 +19625,11 @@ v1alpha:
|
|||
type: object
|
||||
type: array
|
||||
type: object
|
||||
args:
|
||||
description: Args setting specifies additional command-line arguments passed to all servers of this group.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
entrypoint:
|
||||
description: Entrypoint overrides container executable
|
||||
type: string
|
||||
|
@ -32779,6 +32789,11 @@ v2alpha1:
|
|||
type: object
|
||||
type: array
|
||||
type: object
|
||||
args:
|
||||
description: Args setting specifies additional command-line arguments passed to all servers of this group.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
entrypoint:
|
||||
description: Entrypoint overrides container executable
|
||||
type: string
|
||||
|
|
|
@ -70,6 +70,7 @@ type ContainerIdentity struct {
|
|||
type ArangoDIdentity struct {
|
||||
interfaces.ContainerCreator
|
||||
input pod.Input
|
||||
ID *api.ServerIDGroupSpec
|
||||
License *string
|
||||
ipAddress string
|
||||
}
|
||||
|
@ -238,6 +239,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
|
|||
image: image,
|
||||
imagePullPolicy: ib.Spec.GetImagePullPolicy(),
|
||||
},
|
||||
ID: ib.Spec.ID,
|
||||
License: license,
|
||||
ipAddress: ib.Spec.GetListenAddr(),
|
||||
},
|
||||
|
@ -460,7 +462,12 @@ func (a *ArangoDIdentity) GetCommand() ([]string, error) {
|
|||
// Security
|
||||
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.
|
||||
|
|
|
@ -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) {
|
||||
c := deployment.acs.CurrentClusterCache()
|
||||
|
|
Loading…
Reference in a new issue