diff --git a/CHANGELOG.md b/CHANGELOG.md index c6c933c0e..f13cca16d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Makefile b/Makefile index 0cc05c7dd..d818c7fda 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/chart/kube-arangodb/crds/scheduler-profile.yaml b/chart/kube-arangodb/crds/scheduler-profile.yaml new file mode 100644 index 000000000..685448169 --- /dev/null +++ b/chart/kube-arangodb/crds/scheduler-profile.yaml @@ -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: {} diff --git a/docs/api/ArangoProfile.V1Alpha1.md b/docs/api/ArangoProfile.V1Alpha1.md new file mode 100644 index 000000000..40746264c --- /dev/null +++ b/docs/api/ArangoProfile.V1Alpha1.md @@ -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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L36) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L41) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/volume_mounts.go#L35) + +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.39/pkg/apis/scheduler/v1alpha1/container/resources/core.go#L50) + +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.\.command + +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/core.go#L40) + +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.\.env + +Type: `core.EnvVar` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L36) + +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.\.envFrom + +Type: `core.EnvFromSource` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/environments.go#L41) + +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.\.image + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/image.go#L37) + +Image define image details + +*** + +### .spec.template.container.containers.\.imagePullPolicy + +Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/image.go#L41) + +ImagePullPolicy define Image pull policy + +Default Value: `IfNotPresent` + +*** + +### .spec.template.container.containers.\.imagePullSecrets + +Type: `array` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/image.go#L44) + +ImagePullSecrets define Secrets used to pull Image from registry + +*** + +### .spec.template.container.containers.\.lifecycle + +Type: `core.Lifecycle` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/lifecycle.go#L35) + +Lifecycle keeps actions that the management system should take in response to container lifecycle events. + +*** + +### .spec.template.container.containers.\.livenessProbe + +Type: `core.Probe` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/probes.go#L37) + +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.\.ports + +Type: `[]core.ContainerPort` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/networking.go#L39) + +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.\.readinessProbe + +Type: `core.Probe` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/probes.go#L42) + +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.\.resources + +Type: `core.ResourceRequirements` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/resources.go#L37) + +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.\.securityContext + +Type: `core.SecurityContext` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/security.go#L35) + +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.\.startupProbe + +Type: `core.Probe` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/probes.go#L50) + +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.\.volumeMounts + +Type: `[]core.VolumeMount` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/container/resources/volume_mounts.go#L35) + +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.39/pkg/apis/scheduler/v1alpha1/container/resources/core.go#L55) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L44) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/metadata.go#L45) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/service_account.go#L38) + +AutomountServiceAccountToken indicates whether a service account token should be automatically mounted. + +*** + +### .spec.template.pod.hostIPC + +Type: `boolean` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L42) + +HostIPC defines to use the host's ipc namespace. + +Default Value: `false` + +*** + +### .spec.template.pod.hostNetwork + +Type: `boolean` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L36) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L39) + +HostPID define to use the host's pid namespace. + +Default Value: `false` + +*** + +### .spec.template.pod.labels + +Type: `object` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/metadata.go#L39) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L39) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/metadata.go#L52) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/security.go#L35) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L54) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/service_account.go#L35) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/namespace.go#L48) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/scheduling.go#L49) + +Tolerations defines tolerations + +Links: +* [Kubernetes docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) + +*** + +### .spec.template.pod.volumes + +Type: `[]core.Volume` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/pod/resources/volumes.go#L36) + +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` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.39/pkg/apis/scheduler/v1alpha1/profile_template.go#L30) + diff --git a/internal/cr_validation_test.go b/internal/cr_validation_test.go index 262edcf9b..a4eb8dddc 100644 --- a/internal/cr_validation_test.go +++ b/internal/cr_validation_test.go @@ -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": { diff --git a/internal/docs_test.go b/internal/docs_test.go index 37e0bc93c..37b9a7285 100644 --- a/internal/docs_test.go +++ b/internal/docs_test.go @@ -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{ diff --git a/pkg/apis/scheduler/definitions.go b/pkg/apis/scheduler/definitions.go index 916976392..af9e57cb9 100644 --- a/pkg/apis/scheduler/definitions.go +++ b/pkg/apis/scheduler/definitions.go @@ -21,5 +21,9 @@ package scheduler const ( + ArangoProfileCRDName = ArangoProfileResourcePlural + "." + ArangoSchedulerGroupName + ArangoProfileResourceKind = "ArangoProfile" + ArangoProfileResourcePlural = "arangoprofiles" + ArangoSchedulerGroupName = "scheduler.arangodb.com" ) diff --git a/pkg/apis/scheduler/v1alpha1/profile.go b/pkg/apis/scheduler/v1alpha1/profile.go new file mode 100644 index 000000000..599f866e3 --- /dev/null +++ b/pkg/apis/scheduler/v1alpha1/profile.go @@ -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"` +} diff --git a/pkg/apis/scheduler/v1alpha1/profile_spec.go b/pkg/apis/scheduler/v1alpha1/profile_spec.go new file mode 100644 index 000000000..e1aa0f517 --- /dev/null +++ b/pkg/apis/scheduler/v1alpha1/profile_spec.go @@ -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"` +} diff --git a/pkg/apis/scheduler/v1alpha1/profile_status.go b/pkg/apis/scheduler/v1alpha1/profile_status.go new file mode 100644 index 000000000..76a78cea9 --- /dev/null +++ b/pkg/apis/scheduler/v1alpha1/profile_status.go @@ -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 { +} diff --git a/pkg/apis/scheduler/v1alpha1/register.go b/pkg/apis/scheduler/v1alpha1/register.go index 70e098a1e..f31aeaefb 100644 --- a/pkg/apis/scheduler/v1alpha1/register.go +++ b/pkg/apis/scheduler/v1alpha1/register.go @@ -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 } diff --git a/pkg/apis/scheduler/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/scheduler/v1alpha1/zz_generated.deepcopy.go index 8a9c4ebba..0ebd19fd9 100644 --- a/pkg/apis/scheduler/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/scheduler/v1alpha1/zz_generated.deepcopy.go @@ -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 diff --git a/pkg/crd/arangoprofile.go b/pkg/crd/arangoprofile.go new file mode 100644 index 000000000..4c2f7df15 --- /dev/null +++ b/pkg/crd/arangoprofile.go @@ -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) +} diff --git a/pkg/crd/crds/crds.go b/pkg/crd/crds/crds.go index 9136096db..16ec303a0 100644 --- a/pkg/crd/crds/crds.go +++ b/pkg/crd/crds/crds.go @@ -63,6 +63,9 @@ func AllDefinitions() []Definition { MLStorageDefinitionWithOptions(), MLCronJobDefinitionWithOptions(), MLBatchJobDefinitionWithOptions(), + + // Scheduler + SchedulerProfileDefinitionWithOptions(), } } diff --git a/pkg/crd/crds/crds_test.go b/pkg/crd/crds/crds_test.go index f230403f1..cd70d598d 100644 --- a/pkg/crd/crds/crds_test.go +++ b/pkg/crd/crds/crds_test.go @@ -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)) diff --git a/pkg/crd/crds/scheduler-profile.go b/pkg/crd/crds/scheduler-profile.go new file mode 100644 index 000000000..8baf57301 --- /dev/null +++ b/pkg/crd/crds/scheduler-profile.go @@ -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 diff --git a/pkg/crd/crds/scheduler-profile.schema.generated.yaml b/pkg/crd/crds/scheduler-profile.schema.generated.yaml new file mode 100644 index 000000000..a104c3b1c --- /dev/null +++ b/pkg/crd/crds/scheduler-profile.schema.generated.yaml @@ -0,0 +1,1726 @@ +v1alpha1: + openAPIV3Schema: + properties: + spec: + properties: + template: + description: Template keeps the Profile Template + properties: + container: + properties: + all: + properties: + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + type: object + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + type: object + resourceFieldRef: + properties: + containerName: + type: string + divisor: + type: string + resource: + type: string + type: object + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + type: object + type: object + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + type: object + type: array + type: object + containers: + additionalProperties: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + type: object + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + type: object + resourceFieldRef: + properties: + containerName: + type: string + divisor: + type: string + resource: + type: string + type: object + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + type: object + type: object + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + imagePullSecrets: + items: + type: string + type: array + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + path: + type: string + port: + format: int-or-string + type: string + scheme: + type: string + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + type: object + tcpSocket: + properties: + host: + type: string + port: + format: int-or-string + type: string + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + path: + type: string + port: + format: int-or-string + type: string + scheme: + type: string + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + type: object + tcpSocket: + properties: + host: + type: string + port: + format: int-or-string + type: string + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + path: + type: string + port: + format: int-or-string + type: string + scheme: + type: string + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + format: int-or-string + type: string + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + type: string + type: object + type: array + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + path: + type: string + port: + format: int-or-string + type: string + scheme: + type: string + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + format: int-or-string + type: string + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resources: + properties: + claims: + items: + properties: + name: + type: string + type: object + type: array + limits: + additionalProperties: + type: string + type: object + requests: + additionalProperties: + type: string + type: object + type: object + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + path: + type: string + port: + format: int-or-string + type: string + scheme: + type: string + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + format: int-or-string + type: string + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + type: object + type: array + workingDir: + type: string + type: object + type: object + type: object + pod: + properties: + affinity: + properties: + nodeAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + type: object + weight: + format: int32 + type: integer + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + type: object + type: array + type: object + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + matchLabelKeys: + items: + type: string + type: array + mismatchLabelKeys: + items: + type: string + type: array + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + type: object + weight: + format: int32 + type: integer + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + matchLabelKeys: + items: + type: string + type: array + mismatchLabelKeys: + items: + type: string + type: array + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + matchLabelKeys: + items: + type: string + type: array + mismatchLabelKeys: + items: + type: string + type: array + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + type: object + weight: + format: int32 + type: integer + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + matchLabelKeys: + items: + type: string + type: array + mismatchLabelKeys: + items: + type: string + type: array + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + namespaces: + items: + type: string + type: array + topologyKey: + type: string + type: object + type: array + type: object + type: object + annotations: + additionalProperties: + type: string + type: object + automountServiceAccountToken: + type: boolean + hostIPC: + type: boolean + hostNetwork: + type: boolean + hostPID: + type: boolean + labels: + additionalProperties: + type: string + type: object + nodeSelector: + additionalProperties: + type: string + type: object + ownerReferences: + items: + properties: + apiVersion: + type: string + blockOwnerDeletion: + type: boolean + controller: + type: boolean + kind: + type: string + name: + type: string + uid: + type: string + type: object + type: array + podSecurityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + type: object + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + schedulerName: + type: string + serviceAccountName: + type: string + shareProcessNamespace: + type: boolean + tolerations: + items: + properties: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: + type: string + type: object + type: array + volumes: + items: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + user: + type: string + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + volumeID: + type: string + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + type: object + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + type: string + resource: + type: string + type: object + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + type: string + type: object + ephemeral: + properties: + volumeClaimTemplate: + properties: + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + creationTimestamp: + format: date-time + type: string + deletionGracePeriodSeconds: + format: int64 + type: integer + deletionTimestamp: + format: date-time + type: string + finalizers: + items: + type: string + type: array + generateName: + type: string + generation: + format: int64 + type: integer + labels: + additionalProperties: + type: string + type: object + managedFields: + items: + properties: + apiVersion: + type: string + fieldsType: + type: string + fieldsV1: + type: object + manager: + type: string + operation: + type: string + subresource: + type: string + time: + format: date-time + type: string + type: object + type: array + name: + type: string + namespace: + type: string + ownerReferences: + items: + properties: + apiVersion: + type: string + blockOwnerDeletion: + type: boolean + controller: + type: boolean + kind: + type: string + name: + type: string + uid: + type: string + type: object + type: array + resourceVersion: + type: string + selfLink: + type: string + uid: + type: string + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + type: object + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + type: object + resources: + properties: + limits: + additionalProperties: + type: string + type: object + requests: + additionalProperties: + type: string + type: object + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + storageClassName: + type: string + volumeAttributesClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + type: object + type: object + fc: + properties: + fsType: + type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + type: object + gitRepo: + properties: + directory: + type: string + repository: + type: string + revision: + type: string + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + type: object + hostPath: + properties: + path: + type: string + type: + type: string + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + targetPortal: + type: string + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + type: object + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + type: object + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + type: string + resource: + type: string + type: object + type: object + type: array + type: object + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + type: object + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + user: + type: string + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + type: object + type: object + type: array + type: object + priority: + format: int32 + type: integer + type: object + type: object + type: object + x-kubernetes-preserve-unknown-fields: true diff --git a/pkg/crd/crds/scheduler-profile.yaml b/pkg/crd/crds/scheduler-profile.yaml new file mode 100644 index 000000000..685448169 --- /dev/null +++ b/pkg/crd/crds/scheduler-profile.yaml @@ -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: {} diff --git a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/arangoprofile.go b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/arangoprofile.go new file mode 100644 index 000000000..e733e17ba --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/arangoprofile.go @@ -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 +} diff --git a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_arangoprofile.go b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_arangoprofile.go new file mode 100644 index 000000000..0c058c681 --- /dev/null +++ b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_arangoprofile.go @@ -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 +} diff --git a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_scheduler_client.go b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_scheduler_client.go index b1827faaf..f2ee4d1da 100644 --- a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_scheduler_client.go +++ b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/fake/fake_scheduler_client.go @@ -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 { diff --git a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/generated_expansion.go index 74f850aac..18e272f9a 100644 --- a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/generated_expansion.go +++ b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/generated_expansion.go @@ -21,3 +21,5 @@ // Code generated by client-gen. DO NOT EDIT. package v1alpha1 + +type ArangoProfileExpansion interface{} diff --git a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/scheduler_client.go b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/scheduler_client.go index f80279a18..ceed8f900 100644 --- a/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/scheduler_client.go +++ b/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1/scheduler_client.go @@ -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). diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go index 21147cde1..3c63d2075 100644 --- a/pkg/generated/informers/externalversions/factory.go +++ b/pkg/generated/informers/externalversions/factory.go @@ -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) } diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go index 5c4332b11..d9a68a773 100644 --- a/pkg/generated/informers/externalversions/generic.go +++ b/pkg/generated/informers/externalversions/generic.go @@ -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 diff --git a/pkg/generated/informers/externalversions/scheduler/interface.go b/pkg/generated/informers/externalversions/scheduler/interface.go new file mode 100644 index 000000000..bb28e6d0b --- /dev/null +++ b/pkg/generated/informers/externalversions/scheduler/interface.go @@ -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) +} diff --git a/pkg/generated/informers/externalversions/scheduler/v1alpha1/arangoprofile.go b/pkg/generated/informers/externalversions/scheduler/v1alpha1/arangoprofile.go new file mode 100644 index 000000000..05c628e69 --- /dev/null +++ b/pkg/generated/informers/externalversions/scheduler/v1alpha1/arangoprofile.go @@ -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()) +} diff --git a/pkg/generated/informers/externalversions/scheduler/v1alpha1/interface.go b/pkg/generated/informers/externalversions/scheduler/v1alpha1/interface.go new file mode 100644 index 000000000..c55e20f3c --- /dev/null +++ b/pkg/generated/informers/externalversions/scheduler/v1alpha1/interface.go @@ -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} +} diff --git a/pkg/generated/listers/scheduler/v1alpha1/arangoprofile.go b/pkg/generated/listers/scheduler/v1alpha1/arangoprofile.go new file mode 100644 index 000000000..ab68f9f20 --- /dev/null +++ b/pkg/generated/listers/scheduler/v1alpha1/arangoprofile.go @@ -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 +} diff --git a/pkg/generated/listers/scheduler/v1alpha1/expansion_generated.go b/pkg/generated/listers/scheduler/v1alpha1/expansion_generated.go new file mode 100644 index 000000000..06299687c --- /dev/null +++ b/pkg/generated/listers/scheduler/v1alpha1/expansion_generated.go @@ -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{}