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

[Feature] [Scheduler] Introduce Scheduler CRD (#1622)

This commit is contained in:
Adam Janikowski 2024-03-18 11:19:27 +01:00 committed by GitHub
parent 368ad28bfa
commit 31ede22043
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 3178 additions and 4 deletions

View file

@ -5,6 +5,7 @@
- (Feature) Add Metadata fields to the Scheduler Pod Spec
- (Feature) Extend Backup Details in DebugPackage
- (Feature) (ML) Use Scheduler API
- (Feature) (Scheduler) Introduce Scheduler CRD
## [1.2.39](https://github.com/arangodb/kube-arangodb/tree/1.2.39) (2024-03-11)
- (Feature) Extract Scheduler API

View file

@ -856,7 +856,8 @@ CRDS:=apps-job \
backups-backup backups-backuppolicy \
database-clustersynchronization database-deployment database-member database-task \
replication-deploymentreplication \
ml-storage ml-extension ml-job-batch ml-job-cron
ml-storage ml-extension ml-job-batch ml-job-cron \
scheduler-profile
.PHONY: sync-crds
sync-crds:

View file

@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: arangoprofiles.scheduler.arangodb.com
spec:
group: scheduler.arangodb.com
names:
kind: ArangoProfile
listKind: ArangoProfileList
plural: arangoprofiles
singular: arangoprofile
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}

View file

@ -0,0 +1,390 @@
---
layout: page
parent: CRD reference
title: ArangoProfile V1Alpha1
---
# API Reference for ArangoProfile V1Alpha1
## Spec
### .spec.template.container.all.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L36)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envvar-v1-core)
***
### .spec.template.container.all.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L41)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envfromsource-v1-core)
***
### .spec.template.container.all.volumeMounts
Type: `[]core.VolumeMount` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/volume_mounts.go#L35)</sup>
VolumeMounts keeps list of pod volumes to mount into the container's filesystem.
***
### .spec.template.container.containers.\<string\>.args
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/core.go#L50)</sup>
Arguments to the entrypoint.
The container image's CMD is used if this is not provided.
Variable references $(VAR_NAME) are expanded using the container's environment. If a variable
cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless
of whether the variable exists or not. Cannot be updated.
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell)
***
### .spec.template.container.containers.\<string\>.command
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/core.go#L40)</sup>
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
cannot be resolved, the reference in the input string will be unchanged. Double $$ are reduced
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e. "$$(VAR_NAME)" will
produce the string literal "$(VAR_NAME)". Escaped references will never be expanded, regardless
of whether the variable exists or not. Cannot be updated.
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell)
***
### .spec.template.container.containers.\<string\>.env
Type: `core.EnvVar` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L36)</sup>
Env keeps the information about environment variables provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envvar-v1-core)
***
### .spec.template.container.containers.\<string\>.envFrom
Type: `core.EnvFromSource` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L41)</sup>
EnvFrom keeps the information about environment variable sources provided to the container
Links:
* [Kubernetes Docs](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envfromsource-v1-core)
***
### .spec.template.container.containers.\<string\>.image
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/image.go#L37)</sup>
Image define image details
***
### .spec.template.container.containers.\<string\>.imagePullPolicy
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/image.go#L41)</sup>
ImagePullPolicy define Image pull policy
Default Value: `IfNotPresent`
***
### .spec.template.container.containers.\<string\>.imagePullSecrets
Type: `array` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/image.go#L44)</sup>
ImagePullSecrets define Secrets used to pull Image from registry
***
### .spec.template.container.containers.\<string\>.lifecycle
Type: `core.Lifecycle` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/lifecycle.go#L35)</sup>
Lifecycle keeps actions that the management system should take in response to container lifecycle events.
***
### .spec.template.container.containers.\<string\>.livenessProbe
Type: `core.Probe` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/probes.go#L37)</sup>
LivenessProbe keeps configuration of periodic probe of container liveness.
Container will be restarted if the probe fails.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes)
***
### .spec.template.container.containers.\<string\>.ports
Type: `[]core.ContainerPort` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/networking.go#L39)</sup>
Ports contains list of ports to expose from the container. Not specifying a port here
DOES NOT prevent that port from being exposed. Any port which is
listening on the default "0.0.0.0" address inside a container will be
accessible from the network.
***
### .spec.template.container.containers.\<string\>.readinessProbe
Type: `core.Probe` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/probes.go#L42)</sup>
ReadinessProbe keeps configuration of periodic probe of container service readiness.
Container will be removed from service endpoints if the probe fails.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes)
***
### .spec.template.container.containers.\<string\>.resources
Type: `core.ResourceRequirements` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/resources.go#L37)</sup>
Resources holds resource requests & limits for container
Links:
* [Documentation of core.ResourceRequirements](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#resourcerequirements-v1-core)
***
### .spec.template.container.containers.\<string\>.securityContext
Type: `core.SecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/security.go#L35)</sup>
SecurityContext holds container-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.template.container.containers.\<string\>.startupProbe
Type: `core.Probe` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/probes.go#L50)</sup>
StartupProbe indicates that the Pod has successfully initialized.
If specified, no other probes are executed until this completes successfully.
If this probe fails, the Pod will be restarted, just as if the livenessProbe failed.
This can be used to provide different probe parameters at the beginning of a Pod's lifecycle,
when it might take a long time to load data or warm a cache, than during steady-state operation.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes)
***
### .spec.template.container.containers.\<string\>.volumeMounts
Type: `[]core.VolumeMount` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/volume_mounts.go#L35)</sup>
VolumeMounts keeps list of pod volumes to mount into the container's filesystem.
***
### .spec.template.container.containers.\<string\>.workingDir
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/core.go#L55)</sup>
Container's working directory.
If not specified, the container runtime's default will be used, which
might be configured in the container image.
***
### .spec.template.pod.affinity
Type: `core.Affinity` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L44)</sup>
Affinity defines scheduling constraints for workload
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
***
### .spec.template.pod.annotations
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/metadata.go#L45)</sup>
Annotations is an unstructured key value map stored with a resource that may be
set by external tools to store and retrieve arbitrary metadata. They are not
queryable and should be preserved when modifying objects.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations)
***
### .spec.template.pod.automountServiceAccountToken
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/service_account.go#L38)</sup>
AutomountServiceAccountToken indicates whether a service account token should be automatically mounted.
***
### .spec.template.pod.hostIPC
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L42)</sup>
HostIPC defines to use the host's ipc namespace.
Default Value: `false`
***
### .spec.template.pod.hostNetwork
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L36)</sup>
HostNetwork requests Host network for this pod. Use the host's network namespace.
If this option is set, the ports that will be used must be specified.
Default Value: `false`
***
### .spec.template.pod.hostPID
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L39)</sup>
HostPID define to use the host's pid namespace.
Default Value: `false`
***
### .spec.template.pod.labels
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/metadata.go#L39)</sup>
Map of string keys and values that can be used to organize and categorize
(scope and select) objects. May match selectors of replication controllers
and services.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels)
***
### .spec.template.pod.nodeSelector
Type: `object` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L39)</sup>
NodeSelector is a selector that must be true for the workload to fit on a node.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
***
### .spec.template.pod.ownerReferences
Type: `meta.OwnerReference` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/metadata.go#L52)</sup>
List of objects depended by this object. If ALL objects in the list have
been deleted, this object will be garbage collected. If this object is managed by a controller,
then an entry in this list will point to this controller, with the controller field set to true.
There cannot be more than one managing controller.
***
### .spec.template.pod.podSecurityContext
Type: `core.PodSecurityContext` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/security.go#L35)</sup>
PodSecurityContext holds pod-level security attributes and common container settings.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/)
***
### .spec.template.pod.schedulerName
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L54)</sup>
SchedulerName specifies, the pod will be dispatched by specified scheduler.
If not specified, the pod will be dispatched by default scheduler.
Default Value: `""`
***
### .spec.template.pod.serviceAccountName
Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/service_account.go#L35)</sup>
ServiceAccountName is the name of the ServiceAccount to use to run this pod.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/)
***
### .spec.template.pod.shareProcessNamespace
Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L48)</sup>
ShareProcessNamespace defines to share a single process namespace between all of the containers in a pod.
When this is set containers will be able to view and signal processes from other containers
in the same pod, and the first process in each container will not be assigned PID 1.
HostPID and ShareProcessNamespace cannot both be set.
Default Value: `false`
***
### .spec.template.pod.tolerations
Type: `[]core.Toleration` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L49)</sup>
Tolerations defines tolerations
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
***
### .spec.template.pod.volumes
Type: `[]core.Volume` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/volumes.go#L36)</sup>
Volumes keeps list of volumes that can be mounted by containers belonging to the pod.
Links:
* [Kubernetes docs](https://kubernetes.io/docs/concepts/storage/volumes)
***
### .spec.template.priority
Type: `integer` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/profile_template.go#L30)</sup>

View file

@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2023-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.
@ -40,6 +40,7 @@ import (
mlApi "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
storagev1alpha "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
"github.com/arangodb/kube-arangodb/pkg/util"
)
@ -179,6 +180,13 @@ func Test_GenerateCRValidationSchemas(t *testing.T) {
},
},
},
"scheduler-profile": {
fmt.Sprintf("%s/pkg/apis/scheduler/v1alpha1", root): {
"v1alpha1": {
schedulerApi.ArangoProfile{}.Spec,
},
},
},
"ml-extension": {
fmt.Sprintf("%s/pkg/apis/ml/v1alpha1", root): {
"v1alpha1": {

View file

@ -41,6 +41,7 @@ import (
deploymentApi "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
mlApi "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
replicationApi "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
storageApi "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
"github.com/arangodb/kube-arangodb/pkg/util"
)
@ -234,6 +235,22 @@ func Test_GenerateAPIDocs(t *testing.T) {
},
},
},
"scheduler": map[string]inputPackage{
"v1alpha1": {
Types: inputPackageTypes{
"ArangoProfile.V1Alpha1": {
"Spec": schedulerApi.ArangoProfile{}.Spec,
},
},
Shared: []string{
"shared/v1",
"scheduler/v1alpha1/container",
"scheduler/v1alpha1/container/resources",
"scheduler/v1alpha1/pod",
"scheduler/v1alpha1/pod/resources",
},
},
},
"storage": map[string]inputPackage{
"v1alpha": {
Types: inputPackageTypes{

View file

@ -21,5 +21,9 @@
package scheduler
const (
ArangoProfileCRDName = ArangoProfileResourcePlural + "." + ArangoSchedulerGroupName
ArangoProfileResourceKind = "ArangoProfile"
ArangoProfileResourcePlural = "arangoprofiles"
ArangoSchedulerGroupName = "scheduler.arangodb.com"
)

View file

@ -0,0 +1,45 @@
//
// 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 v1alpha1
import meta "k8s.io/apimachinery/pkg/apis/meta/v1"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoProfileList is a list of Arango Profile.
type ArangoProfileList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []ArangoProfile `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoProfile contains definition and status of the Arango Profile.
type ArangoProfile struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec ProfileSpec `json:"spec"`
Status ProfileStatus `json:"status"`
}

View file

@ -0,0 +1,26 @@
//
// 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 v1alpha1
type ProfileSpec struct {
// Template keeps the Profile Template
Template *ProfileTemplate `json:"template,omitempty"`
}

View file

@ -0,0 +1,24 @@
//
// 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 v1alpha1
type ProfileStatus struct {
}

View file

@ -47,7 +47,10 @@ func Resource(resource string) schema.GroupResource {
// addKnownTypes adds the set of types defined in this package to the supplied scheme.
func addKnownTypes(s *runtime.Scheme) error {
s.AddKnownTypes(SchemeGroupVersion)
s.AddKnownTypes(SchemeGroupVersion,
&ArangoProfile{},
&ArangoProfileList{},
)
meta.AddToGroupVersion(s, SchemeGroupVersion)
return nil
}

View file

@ -28,8 +28,70 @@ package v1alpha1
import (
container "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1/container"
pod "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1/pod"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoProfile) DeepCopyInto(out *ArangoProfile) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoProfile.
func (in *ArangoProfile) DeepCopy() *ArangoProfile {
if in == nil {
return nil
}
out := new(ArangoProfile)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoProfile) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoProfileList) DeepCopyInto(out *ArangoProfileList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ArangoProfile, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoProfileList.
func (in *ArangoProfileList) DeepCopy() *ArangoProfileList {
if in == nil {
return nil
}
out := new(ArangoProfileList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoProfileList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProfileContainerTemplate) DeepCopyInto(out *ProfileContainerTemplate) {
*out = *in
@ -58,6 +120,43 @@ func (in *ProfileContainerTemplate) DeepCopy() *ProfileContainerTemplate {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProfileSpec) DeepCopyInto(out *ProfileSpec) {
*out = *in
if in.Template != nil {
in, out := &in.Template, &out.Template
*out = new(ProfileTemplate)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProfileSpec.
func (in *ProfileSpec) DeepCopy() *ProfileSpec {
if in == nil {
return nil
}
out := new(ProfileSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProfileStatus) DeepCopyInto(out *ProfileStatus) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProfileStatus.
func (in *ProfileStatus) DeepCopy() *ProfileStatus {
if in == nil {
return nil
}
out := new(ProfileStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProfileTemplate) DeepCopyInto(out *ProfileTemplate) {
*out = *in

31
pkg/crd/arangoprofile.go Normal file
View file

@ -0,0 +1,31 @@
//
// 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 crd
import (
"github.com/arangodb/kube-arangodb/pkg/crd/crds"
)
func init() {
registerCRDWithPanic(func(opts *crds.CRDOptions) crds.Definition {
return crds.SchedulerProfileDefinitionWithOptions(opts.AsFunc())
}, nil)
}

View file

@ -63,6 +63,9 @@ func AllDefinitions() []Definition {
MLStorageDefinitionWithOptions(),
MLCronJobDefinitionWithOptions(),
MLBatchJobDefinitionWithOptions(),
// Scheduler
SchedulerProfileDefinitionWithOptions(),
}
}

View file

@ -1,7 +1,7 @@
//
// DISCLAIMER
//
// Copyright 2023 ArangoDB GmbH, Cologne, Germany
// Copyright 2023-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.
@ -32,6 +32,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/apis/deployment"
"github.com/arangodb/kube-arangodb/pkg/apis/ml"
"github.com/arangodb/kube-arangodb/pkg/apis/replication"
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
"github.com/arangodb/kube-arangodb/pkg/apis/storage"
)
@ -73,6 +74,7 @@ func Test_CRD(t *testing.T) {
{ml.ArangoMLStorageCRDName, MLStorageDefinitionWithOptions},
{ml.ArangoMLCronJobCRDName, MLCronJobDefinitionWithOptions},
{ml.ArangoMLBatchJobCRDName, MLBatchJobDefinitionWithOptions},
{scheduler.ArangoProfileCRDName, SchedulerProfileDefinitionWithOptions},
}
for _, tc := range testCases {
@ -108,6 +110,7 @@ func Test_CRDGetters(t *testing.T) {
MLStorageWithOptions,
ReplicationDeploymentReplicationWithOptions,
StorageLocalStorageWithOptions,
SchedulerProfileWithOptions,
}
require.Equal(t, len(AllDefinitions()), len(getters))

View file

@ -0,0 +1,55 @@
//
// DISCLAIMER
//
// Copyright 2023-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 crds
import (
_ "embed"
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"github.com/arangodb/go-driver"
"github.com/arangodb/kube-arangodb/pkg/util"
)
const (
SchedulerProfileVersion = driver.Version("1.0.0")
)
func SchedulerProfileWithOptions(opts ...func(*CRDOptions)) *apiextensions.CustomResourceDefinition {
return getCRD(schedulerProfileCRD, schedulerProfileCRDSchemas, opts...)
}
func SchedulerProfileDefinitionWithOptions(opts ...func(*CRDOptions)) Definition {
return Definition{
Version: SchedulerProfileVersion,
CRD: SchedulerProfileWithOptions(opts...),
}
}
var schedulerProfileCRD = util.NewYamlLoader[apiextensions.CustomResourceDefinition](schedulerProfile)
var schedulerProfileCRDSchemas = util.NewYamlLoader[crdSchemas](schedulerProfileSchemaRaw)
//go:embed scheduler-profile.yaml
var schedulerProfile []byte
//go:embed scheduler-profile.schema.generated.yaml
var schedulerProfileSchemaRaw []byte

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,22 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: arangoprofiles.scheduler.arangodb.com
spec:
group: scheduler.arangodb.com
names:
kind: ArangoProfile
listKind: ArangoProfileList
plural: arangoprofiles
singular: arangoprofile
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}

View file

@ -0,0 +1,199 @@
//
// 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 client-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
"time"
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
scheme "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// ArangoProfilesGetter has a method to return a ArangoProfileInterface.
// A group's client should implement this interface.
type ArangoProfilesGetter interface {
ArangoProfiles(namespace string) ArangoProfileInterface
}
// ArangoProfileInterface has methods to work with ArangoProfile resources.
type ArangoProfileInterface interface {
Create(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.CreateOptions) (*v1alpha1.ArangoProfile, error)
Update(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.UpdateOptions) (*v1alpha1.ArangoProfile, error)
UpdateStatus(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.UpdateOptions) (*v1alpha1.ArangoProfile, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ArangoProfile, error)
List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ArangoProfileList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ArangoProfile, err error)
ArangoProfileExpansion
}
// arangoProfiles implements ArangoProfileInterface
type arangoProfiles struct {
client rest.Interface
ns string
}
// newArangoProfiles returns a ArangoProfiles
func newArangoProfiles(c *SchedulerV1alpha1Client, namespace string) *arangoProfiles {
return &arangoProfiles{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the arangoProfile, and returns the corresponding arangoProfile object, and an error if there is any.
func (c *arangoProfiles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ArangoProfile, err error) {
result = &v1alpha1.ArangoProfile{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoprofiles").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoProfiles that match those selectors.
func (c *arangoProfiles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ArangoProfileList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1alpha1.ArangoProfileList{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoprofiles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoProfiles.
func (c *arangoProfiles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("arangoprofiles").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a arangoProfile and creates it. Returns the server's representation of the arangoProfile, and an error, if there is any.
func (c *arangoProfiles) Create(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.CreateOptions) (result *v1alpha1.ArangoProfile, err error) {
result = &v1alpha1.ArangoProfile{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangoprofiles").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoProfile).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoProfile and updates it. Returns the server's representation of the arangoProfile, and an error, if there is any.
func (c *arangoProfiles) Update(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.UpdateOptions) (result *v1alpha1.ArangoProfile, err error) {
result = &v1alpha1.ArangoProfile{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoprofiles").
Name(arangoProfile.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoProfile).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *arangoProfiles) UpdateStatus(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.UpdateOptions) (result *v1alpha1.ArangoProfile, err error) {
result = &v1alpha1.ArangoProfile{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoprofiles").
Name(arangoProfile.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoProfile).
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoProfile and deletes it. Returns an error if one occurs.
func (c *arangoProfiles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangoprofiles").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoProfiles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("arangoprofiles").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoProfile.
func (c *arangoProfiles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ArangoProfile, err error) {
result = &v1alpha1.ArangoProfile{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangoprofiles").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View file

@ -0,0 +1,145 @@
//
// 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 client-gen. DO NOT EDIT.
package fake
import (
"context"
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeArangoProfiles implements ArangoProfileInterface
type FakeArangoProfiles struct {
Fake *FakeSchedulerV1alpha1
ns string
}
var arangoprofilesResource = v1alpha1.SchemeGroupVersion.WithResource("arangoprofiles")
var arangoprofilesKind = v1alpha1.SchemeGroupVersion.WithKind("ArangoProfile")
// Get takes name of the arangoProfile, and returns the corresponding arangoProfile object, and an error if there is any.
func (c *FakeArangoProfiles) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ArangoProfile, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangoprofilesResource, c.ns, name), &v1alpha1.ArangoProfile{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ArangoProfile), err
}
// List takes label and field selectors, and returns the list of ArangoProfiles that match those selectors.
func (c *FakeArangoProfiles) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ArangoProfileList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangoprofilesResource, arangoprofilesKind, c.ns, opts), &v1alpha1.ArangoProfileList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1alpha1.ArangoProfileList{ListMeta: obj.(*v1alpha1.ArangoProfileList).ListMeta}
for _, item := range obj.(*v1alpha1.ArangoProfileList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested arangoProfiles.
func (c *FakeArangoProfiles) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangoprofilesResource, c.ns, opts))
}
// Create takes the representation of a arangoProfile and creates it. Returns the server's representation of the arangoProfile, and an error, if there is any.
func (c *FakeArangoProfiles) Create(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.CreateOptions) (result *v1alpha1.ArangoProfile, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangoprofilesResource, c.ns, arangoProfile), &v1alpha1.ArangoProfile{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ArangoProfile), err
}
// Update takes the representation of a arangoProfile and updates it. Returns the server's representation of the arangoProfile, and an error, if there is any.
func (c *FakeArangoProfiles) Update(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.UpdateOptions) (result *v1alpha1.ArangoProfile, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangoprofilesResource, c.ns, arangoProfile), &v1alpha1.ArangoProfile{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ArangoProfile), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeArangoProfiles) UpdateStatus(ctx context.Context, arangoProfile *v1alpha1.ArangoProfile, opts v1.UpdateOptions) (*v1alpha1.ArangoProfile, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangoprofilesResource, "status", c.ns, arangoProfile), &v1alpha1.ArangoProfile{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ArangoProfile), err
}
// Delete takes name of the arangoProfile and deletes it. Returns an error if one occurs.
func (c *FakeArangoProfiles) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(arangoprofilesResource, c.ns, name, opts), &v1alpha1.ArangoProfile{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoProfiles) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangoprofilesResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1alpha1.ArangoProfileList{})
return err
}
// Patch applies the patch and returns the patched arangoProfile.
func (c *FakeArangoProfiles) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ArangoProfile, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangoprofilesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ArangoProfile{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.ArangoProfile), err
}

View file

@ -23,6 +23,7 @@
package fake
import (
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
@ -31,6 +32,10 @@ type FakeSchedulerV1alpha1 struct {
*testing.Fake
}
func (c *FakeSchedulerV1alpha1) ArangoProfiles(namespace string) v1alpha1.ArangoProfileInterface {
return &FakeArangoProfiles{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeSchedulerV1alpha1) RESTClient() rest.Interface {

View file

@ -21,3 +21,5 @@
// Code generated by client-gen. DO NOT EDIT.
package v1alpha1
type ArangoProfileExpansion interface{}

View file

@ -32,6 +32,7 @@ import (
type SchedulerV1alpha1Interface interface {
RESTClient() rest.Interface
ArangoProfilesGetter
}
// SchedulerV1alpha1Client is used to interact with features provided by the scheduler.arangodb.com group.
@ -39,6 +40,10 @@ type SchedulerV1alpha1Client struct {
restClient rest.Interface
}
func (c *SchedulerV1alpha1Client) ArangoProfiles(namespace string) ArangoProfileInterface {
return newArangoProfiles(c, namespace)
}
// NewForConfig creates a new SchedulerV1alpha1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).

View file

@ -34,6 +34,7 @@ import (
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
ml "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/ml"
replication "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/replication"
scheduler "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/scheduler"
storage "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/storage"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
@ -267,6 +268,7 @@ type SharedInformerFactory interface {
Database() deployment.Interface
Ml() ml.Interface
Replication() replication.Interface
Scheduler() scheduler.Interface
Storage() storage.Interface
}
@ -290,6 +292,10 @@ func (f *sharedInformerFactory) Replication() replication.Interface {
return replication.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Scheduler() scheduler.Interface {
return scheduler.New(f, f.namespace, f.tweakListOptions)
}
func (f *sharedInformerFactory) Storage() storage.Interface {
return storage.New(f, f.namespace, f.tweakListOptions)
}

View file

@ -32,6 +32,7 @@ import (
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
schedulerv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
v1alpha "github.com/arangodb/kube-arangodb/pkg/apis/storage/v1alpha"
schema "k8s.io/apimachinery/pkg/runtime/schema"
cache "k8s.io/client-go/tools/cache"
@ -111,6 +112,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case replicationv2alpha1.SchemeGroupVersion.WithResource("arangodeploymentreplications"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Replication().V2alpha1().ArangoDeploymentReplications().Informer()}, nil
// Group=scheduler.arangodb.com, Version=v1alpha1
case schedulerv1alpha1.SchemeGroupVersion.WithResource("arangoprofiles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduler().V1alpha1().ArangoProfiles().Informer()}, nil
// Group=storage.arangodb.com, Version=v1alpha
case v1alpha.SchemeGroupVersion.WithResource("arangolocalstorages"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Storage().V1alpha().ArangoLocalStorages().Informer()}, nil

View file

@ -0,0 +1,50 @@
//
// 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 informer-gen. DO NOT EDIT.
package scheduler
import (
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/scheduler/v1alpha1"
)
// Interface provides access to each of this group's versions.
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
}
type group struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// V1alpha1 returns a new v1alpha1.Interface.
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}

View file

@ -0,0 +1,94 @@
//
// 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 informer-gen. DO NOT EDIT.
package v1alpha1
import (
"context"
time "time"
schedulerv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/scheduler/v1alpha1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
)
// ArangoProfileInformer provides access to a shared informer and lister for
// ArangoProfiles.
type ArangoProfileInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1alpha1.ArangoProfileLister
}
type arangoProfileInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewArangoProfileInformer constructs a new informer for ArangoProfile type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewArangoProfileInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredArangoProfileInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredArangoProfileInformer constructs a new informer for ArangoProfile type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredArangoProfileInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SchedulerV1alpha1().ArangoProfiles(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SchedulerV1alpha1().ArangoProfiles(namespace).Watch(context.TODO(), options)
},
},
&schedulerv1alpha1.ArangoProfile{},
resyncPeriod,
indexers,
)
}
func (f *arangoProfileInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredArangoProfileInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *arangoProfileInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&schedulerv1alpha1.ArangoProfile{}, f.defaultInformer)
}
func (f *arangoProfileInformer) Lister() v1alpha1.ArangoProfileLister {
return v1alpha1.NewArangoProfileLister(f.Informer().GetIndexer())
}

View file

@ -0,0 +1,49 @@
//
// 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 informer-gen. DO NOT EDIT.
package v1alpha1
import (
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// ArangoProfiles returns a ArangoProfileInformer.
ArangoProfiles() ArangoProfileInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// ArangoProfiles returns a ArangoProfileInformer.
func (v *version) ArangoProfiles() ArangoProfileInformer {
return &arangoProfileInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View file

@ -0,0 +1,103 @@
//
// 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 lister-gen. DO NOT EDIT.
package v1alpha1
import (
v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ArangoProfileLister helps list ArangoProfiles.
// All objects returned here must be treated as read-only.
type ArangoProfileLister interface {
// List lists all ArangoProfiles in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.ArangoProfile, err error)
// ArangoProfiles returns an object that can list and get ArangoProfiles.
ArangoProfiles(namespace string) ArangoProfileNamespaceLister
ArangoProfileListerExpansion
}
// arangoProfileLister implements the ArangoProfileLister interface.
type arangoProfileLister struct {
indexer cache.Indexer
}
// NewArangoProfileLister returns a new ArangoProfileLister.
func NewArangoProfileLister(indexer cache.Indexer) ArangoProfileLister {
return &arangoProfileLister{indexer: indexer}
}
// List lists all ArangoProfiles in the indexer.
func (s *arangoProfileLister) List(selector labels.Selector) (ret []*v1alpha1.ArangoProfile, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ArangoProfile))
})
return ret, err
}
// ArangoProfiles returns an object that can list and get ArangoProfiles.
func (s *arangoProfileLister) ArangoProfiles(namespace string) ArangoProfileNamespaceLister {
return arangoProfileNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ArangoProfileNamespaceLister helps list and get ArangoProfiles.
// All objects returned here must be treated as read-only.
type ArangoProfileNamespaceLister interface {
// List lists all ArangoProfiles in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1alpha1.ArangoProfile, err error)
// Get retrieves the ArangoProfile from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1alpha1.ArangoProfile, error)
ArangoProfileNamespaceListerExpansion
}
// arangoProfileNamespaceLister implements the ArangoProfileNamespaceLister
// interface.
type arangoProfileNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ArangoProfiles in the indexer for a given namespace.
func (s arangoProfileNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ArangoProfile, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.ArangoProfile))
})
return ret, err
}
// Get retrieves the ArangoProfile from the indexer for a given namespace and name.
func (s arangoProfileNamespaceLister) Get(name string) (*v1alpha1.ArangoProfile, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1alpha1.Resource("arangoprofile"), name)
}
return obj.(*v1alpha1.ArangoProfile), nil
}

View file

@ -0,0 +1,31 @@
//
// 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 lister-gen. DO NOT EDIT.
package v1alpha1
// ArangoProfileListerExpansion allows custom methods to be added to
// ArangoProfileLister.
type ArangoProfileListerExpansion interface{}
// ArangoProfileNamespaceListerExpansion allows custom methods to be added to
// ArangoProfileNamespaceLister.
type ArangoProfileNamespaceListerExpansion interface{}