From e1e9d3f29118d048abaa0f031d9c07e7897284b5 Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Wed, 11 Sep 2024 16:25:10 +0200 Subject: [PATCH] [Feature] [Scheduler] Merge Strategy (#1721) --- .golangci.yaml | 2 + CHANGELOG.md | 1 + Makefile | 6 +- docs/api/ArangoDeployment.V1.md | 22 ++- docs/api/ArangoMLExtension.V1Beta1.md | 166 +++++++++++++++--- docs/api/ArangoProfile.V1Beta1.md | 20 ++- docs/api/GraphAnalyticsEngine.V1Alpha1.md | 40 ++++- internal/docs_test.go | 4 + .../v1beta1/container/resources/core.go | 24 ++- .../v1beta1/container/resources/core_test.go | 25 +++ .../resources/zz_generated.deepcopy.go | 6 + pkg/apis/scheduler/v1beta1/policy/doc.go | 23 +++ pkg/apis/scheduler/v1beta1/policy/merge.go | 71 ++++++++ .../v1beta1/policy/zz_generated.deepcopy.go | 47 +++++ ...graphanalyticsengine.schema.generated.yaml | 4 + .../database-deployment.schema.generated.yaml | 6 + .../crds/ml-extension.schema.generated.yaml | 18 ++ .../scheduler-profile.schema.generated.yaml | 2 + 18 files changed, 438 insertions(+), 49 deletions(-) create mode 100644 pkg/apis/scheduler/v1beta1/policy/doc.go create mode 100644 pkg/apis/scheduler/v1beta1/policy/merge.go create mode 100644 pkg/apis/scheduler/v1beta1/policy/zz_generated.deepcopy.go diff --git a/.golangci.yaml b/.golangci.yaml index 75382a541..506e35a75 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -81,6 +81,8 @@ linters-settings: pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/container/resources - alias: schedulerIntegrationApi pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/integration + - alias: schedulerPolicyApi + pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/policy - alias: schedulerPodApi pkg: github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/pod - alias: schedulerPodResourcesApi diff --git a/CHANGELOG.md b/CHANGELOG.md index 83fadf30e..ae68b18c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ - (Feature) DebugPackage ArangoRoutes - (Feature) (Scheduler) Add Status Conditions - (Bugfix) Versioning Alignment +- (Feature) (Scheduler) Merge Strategy ## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23) - (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries diff --git a/Makefile b/Makefile index 44c42ed84..c59780eb2 100644 --- a/Makefile +++ b/Makefile @@ -452,7 +452,7 @@ update-generated: "github.com/arangodb/kube-arangodb/pkg/apis" \ "shared:v1 \ scheduler:v1alpha1/container scheduler:v1alpha1/container/resources scheduler:v1alpha1/pod scheduler:v1alpha1/pod/resources \ - scheduler:v1beta1/integration scheduler:v1beta1/container scheduler:v1beta1/container/resources scheduler:v1beta1/pod scheduler:v1beta1/pod/resources" \ + scheduler:v1beta1/integration scheduler:v1beta1/policy scheduler:v1beta1/container scheduler:v1beta1/container/resources scheduler:v1beta1/pod scheduler:v1beta1/pod/resources" \ --go-header-file "./tools/codegen/boilerplate.go.txt" \ $(VERIFYARGS) @@ -815,6 +815,7 @@ set-typed-api-version/%: "$(ROOT)/pkg/handlers/" \ "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/apis/networking/" \ + "$(ROOT)/pkg/apis/scheduler/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ | xargs -n 1 $(SED) -i "s#github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/$*/v[A-Za-z0-9]\+#github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/$*/v$(API_VERSION)#g" @@ -832,6 +833,7 @@ set-api-version/%: "$(ROOT)/pkg/handlers/" \ "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/apis/networking/" \ + "$(ROOT)/pkg/apis/scheduler/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ | xargs -n 1 $(SED) -i "s#github.com/arangodb/kube-arangodb/pkg/apis/$*/v[A-Za-z0-9]\+#github.com/arangodb/kube-arangodb/pkg/apis/$*/v$(API_VERSION)#g" @@ -846,6 +848,7 @@ set-api-version/%: "$(ROOT)/pkg/handlers/" \ "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/apis/networking/" \ + "$(ROOT)/pkg/apis/scheduler/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ | xargs -n 1 $(SED) -i "s#DatabaseV[A-Za-z0-9]\+()\.#DatabaseV$(API_VERSION)().#g" @@ -860,6 +863,7 @@ set-api-version/%: "$(ROOT)/pkg/handlers" \ "$(ROOT)/pkg/apis/backup/" \ "$(ROOT)/pkg/apis/networking/" \ + "$(ROOT)/pkg/apis/scheduler/" \ "$(ROOT)/pkg/upgrade/" \ | cut -d ':' -f 1 | sort | uniq \ | xargs -n 1 $(SED) -i "s#ReplicationV[A-Za-z0-9]\+()\.#ReplicationV$(API_VERSION)().#g" diff --git a/docs/api/ArangoDeployment.V1.md b/docs/api/ArangoDeployment.V1.md index 04e56360b..046dbba1d 100644 --- a/docs/api/ArangoDeployment.V1.md +++ b/docs/api/ArangoDeployment.V1.md @@ -3076,7 +3076,7 @@ By default, the image is determined by the operator. ### .spec.gateway.sidecar.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -3093,7 +3093,7 @@ Links: ### .spec.gateway.sidecar.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -3110,7 +3110,7 @@ Links: ### .spec.gateway.sidecar.controllerListenPort -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L16) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L36) ControllerListenPort defines on which port the sidecar container will be listening for controller requests @@ -3168,7 +3168,7 @@ Lifecycle keeps actions that the management system should take in response to co ### .spec.gateway.sidecar.listenPort -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L12) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L32) ListenPort defines on which port the sidecar container will be listening for connections @@ -3188,6 +3188,18 @@ Links: *** +### .spec.gateway.sidecar.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.gateway.sidecar.ports Type: `[]core.ContainerPort` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/networking.go#L39) @@ -3258,7 +3270,7 @@ VolumeMounts keeps list of pod volumes to mount into the container's filesystem. ### .spec.gateway.sidecar.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which diff --git a/docs/api/ArangoMLExtension.V1Beta1.md b/docs/api/ArangoMLExtension.V1Beta1.md index 88f954fcd..729fafd28 100644 --- a/docs/api/ArangoMLExtension.V1Beta1.md +++ b/docs/api/ArangoMLExtension.V1Beta1.md @@ -34,7 +34,7 @@ Links: ### .spec.deployment.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -59,7 +59,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.deployment.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -196,6 +196,18 @@ Links: *** +### .spec.deployment.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.deployment.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -408,7 +420,7 @@ Links: ### .spec.deployment.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -442,7 +454,7 @@ Links: ### .spec.init.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -467,7 +479,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.init.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -594,6 +606,18 @@ Links: *** +### .spec.init.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.init.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -754,7 +778,7 @@ Links: ### .spec.init.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -764,7 +788,7 @@ might be configured in the container image. ### .spec.integrationSidecar.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -781,7 +805,7 @@ Links: ### .spec.integrationSidecar.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -798,7 +822,7 @@ Links: ### .spec.integrationSidecar.controllerListenPort -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L16) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L36) ControllerListenPort defines on which port the sidecar container will be listening for controller requests @@ -856,7 +880,7 @@ Lifecycle keeps actions that the management system should take in response to co ### .spec.integrationSidecar.listenPort -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L12) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L32) ListenPort defines on which port the sidecar container will be listening for connections @@ -876,6 +900,18 @@ Links: *** +### .spec.integrationSidecar.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.integrationSidecar.ports Type: `[]core.ContainerPort` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/networking.go#L39) @@ -946,7 +982,7 @@ VolumeMounts keeps list of pod volumes to mount into the container's filesystem. ### .spec.integrationSidecar.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -980,7 +1016,7 @@ Links: ### .spec.jobsTemplates.featurization.cpu.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -1005,7 +1041,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.jobsTemplates.featurization.cpu.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -1132,6 +1168,18 @@ Links: *** +### .spec.jobsTemplates.featurization.cpu.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.jobsTemplates.featurization.cpu.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -1292,7 +1340,7 @@ Links: ### .spec.jobsTemplates.featurization.cpu.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -1326,7 +1374,7 @@ Links: ### .spec.jobsTemplates.featurization.gpu.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -1351,7 +1399,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.jobsTemplates.featurization.gpu.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -1478,6 +1526,18 @@ Links: *** +### .spec.jobsTemplates.featurization.gpu.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.jobsTemplates.featurization.gpu.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -1638,7 +1698,7 @@ Links: ### .spec.jobsTemplates.featurization.gpu.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -1672,7 +1732,7 @@ Links: ### .spec.jobsTemplates.prediction.cpu.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -1697,7 +1757,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.jobsTemplates.prediction.cpu.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -1824,6 +1884,18 @@ Links: *** +### .spec.jobsTemplates.prediction.cpu.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.jobsTemplates.prediction.cpu.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -1984,7 +2056,7 @@ Links: ### .spec.jobsTemplates.prediction.cpu.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -2018,7 +2090,7 @@ Links: ### .spec.jobsTemplates.prediction.gpu.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -2043,7 +2115,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.jobsTemplates.prediction.gpu.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -2170,6 +2242,18 @@ Links: *** +### .spec.jobsTemplates.prediction.gpu.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.jobsTemplates.prediction.gpu.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -2330,7 +2414,7 @@ Links: ### .spec.jobsTemplates.prediction.gpu.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -2364,7 +2448,7 @@ Links: ### .spec.jobsTemplates.training.cpu.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -2389,7 +2473,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.jobsTemplates.training.cpu.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -2516,6 +2600,18 @@ Links: *** +### .spec.jobsTemplates.training.cpu.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.jobsTemplates.training.cpu.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -2676,7 +2772,7 @@ Links: ### .spec.jobsTemplates.training.cpu.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -2710,7 +2806,7 @@ Links: ### .spec.jobsTemplates.training.gpu.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -2735,7 +2831,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.jobsTemplates.training.gpu.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -2862,6 +2958,18 @@ Links: *** +### .spec.jobsTemplates.training.gpu.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.jobsTemplates.training.gpu.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -3022,7 +3130,7 @@ Links: ### .spec.jobsTemplates.training.gpu.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which diff --git a/docs/api/ArangoProfile.V1Beta1.md b/docs/api/ArangoProfile.V1Beta1.md index fd6c2d6f7..df8c51628 100644 --- a/docs/api/ArangoProfile.V1Beta1.md +++ b/docs/api/ArangoProfile.V1Beta1.md @@ -48,7 +48,7 @@ VolumeMounts keeps list of pod volumes to mount into the container's filesystem. ### .spec.template.container.containers.\.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -65,7 +65,7 @@ Links: ### .spec.template.container.containers.\.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -140,6 +140,18 @@ Links: *** +### .spec.template.container.containers.\.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.template.container.containers.\.ports Type: `[]core.ContainerPort` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/networking.go#L39) @@ -210,7 +222,7 @@ VolumeMounts keeps list of pod volumes to mount into the container's filesystem. ### .spec.template.container.containers.\.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -394,5 +406,5 @@ Links: ### .spec.template.priority -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/profile_template.go#L31) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/profile_template.go#L32) diff --git a/docs/api/GraphAnalyticsEngine.V1Alpha1.md b/docs/api/GraphAnalyticsEngine.V1Alpha1.md index 45ba05dd3..382e51bb1 100644 --- a/docs/api/GraphAnalyticsEngine.V1Alpha1.md +++ b/docs/api/GraphAnalyticsEngine.V1Alpha1.md @@ -34,7 +34,7 @@ Links: ### .spec.deployment.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -59,7 +59,7 @@ AutomountServiceAccountToken indicates whether a service account token should be ### .spec.deployment.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -186,6 +186,18 @@ Links: *** +### .spec.deployment.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.deployment.nodeSelector Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/pod/resources/scheduling.go#L39) @@ -388,7 +400,7 @@ Links: ### .spec.deployment.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which @@ -406,7 +418,7 @@ DeploymentName define deployment name used in the object. Immutable ### .spec.integrationSidecar.args -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L50) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L54) Arguments to the entrypoint. The container image's CMD is used if this is not provided. @@ -423,7 +435,7 @@ Links: ### .spec.integrationSidecar.command -Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L40) +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L44) Entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided. @@ -440,7 +452,7 @@ Links: ### .spec.integrationSidecar.controllerListenPort -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L16) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L36) ControllerListenPort defines on which port the sidecar container will be listening for controller requests @@ -498,7 +510,7 @@ Lifecycle keeps actions that the management system should take in response to co ### .spec.integrationSidecar.listenPort -Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L12) +Type: `integer` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/integration/integration.go#L32) ListenPort defines on which port the sidecar container will be listening for connections @@ -518,6 +530,18 @@ Links: *** +### .spec.integrationSidecar.method + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/policy/merge.go#L32) + +Method defines the merge method + +Possible Values: +* `"override"` (default) - Overrides values during configuration merge +* `"append"` - Appends, if possible, values during configuration merge + +*** + ### .spec.integrationSidecar.ports Type: `[]core.ContainerPort` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/networking.go#L39) @@ -588,7 +612,7 @@ VolumeMounts keeps list of pod volumes to mount into the container's filesystem. ### .spec.integrationSidecar.workingDir -Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L55) +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/scheduler/v1beta1/container/resources/core.go#L59) Container's working directory. If not specified, the container runtime's default will be used, which diff --git a/internal/docs_test.go b/internal/docs_test.go index d2b4b7541..765c969c9 100644 --- a/internal/docs_test.go +++ b/internal/docs_test.go @@ -183,6 +183,7 @@ func Test_GenerateAPIDocs(t *testing.T) { "scheduler/v1beta1/integration", "scheduler/v1beta1/pod", "scheduler/v1beta1/pod/resources", + "scheduler/v1beta1/policy", }, }, }, @@ -257,6 +258,7 @@ func Test_GenerateAPIDocs(t *testing.T) { "scheduler/v1beta1/integration", "scheduler/v1beta1/pod", "scheduler/v1beta1/pod/resources", + "scheduler/v1beta1/policy", }, }, }, @@ -289,6 +291,7 @@ func Test_GenerateAPIDocs(t *testing.T) { "scheduler/v1beta1/integration", "scheduler/v1beta1/pod", "scheduler/v1beta1/pod/resources", + "scheduler/v1beta1/policy", }, }, }, @@ -329,6 +332,7 @@ func Test_GenerateAPIDocs(t *testing.T) { "scheduler/v1beta1/integration", "scheduler/v1beta1/pod", "scheduler/v1beta1/pod/resources", + "scheduler/v1beta1/policy", }, }, }, diff --git a/pkg/apis/scheduler/v1beta1/container/resources/core.go b/pkg/apis/scheduler/v1beta1/container/resources/core.go index a36e72049..af14419c9 100644 --- a/pkg/apis/scheduler/v1beta1/container/resources/core.go +++ b/pkg/apis/scheduler/v1beta1/container/resources/core.go @@ -24,11 +24,15 @@ import ( core "k8s.io/api/core/v1" "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/interfaces" + schedulerPolicyApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/policy" + shared "github.com/arangodb/kube-arangodb/pkg/apis/shared" ) var _ interfaces.Container[Core] = &Core{} type Core struct { + *schedulerPolicyApi.Policy `json:",inline"` + // Entrypoint array. Not executed within a shell. // The container image's ENTRYPOINT is used if this is not provided. // Variable references $(VAR_NAME) are expanded using the container's environment. If a variable @@ -78,9 +82,25 @@ func (c *Core) With(other *Core) *Core { return c.DeepCopy() } - return other.DeepCopy() + if c == nil { + return other.DeepCopy() + } + + o := other.DeepCopy() + + if o.GetMethod(schedulerPolicyApi.Override) == schedulerPolicyApi.Append { + o.Args = append(c.Args, o.Args...) + } + + return o } func (c *Core) Validate() error { - return nil + if c == nil { + return nil + } + + return shared.WithErrors( + shared.ValidateOptionalInterface(c.Policy), + ) } diff --git a/pkg/apis/scheduler/v1beta1/container/resources/core_test.go b/pkg/apis/scheduler/v1beta1/container/resources/core_test.go index f26fcd863..98d8e9aa2 100644 --- a/pkg/apis/scheduler/v1beta1/container/resources/core_test.go +++ b/pkg/apis/scheduler/v1beta1/container/resources/core_test.go @@ -25,6 +25,9 @@ import ( "github.com/stretchr/testify/require" core "k8s.io/api/core/v1" + + schedulerPolicyApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/policy" + "github.com/arangodb/kube-arangodb/pkg/util" ) func applyCore(t *testing.T, template *core.PodTemplateSpec, container *core.Container, ns ...*Core) func(in func(t *testing.T, pod *core.PodTemplateSpec, container *core.Container)) { @@ -101,6 +104,28 @@ func Test_Core(t *testing.T) { require.Len(t, container.Command, 1) require.Contains(t, container.Command, "B") + require.EqualValues(t, "", container.WorkingDir) + }) + }) + t.Run("With Append", func(t *testing.T) { + applyCore(t, &core.PodTemplateSpec{}, &core.Container{}, &Core{ + Command: []string{"B"}, + Args: []string{"A"}, + }, &Core{ + Policy: &schedulerPolicyApi.Policy{ + Method: util.NewType(schedulerPolicyApi.Append), + }, + Command: []string{"C"}, + Args: []string{"D"}, + })(func(t *testing.T, _ *core.PodTemplateSpec, container *core.Container) { + require.Len(t, container.Args, 2) + require.Contains(t, container.Args, "A") + require.Contains(t, container.Args, "D") + require.Equal(t, []string{"A", "D"}, container.Args) + + require.Len(t, container.Command, 1) + require.Contains(t, container.Command, "C") + require.EqualValues(t, "", container.WorkingDir) }) }) diff --git a/pkg/apis/scheduler/v1beta1/container/resources/zz_generated.deepcopy.go b/pkg/apis/scheduler/v1beta1/container/resources/zz_generated.deepcopy.go index 1a201856b..a73ccbc03 100644 --- a/pkg/apis/scheduler/v1beta1/container/resources/zz_generated.deepcopy.go +++ b/pkg/apis/scheduler/v1beta1/container/resources/zz_generated.deepcopy.go @@ -26,12 +26,18 @@ package resources import ( + policy "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/policy" v1 "k8s.io/api/core/v1" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Core) DeepCopyInto(out *Core) { *out = *in + if in.Policy != nil { + in, out := &in.Policy, &out.Policy + *out = new(policy.Policy) + (*in).DeepCopyInto(*out) + } if in.Command != nil { in, out := &in.Command, &out.Command *out = make([]string, len(*in)) diff --git a/pkg/apis/scheduler/v1beta1/policy/doc.go b/pkg/apis/scheduler/v1beta1/policy/doc.go new file mode 100644 index 000000000..264e0d855 --- /dev/null +++ b/pkg/apis/scheduler/v1beta1/policy/doc.go @@ -0,0 +1,23 @@ +// +// DISCLAIMER +// +// Copyright 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 +// + +// +k8s:deepcopy-gen=package +// +groupName=scheduler.arangodb.com +package policy diff --git a/pkg/apis/scheduler/v1beta1/policy/merge.go b/pkg/apis/scheduler/v1beta1/policy/merge.go new file mode 100644 index 000000000..b38889521 --- /dev/null +++ b/pkg/apis/scheduler/v1beta1/policy/merge.go @@ -0,0 +1,71 @@ +// +// DISCLAIMER +// +// Copyright 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 policy + +import ( + shared "github.com/arangodb/kube-arangodb/pkg/apis/shared" + "github.com/arangodb/kube-arangodb/pkg/util/errors" +) + +type Policy struct { + // Method defines the merge method + // +doc/enum: override|Overrides values during configuration merge + // +doc/enum: append|Appends, if possible, values during configuration merge + Method *Method `json:"method,omitempty"` +} + +func (m *Policy) Validate() error { + if m == nil { + return nil + } + + return shared.WithErrors( + shared.PrefixResourceErrors("method", shared.ValidateOptionalInterface(m.Method)), + ) +} + +func (m *Policy) GetMethod(d Method) Method { + if m == nil || m.Method == nil { + return d + } + + return *m.Method +} + +type Method string + +func (m *Method) Validate() error { + if m == nil { + return nil + } + + switch v := *m; v { + case Override, Append: + return nil + default: + return errors.Errorf("Invalid method: %s", v) + } +} + +const ( + Override Method = "override" + Append Method = "append" +) diff --git a/pkg/apis/scheduler/v1beta1/policy/zz_generated.deepcopy.go b/pkg/apis/scheduler/v1beta1/policy/zz_generated.deepcopy.go new file mode 100644 index 000000000..f6e8848b3 --- /dev/null +++ b/pkg/apis/scheduler/v1beta1/policy/zz_generated.deepcopy.go @@ -0,0 +1,47 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +// +// DISCLAIMER +// +// Copyright 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 +// + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package policy + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Policy) DeepCopyInto(out *Policy) { + *out = *in + if in.Method != nil { + in, out := &in.Method, &out.Method + *out = new(Method) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy. +func (in *Policy) DeepCopy() *Policy { + if in == nil { + return nil + } + out := new(Policy) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/crd/crds/analytics-graphanalyticsengine.schema.generated.yaml b/pkg/crd/crds/analytics-graphanalyticsengine.schema.generated.yaml index dd1a76015..2c3f7244f 100644 --- a/pkg/crd/crds/analytics-graphanalyticsengine.schema.generated.yaml +++ b/pkg/crd/crds/analytics-graphanalyticsengine.schema.generated.yaml @@ -594,6 +594,8 @@ v1alpha1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -1898,6 +1900,8 @@ v1alpha1: format: int32 type: integer type: object + method: + type: string ports: items: properties: diff --git a/pkg/crd/crds/database-deployment.schema.generated.yaml b/pkg/crd/crds/database-deployment.schema.generated.yaml index 578c15216..3d73b0b64 100644 --- a/pkg/crd/crds/database-deployment.schema.generated.yaml +++ b/pkg/crd/crds/database-deployment.schema.generated.yaml @@ -6828,6 +6828,8 @@ v1: format: int32 type: integer type: object + method: + type: string ports: items: properties: @@ -23350,6 +23352,8 @@ v1alpha: format: int32 type: integer type: object + method: + type: string ports: items: properties: @@ -39872,6 +39876,8 @@ v2alpha1: format: int32 type: integer type: object + method: + type: string ports: items: properties: diff --git a/pkg/crd/crds/ml-extension.schema.generated.yaml b/pkg/crd/crds/ml-extension.schema.generated.yaml index 8e5288fcf..17e450dfe 100644 --- a/pkg/crd/crds/ml-extension.schema.generated.yaml +++ b/pkg/crd/crds/ml-extension.schema.generated.yaml @@ -13624,6 +13624,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -15262,6 +15264,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -16533,6 +16537,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string ports: items: properties: @@ -17371,6 +17377,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -18987,6 +18995,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -20606,6 +20616,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -22222,6 +22234,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -23841,6 +23855,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string @@ -25457,6 +25473,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string nodeSelector: additionalProperties: type: string diff --git a/pkg/crd/crds/scheduler-profile.schema.generated.yaml b/pkg/crd/crds/scheduler-profile.schema.generated.yaml index 567504299..04ddea193 100644 --- a/pkg/crd/crds/scheduler-profile.schema.generated.yaml +++ b/pkg/crd/crds/scheduler-profile.schema.generated.yaml @@ -2111,6 +2111,8 @@ v1beta1: format: int32 type: integer type: object + method: + type: string ports: items: properties: