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

[Feature] Scheduler Types (#1730)

This commit is contained in:
Adam Janikowski 2024-09-26 17:20:57 +02:00 committed by GitHub
parent 367e59fe5b
commit 459462b0dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
143 changed files with 22644 additions and 1478 deletions

View file

@ -34,6 +34,7 @@
- (Feature) (Networking) Endpoints Destination
- (Improvement) Improve Metrics Handling
- (Feature) (Scheduler) Create Integration Profile
- (Feature) (Scheduler) Additional types
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries

View file

@ -911,7 +911,7 @@ CRDS:=apps-job \
database-clustersynchronization database-deployment database-member database-task \
replication-deploymentreplication \
ml-storage ml-extension ml-job-batch ml-job-cron \
scheduler-profile \
scheduler-profile scheduler-pod scheduler-deployment scheduler-batchjob scheduler-cronjob \
analytics-graphanalyticsengine \
networking-route

View file

@ -182,7 +182,7 @@ Flags:
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, http, inspector, integration-config-v1, integration-envoy-auth-v3, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, scheduler-profile-operator, server, server-authentication (default [info])
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, http, inspector, integration-config-v1, integration-envoy-auth-v3, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication (default [info])
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes

View file

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

View file

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

View file

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

View file

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

View file

@ -68,6 +68,10 @@ rules:
verbs: ["get", "list", "watch", "update", "delete"]
resourceNames:
- "arangoprofiles.scheduler.arangodb.com"
- "arangoschedulerpods.scheduler.arangodb.com"
- "arangoschedulerdeploymets.scheduler.arangodb.com"
- "arangoschedulerbatchjobs.scheduler.arangodb.com"
- "arangoschedulercronjobs.scheduler.arangodb.com"
{{- end }}
{{- end }}

View file

@ -18,6 +18,37 @@ rules:
resources:
- "arangoprofiles"
- "arangoprofiles/status"
- "arangoschedulerpods"
- "arangoschedulerpods/status"
- "arangoschedulerdeployments"
- "arangoschedulerdeployments/status"
- "arangoschedulerbatchjobs"
- "arangoschedulerbatchjobs/status"
- "arangoschedulercronjobs"
- "arangoschedulercronjobs/status"
verbs:
- "*"
- apiGroups:
- ""
resources:
- "pods"
- "pods/status"
verbs:
- "*"
- apiGroups:
- "apps"
resources:
- "deployments"
- "deployments/status"
verbs:
- "*"
- apiGroups:
- "batch"
resources:
- "jobs"
- "jobs/status"
- "cronjobs"
- "cronjobs/status"
verbs:
- "*"
- apiGroups:

View file

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

View file

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

View file

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

View file

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

View file

@ -68,6 +68,10 @@ rules:
verbs: ["get", "list", "watch", "update", "delete"]
resourceNames:
- "arangoprofiles.scheduler.arangodb.com"
- "arangoschedulerpods.scheduler.arangodb.com"
- "arangoschedulerdeploymets.scheduler.arangodb.com"
- "arangoschedulerbatchjobs.scheduler.arangodb.com"
- "arangoschedulercronjobs.scheduler.arangodb.com"
{{- end }}
{{- end }}

View file

@ -18,6 +18,37 @@ rules:
resources:
- "arangoprofiles"
- "arangoprofiles/status"
- "arangoschedulerpods"
- "arangoschedulerpods/status"
- "arangoschedulerdeployments"
- "arangoschedulerdeployments/status"
- "arangoschedulerbatchjobs"
- "arangoschedulerbatchjobs/status"
- "arangoschedulercronjobs"
- "arangoschedulercronjobs/status"
verbs:
- "*"
- apiGroups:
- ""
resources:
- "pods"
- "pods/status"
verbs:
- "*"
- apiGroups:
- "apps"
resources:
- "deployments"
- "deployments/status"
verbs:
- "*"
- apiGroups:
- "batch"
resources:
- "jobs"
- "jobs/status"
- "cronjobs"
- "cronjobs/status"
verbs:
- "*"
- apiGroups:

View file

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

View file

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

View file

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

View file

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

View file

@ -68,6 +68,10 @@ rules:
verbs: ["get", "list", "watch", "update", "delete"]
resourceNames:
- "arangoprofiles.scheduler.arangodb.com"
- "arangoschedulerpods.scheduler.arangodb.com"
- "arangoschedulerdeploymets.scheduler.arangodb.com"
- "arangoschedulerbatchjobs.scheduler.arangodb.com"
- "arangoschedulercronjobs.scheduler.arangodb.com"
{{- end }}
{{- end }}

View file

@ -18,6 +18,37 @@ rules:
resources:
- "arangoprofiles"
- "arangoprofiles/status"
- "arangoschedulerpods"
- "arangoschedulerpods/status"
- "arangoschedulerdeployments"
- "arangoschedulerdeployments/status"
- "arangoschedulerbatchjobs"
- "arangoschedulerbatchjobs/status"
- "arangoschedulercronjobs"
- "arangoschedulercronjobs/status"
verbs:
- "*"
- apiGroups:
- ""
resources:
- "pods"
- "pods/status"
verbs:
- "*"
- apiGroups:
- "apps"
resources:
- "deployments"
- "deployments/status"
verbs:
- "*"
- apiGroups:
- "batch"
resources:
- "jobs"
- "jobs/status"
- "cronjobs"
- "cronjobs/status"
verbs:
- "*"
- apiGroups:

View file

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

View file

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

View file

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

View file

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

View file

@ -68,6 +68,10 @@ rules:
verbs: ["get", "list", "watch", "update", "delete"]
resourceNames:
- "arangoprofiles.scheduler.arangodb.com"
- "arangoschedulerpods.scheduler.arangodb.com"
- "arangoschedulerdeploymets.scheduler.arangodb.com"
- "arangoschedulerbatchjobs.scheduler.arangodb.com"
- "arangoschedulercronjobs.scheduler.arangodb.com"
{{- end }}
{{- end }}

View file

@ -18,6 +18,37 @@ rules:
resources:
- "arangoprofiles"
- "arangoprofiles/status"
- "arangoschedulerpods"
- "arangoschedulerpods/status"
- "arangoschedulerdeployments"
- "arangoschedulerdeployments/status"
- "arangoschedulerbatchjobs"
- "arangoschedulerbatchjobs/status"
- "arangoschedulercronjobs"
- "arangoschedulercronjobs/status"
verbs:
- "*"
- apiGroups:
- ""
resources:
- "pods"
- "pods/status"
verbs:
- "*"
- apiGroups:
- "apps"
resources:
- "deployments"
- "deployments/status"
verbs:
- "*"
- apiGroups:
- "batch"
resources:
- "jobs"
- "jobs/status"
- "cronjobs"
- "cronjobs/status"
verbs:
- "*"
- apiGroups:

View file

@ -80,7 +80,7 @@ Flags:
--kubernetes.max-batch-size int Size of batch during objects read (default 256)
--kubernetes.qps float32 Number of queries per second for k8s API (default 15)
--log.format string Set log format. Allowed values: 'pretty', 'JSON'. If empty, default format is used (default "pretty")
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, http, inspector, integration-config-v1, integration-envoy-auth-v3, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, scheduler-profile-operator, server, server-authentication (default [info])
--log.level stringArray Set log levels in format <level> or <logger>=<level>. Possible loggers: action, agency, api-server, assertion, backup-operator, chaos-monkey, crd, deployment, deployment-ci, deployment-reconcile, deployment-replication, deployment-resilience, deployment-resources, deployment-storage, deployment-storage-pc, deployment-storage-service, generic-parent-operator, http, inspector, integration-config-v1, integration-envoy-auth-v3, integrations, k8s-client, kubernetes-informer, monitor, networking-route-operator, operator, operator-arangojob-handler, operator-v2, operator-v2-event, operator-v2-worker, panics, pod_compare, root, root-event-recorder, scheduler-batchjob-operator, scheduler-cronjob-operator, scheduler-deployment-operator, scheduler-pod-operator, scheduler-profile-operator, server, server-authentication (default [info])
--log.sampling If true, operator will try to minimize duplication of logging events (default true)
--memory-limit uint Define memory limit for hard shutdown and the dump of goroutines. Used for testing
--metrics.excluded-prefixes stringArray List of the excluded metrics prefixes

View file

@ -0,0 +1,177 @@
//
// 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 v1
import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"github.com/arangodb/kube-arangodb/pkg/debug_package/generators/kubernetes"
"github.com/arangodb/kube-arangodb/pkg/scheduler"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
)
func (i *implementation) CreateBatchJob(ctx context.Context, request *pbSchedulerV1.CreateBatchJobRequest) (*pbSchedulerV1.CreateBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
template := scheduler.SpecAsTemplate(request.GetSpec())
var spec schedulerApi.ArangoSchedulerBatchJob
spec.Namespace = i.cfg.Namespace
if meta := request.GetSpec().GetMetadata(); meta != nil {
if util.TypeOrDefault(meta.GenerateName, false) {
spec.GenerateName = meta.Name
} else {
spec.Name = meta.Name
}
}
spec.Spec.Template = *template
if batchJob := request.GetBatchJob(); batchJob != nil {
if v := batchJob.Completions; v != nil {
spec.Spec.Completions = v
}
if v := batchJob.Parallelism; v != nil {
spec.Spec.Parallelism = v
}
if v := batchJob.BackoffLimit; v != nil {
spec.Spec.BackoffLimit = v
}
}
if batchJobSpec := request.GetSpec(); batchJobSpec != nil {
if base := batchJobSpec.Base; base != nil {
spec.Labels = base.Labels
}
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerBatchJobs(i.cfg.Namespace).Create(ctx, &spec, meta.CreateOptions{})
if err != nil {
return nil, err
}
return &pbSchedulerV1.CreateBatchJobResponse{
Name: job.Name,
}, nil
}
func (i *implementation) GetBatchJob(ctx context.Context, request *pbSchedulerV1.GetBatchJobRequest) (*pbSchedulerV1.GetBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerBatchJobs(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.GetBatchJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.GetBatchJobResponse{
Exists: true,
BatchJob: &pbSchedulerV1.BatchJob{
Metadata: ExtractStatusMetadata(job.Status.ArangoSchedulerStatusMetadata),
Spec: &pbSchedulerV1.BatchJobSpec{
Parallelism: job.Spec.Parallelism,
Completions: job.Spec.Completions,
BackoffLimit: job.Spec.BackoffLimit,
},
Status: &pbSchedulerV1.BatchJobStatus{
Active: job.Status.Active,
Succeeded: job.Status.Succeeded,
Failed: job.Status.Failed,
},
},
}, nil
}
func (i *implementation) DeleteBatchJob(ctx context.Context, request *pbSchedulerV1.DeleteBatchJobRequest) (*pbSchedulerV1.DeleteBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
var d meta.DeleteOptions
if v := request.DeleteChildPods; v != nil {
if *v {
d.PropagationPolicy = util.NewType(meta.DeletePropagationBackground)
} else {
d.PropagationPolicy = util.NewType(meta.DeletePropagationOrphan)
}
}
err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerBatchJobs(i.cfg.Namespace).Delete(ctx, request.GetName(), d)
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.DeleteBatchJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.DeleteBatchJobResponse{Exists: true}, nil
}
func (i *implementation) ListBatchJob(ctx context.Context, request *pbSchedulerV1.ListBatchJobRequest) (*pbSchedulerV1.ListBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
objects, err := kubernetes.ListObjects[*schedulerApi.ArangoSchedulerBatchJobList, *schedulerApi.ArangoSchedulerBatchJob](ctx, i.client.Arango().SchedulerV1beta1().ArangoSchedulerBatchJobs(i.cfg.Namespace), func(result *schedulerApi.ArangoSchedulerBatchJobList) []*schedulerApi.ArangoSchedulerBatchJob {
r := make([]*schedulerApi.ArangoSchedulerBatchJob, len(result.Items))
for id := range result.Items {
r[id] = result.Items[id].DeepCopy()
}
return r
})
if err != nil {
return nil, err
}
return &pbSchedulerV1.ListBatchJobResponse{
BatchJobs: util.FormatList(objects, func(in *schedulerApi.ArangoSchedulerBatchJob) string {
return in.GetName()
}),
}, nil
}

View file

@ -25,7 +25,6 @@ import (
"testing"
"github.com/stretchr/testify/require"
batch "k8s.io/api/batch/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
@ -42,7 +41,7 @@ func Test_BatchJob(t *testing.T) {
client := kclient.NewFakeClientBuilder().Add(
tests.NewMetaObject(t, tests.FakeNamespace, "test", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{}
}),
}, tests.MarkArangoProfileAsReady),
tests.NewMetaObject(t, tests.FakeNamespace, "test-select-all", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{
Selectors: &schedulerApi.ProfileSelectors{
@ -50,7 +49,7 @@ func Test_BatchJob(t *testing.T) {
},
Template: &schedulerApi.ProfileTemplate{},
}
}),
}, tests.MarkArangoProfileAsReady),
tests.NewMetaObject(t, tests.FakeNamespace, "test-select-specific", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{
Selectors: &schedulerApi.ProfileSelectors{
@ -62,7 +61,7 @@ func Test_BatchJob(t *testing.T) {
},
Template: &schedulerApi.ProfileTemplate{},
}
}),
}, tests.MarkArangoProfileAsReady),
).Client()
scheduler := Client(t, ctx, client, func(c Configuration) Configuration {
@ -93,7 +92,7 @@ func Test_BatchJob(t *testing.T) {
Metadata: &pbSchedulerV1.Metadata{
Name: "test",
},
Job: &pbSchedulerV1.JobBase{
Base: &pbSchedulerV1.ObjectBase{
Labels: nil,
Profiles: []string{
"test",
@ -117,10 +116,6 @@ func Test_BatchJob(t *testing.T) {
require.NoError(t, err)
require.EqualValues(t, "test", resp.GetName())
require.Len(t, resp.Profiles, 2)
require.Contains(t, resp.Profiles, "test")
require.Contains(t, resp.Profiles, "test-select-all")
require.NotContains(t, resp.Profiles, "test-select-specific")
})
t.Run("Ensure job exist - get", func(t *testing.T) {
@ -151,7 +146,7 @@ func Test_BatchJob(t *testing.T) {
})
t.Run("Ensure job details - update", func(t *testing.T) {
job := tests.NewMetaObject[*batch.Job](t, tests.FakeNamespace, "test")
job := tests.NewMetaObject[*schedulerApi.ArangoSchedulerBatchJob](t, tests.FakeNamespace, "test")
tests.RefreshObjectsC(t, client, &job)

View file

@ -0,0 +1,249 @@
//
// 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 v1
import (
"context"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"github.com/arangodb/kube-arangodb/pkg/debug_package/generators/kubernetes"
"github.com/arangodb/kube-arangodb/pkg/scheduler"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
)
func (i *implementation) CreateCronJob(ctx context.Context, request *pbSchedulerV1.CreateCronJobRequest) (*pbSchedulerV1.CreateCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
template := scheduler.SpecAsTemplate(request.GetSpec())
var spec schedulerApi.ArangoSchedulerCronJob
spec.Namespace = i.cfg.Namespace
if meta := request.GetSpec().GetMetadata(); meta != nil {
if util.TypeOrDefault(meta.GenerateName, false) {
spec.GenerateName = meta.Name
} else {
spec.Name = meta.Name
}
}
spec.Spec.JobTemplate.Spec.Template = *template
if cronJob := request.GetCronJob(); cronJob != nil {
spec.Spec.Schedule = cronJob.Schedule
if batchJob := cronJob.GetJob(); batchJob != nil {
if v := batchJob.Completions; v != nil {
spec.Spec.JobTemplate.Spec.Completions = v
}
if v := batchJob.Parallelism; v != nil {
spec.Spec.JobTemplate.Spec.Parallelism = v
}
if v := batchJob.BackoffLimit; v != nil {
spec.Spec.JobTemplate.Spec.BackoffLimit = v
}
}
}
if batchJobSpec := request.GetSpec(); batchJobSpec != nil {
if base := batchJobSpec.Base; base != nil {
spec.Labels = base.Labels
spec.Spec.JobTemplate.Labels = base.Labels
}
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(i.cfg.Namespace).Create(ctx, &spec, meta.CreateOptions{})
if err != nil {
return nil, err
}
return &pbSchedulerV1.CreateCronJobResponse{
Name: job.Name,
}, nil
}
func (i *implementation) GetCronJob(ctx context.Context, request *pbSchedulerV1.GetCronJobRequest) (*pbSchedulerV1.GetCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.GetCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.GetCronJobResponse{
Exists: true,
CronJob: &pbSchedulerV1.CronJob{
Metadata: ExtractStatusMetadata(job.Status.ArangoSchedulerStatusMetadata),
Spec: &pbSchedulerV1.CronJobSpec{
Schedule: job.Spec.Schedule,
Job: &pbSchedulerV1.BatchJobSpec{
Parallelism: job.Spec.JobTemplate.Spec.Parallelism,
Completions: job.Spec.JobTemplate.Spec.Completions,
BackoffLimit: job.Spec.JobTemplate.Spec.BackoffLimit,
},
},
Status: &pbSchedulerV1.CronJobStatus{
BatchJobs: util.FormatList(job.Status.Active, func(in core.ObjectReference) string {
return in.Name
}),
},
},
}, nil
}
func (i *implementation) UpdateCronJob(ctx context.Context, request *pbSchedulerV1.UpdateCronJobRequest) (*pbSchedulerV1.UpdateCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.UpdateCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
if cronJob := request.GetSpec(); cronJob != nil {
job.Spec.Schedule = cronJob.Schedule
if batchJob := cronJob.GetJob(); batchJob != nil {
if v := batchJob.Completions; v != nil {
job.Spec.JobTemplate.Spec.Completions = v
}
if v := batchJob.Parallelism; v != nil {
job.Spec.JobTemplate.Spec.Parallelism = v
}
if v := batchJob.BackoffLimit; v != nil {
job.Spec.JobTemplate.Spec.BackoffLimit = v
}
}
}
job, err = i.client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(i.cfg.Namespace).Update(ctx, job, meta.UpdateOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.UpdateCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.UpdateCronJobResponse{
Exists: true,
CronJob: &pbSchedulerV1.CronJob{
Spec: &pbSchedulerV1.CronJobSpec{
Schedule: job.Spec.Schedule,
Job: &pbSchedulerV1.BatchJobSpec{
Parallelism: job.Spec.JobTemplate.Spec.Parallelism,
Completions: job.Spec.JobTemplate.Spec.Completions,
BackoffLimit: job.Spec.JobTemplate.Spec.BackoffLimit,
},
},
},
}, nil
}
func (i *implementation) ListCronJob(ctx context.Context, request *pbSchedulerV1.ListCronJobRequest) (*pbSchedulerV1.ListCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
objects, err := kubernetes.ListObjects[*schedulerApi.ArangoSchedulerCronJobList, *schedulerApi.ArangoSchedulerCronJob](ctx, i.client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(i.cfg.Namespace), func(result *schedulerApi.ArangoSchedulerCronJobList) []*schedulerApi.ArangoSchedulerCronJob {
r := make([]*schedulerApi.ArangoSchedulerCronJob, len(result.Items))
for id := range result.Items {
r[id] = result.Items[id].DeepCopy()
}
return r
})
if err != nil {
return nil, err
}
return &pbSchedulerV1.ListCronJobResponse{
CronJobs: util.FormatList(objects, func(in *schedulerApi.ArangoSchedulerCronJob) string {
return in.GetName()
}),
}, nil
}
func (i *implementation) DeleteCronJob(ctx context.Context, request *pbSchedulerV1.DeleteCronJobRequest) (*pbSchedulerV1.DeleteCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
var d meta.DeleteOptions
if v := request.DeleteChildPods; v != nil {
if *v {
d.PropagationPolicy = util.NewType(meta.DeletePropagationBackground)
} else {
d.PropagationPolicy = util.NewType(meta.DeletePropagationOrphan)
}
}
err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerCronJobs(i.cfg.Namespace).Delete(ctx, request.GetName(), d)
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.DeleteCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.DeleteCronJobResponse{Exists: true}, nil
}

View file

@ -25,7 +25,6 @@ import (
"testing"
"github.com/stretchr/testify/require"
batch "k8s.io/api/batch/v1"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -43,7 +42,7 @@ func Test_CronJob(t *testing.T) {
client := kclient.NewFakeClientBuilder().Add(
tests.NewMetaObject(t, tests.FakeNamespace, "test", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{}
}),
}, tests.MarkArangoProfileAsReady),
tests.NewMetaObject(t, tests.FakeNamespace, "test-select-all", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{
Selectors: &schedulerApi.ProfileSelectors{
@ -51,7 +50,7 @@ func Test_CronJob(t *testing.T) {
},
Template: &schedulerApi.ProfileTemplate{},
}
}),
}, tests.MarkArangoProfileAsReady),
tests.NewMetaObject(t, tests.FakeNamespace, "test-select-specific", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{
Selectors: &schedulerApi.ProfileSelectors{
@ -63,7 +62,7 @@ func Test_CronJob(t *testing.T) {
},
Template: &schedulerApi.ProfileTemplate{},
}
}),
}, tests.MarkArangoProfileAsReady),
).Client()
scheduler := Client(t, ctx, client, func(c Configuration) Configuration {
@ -94,7 +93,7 @@ func Test_CronJob(t *testing.T) {
Metadata: &pbSchedulerV1.Metadata{
Name: "test",
},
Job: &pbSchedulerV1.JobBase{
Base: &pbSchedulerV1.ObjectBase{
Labels: nil,
Profiles: []string{
"test",
@ -123,10 +122,6 @@ func Test_CronJob(t *testing.T) {
require.NoError(t, err)
require.EqualValues(t, "test", resp.GetName())
require.Len(t, resp.Profiles, 2)
require.Contains(t, resp.Profiles, "test")
require.Contains(t, resp.Profiles, "test-select-all")
require.NotContains(t, resp.Profiles, "test-select-specific")
})
t.Run("Ensure job exist - get", func(t *testing.T) {
@ -153,11 +148,11 @@ func Test_CronJob(t *testing.T) {
require.NoError(t, err)
require.True(t, resp.GetExists())
require.Len(t, resp.GetBatchJobs(), 0)
require.Len(t, resp.GetCronJob().GetStatus().GetBatchJobs(), 0)
})
t.Run("Ensure job details - update", func(t *testing.T) {
job := tests.NewMetaObject[*batch.CronJob](t, tests.FakeNamespace, "test")
job := tests.NewMetaObject[*schedulerApi.ArangoSchedulerCronJob](t, tests.FakeNamespace, "test")
tests.RefreshObjectsC(t, client, &job)
@ -177,7 +172,7 @@ func Test_CronJob(t *testing.T) {
require.NoError(t, err)
require.True(t, resp.GetExists())
require.Len(t, resp.GetBatchJobs(), 1)
require.Len(t, resp.GetCronJob().GetStatus().GetBatchJobs(), 1)
})
t.Run("Update Job - Pre", func(t *testing.T) {

View file

@ -46,10 +46,12 @@ type BatchJob struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// defines object status metadate
Metadata *StatusMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
// Keeps BatchJob settings
Spec *BatchJobSpec `protobuf:"bytes,1,opt,name=spec,proto3" json:"spec,omitempty"`
Spec *BatchJobSpec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty"`
// Keeps current BatchJob Status
Status *BatchJobStatus `protobuf:"bytes,2,opt,name=status,proto3,oneof" json:"status,omitempty"`
Status *BatchJobStatus `protobuf:"bytes,3,opt,name=status,proto3,oneof" json:"status,omitempty"`
}
func (x *BatchJob) Reset() {
@ -84,6 +86,13 @@ func (*BatchJob) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_batchjob_proto_rawDescGZIP(), []int{0}
}
func (x *BatchJob) GetMetadata() *StatusMetadata {
if x != nil {
return x.Metadata
}
return nil
}
func (x *BatchJob) GetSpec() *BatchJobSpec {
if x != nil {
return x.Spec
@ -239,37 +248,44 @@ var file_integrations_scheduler_v1_definition_batchjob_proto_rawDesc = []byte{
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x6a, 0x6f, 0x62, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72,
0x22, 0x7a, 0x0a, 0x08, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x12, 0x2b, 0x0a, 0x04,
0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x63, 0x68,
0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53,
0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x36, 0x0a, 0x06, 0x73, 0x74, 0x61,
0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65,
0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01,
0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xb8, 0x01, 0x0a,
0x0c, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x12, 0x25, 0x0a,
0x0b, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x6d, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x48, 0x00, 0x52, 0x0b, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x69, 0x73,
0x6d, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6d,
0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x62,
0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x48, 0x02, 0x52, 0x0c, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x4c, 0x69, 0x6d,
0x69, 0x74, 0x88, 0x01, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c,
0x65, 0x6c, 0x69, 0x73, 0x6d, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65,
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66,
0x66, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x5e, 0x0a, 0x0e, 0x42, 0x61, 0x74, 0x63, 0x68,
0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74,
0x69, 0x76, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76,
0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x12,
0x16, 0x0a, 0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x06, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x6b,
0x75, 0x62, 0x65, 0x2d, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x69, 0x6e, 0x74,
0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75,
0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f,
0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x1a, 0x31, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73,
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x01, 0x0a, 0x08, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62,
0x12, 0x35, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x53,
0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65,
0x72, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04,
0x73, 0x70, 0x65, 0x63, 0x12, 0x36, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x03,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72,
0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48,
0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07,
0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0xb8, 0x01, 0x0a, 0x0c, 0x42, 0x61, 0x74, 0x63,
0x68, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x12, 0x25, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x61,
0x6c, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52,
0x0b, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x6d, 0x88, 0x01, 0x01, 0x12,
0x25, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02,
0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x88, 0x01, 0x01, 0x12, 0x28, 0x0a, 0x0d, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66,
0x66, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x02, 0x52,
0x0c, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x88, 0x01, 0x01,
0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6c, 0x6c, 0x65, 0x6c, 0x69, 0x73, 0x6d,
0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x62, 0x61, 0x63, 0x6b, 0x6f, 0x66, 0x66, 0x5f, 0x6c, 0x69, 0x6d,
0x69, 0x74, 0x22, 0x5e, 0x0a, 0x0e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1c, 0x0a, 0x09,
0x73, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
0x09, 0x73, 0x75, 0x63, 0x63, 0x65, 0x65, 0x64, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x61,
0x69, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x66, 0x61, 0x69, 0x6c,
0x65, 0x64, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
0x2f, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x2d, 0x61,
0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76,
0x31, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -289,15 +305,17 @@ var file_integrations_scheduler_v1_definition_batchjob_proto_goTypes = []interfa
(*BatchJob)(nil), // 0: scheduler.BatchJob
(*BatchJobSpec)(nil), // 1: scheduler.BatchJobSpec
(*BatchJobStatus)(nil), // 2: scheduler.BatchJobStatus
(*StatusMetadata)(nil), // 3: scheduler.StatusMetadata
}
var file_integrations_scheduler_v1_definition_batchjob_proto_depIdxs = []int32{
1, // 0: scheduler.BatchJob.spec:type_name -> scheduler.BatchJobSpec
2, // 1: scheduler.BatchJob.status:type_name -> scheduler.BatchJobStatus
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
3, // 0: scheduler.BatchJob.metadata:type_name -> scheduler.StatusMetadata
1, // 1: scheduler.BatchJob.spec:type_name -> scheduler.BatchJobSpec
2, // 2: scheduler.BatchJob.status:type_name -> scheduler.BatchJobStatus
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_integrations_scheduler_v1_definition_batchjob_proto_init() }
@ -305,6 +323,7 @@ func file_integrations_scheduler_v1_definition_batchjob_proto_init() {
if File_integrations_scheduler_v1_definition_batchjob_proto != nil {
return
}
file_integrations_scheduler_v1_definition_common_proto_init()
if !protoimpl.UnsafeEnabled {
file_integrations_scheduler_v1_definition_batchjob_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BatchJob); i {

View file

@ -22,15 +22,20 @@ syntax = "proto3";
package scheduler;
import "integrations/scheduler/v1/definition/common.proto";
option go_package = "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition";
// Keeps information about Kubernetes Batch/V1 Job
message BatchJob {
// defines object status metadate
StatusMetadata metadata = 1;
// Keeps BatchJob settings
BatchJobSpec spec = 1;
BatchJobSpec spec = 2;
// Keeps current BatchJob Status
optional BatchJobStatus status = 2;
optional BatchJobStatus status = 3;
}
// Information about BatchJob run settings, like completions and parallelism

View file

@ -40,8 +40,8 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Common base of the Jobs
type JobBase struct {
// Common base of the objects
type ObjectBase struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -52,8 +52,8 @@ type JobBase struct {
Profiles []string `protobuf:"bytes,2,rep,name=profiles,proto3" json:"profiles,omitempty"`
}
func (x *JobBase) Reset() {
*x = JobBase{}
func (x *ObjectBase) Reset() {
*x = ObjectBase{}
if protoimpl.UnsafeEnabled {
mi := &file_integrations_scheduler_v1_definition_common_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -61,13 +61,13 @@ func (x *JobBase) Reset() {
}
}
func (x *JobBase) String() string {
func (x *ObjectBase) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JobBase) ProtoMessage() {}
func (*ObjectBase) ProtoMessage() {}
func (x *JobBase) ProtoReflect() protoreflect.Message {
func (x *ObjectBase) ProtoReflect() protoreflect.Message {
mi := &file_integrations_scheduler_v1_definition_common_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -79,19 +79,19 @@ func (x *JobBase) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use JobBase.ProtoReflect.Descriptor instead.
func (*JobBase) Descriptor() ([]byte, []int) {
// Deprecated: Use ObjectBase.ProtoReflect.Descriptor instead.
func (*ObjectBase) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_common_proto_rawDescGZIP(), []int{0}
}
func (x *JobBase) GetLabels() map[string]string {
func (x *ObjectBase) GetLabels() map[string]string {
if x != nil {
return x.Labels
}
return nil
}
func (x *JobBase) GetProfiles() []string {
func (x *ObjectBase) GetProfiles() []string {
if x != nil {
return x.Profiles
}
@ -232,7 +232,7 @@ type Spec struct {
// Keeps requested Metadata
Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
// Keeps requested Job base
Job *JobBase `protobuf:"bytes,2,opt,name=job,proto3" json:"job,omitempty"`
Base *ObjectBase `protobuf:"bytes,2,opt,name=base,proto3" json:"base,omitempty"`
// Keeps map of the containers
Containers map[string]*ContainerBase `protobuf:"bytes,3,rep,name=containers,proto3" json:"containers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
@ -276,9 +276,9 @@ func (x *Spec) GetMetadata() *Metadata {
return nil
}
func (x *Spec) GetJob() *JobBase {
func (x *Spec) GetBase() *ObjectBase {
if x != nil {
return x.Job
return x.Base
}
return nil
}
@ -290,65 +290,151 @@ func (x *Spec) GetContainers() map[string]*ContainerBase {
return nil
}
// Defines status of the scheduled object
type StatusMetadata struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Defines if upstream object has been created
Created bool `protobuf:"varint,1,opt,name=created,proto3" json:"created,omitempty"`
// Defines checksum
Checksum *string `protobuf:"bytes,2,opt,name=checksum,proto3,oneof" json:"checksum,omitempty"`
// Defines uid
Uid *string `protobuf:"bytes,3,opt,name=uid,proto3,oneof" json:"uid,omitempty"`
// Defiles list of applied profiles
Profiles []string `protobuf:"bytes,4,rep,name=profiles,proto3" json:"profiles,omitempty"`
}
func (x *StatusMetadata) Reset() {
*x = StatusMetadata{}
if protoimpl.UnsafeEnabled {
mi := &file_integrations_scheduler_v1_definition_common_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *StatusMetadata) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*StatusMetadata) ProtoMessage() {}
func (x *StatusMetadata) ProtoReflect() protoreflect.Message {
mi := &file_integrations_scheduler_v1_definition_common_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use StatusMetadata.ProtoReflect.Descriptor instead.
func (*StatusMetadata) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_common_proto_rawDescGZIP(), []int{4}
}
func (x *StatusMetadata) GetCreated() bool {
if x != nil {
return x.Created
}
return false
}
func (x *StatusMetadata) GetChecksum() string {
if x != nil && x.Checksum != nil {
return *x.Checksum
}
return ""
}
func (x *StatusMetadata) GetUid() string {
if x != nil && x.Uid != nil {
return *x.Uid
}
return ""
}
func (x *StatusMetadata) GetProfiles() []string {
if x != nil {
return x.Profiles
}
return nil
}
var File_integrations_scheduler_v1_definition_common_proto protoreflect.FileDescriptor
var file_integrations_scheduler_v1_definition_common_proto_rawDesc = []byte{
0x0a, 0x31, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73,
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x22, 0x98,
0x01, 0x0a, 0x07, 0x4a, 0x6f, 0x62, 0x42, 0x61, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x6c, 0x61,
0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x63, 0x68,
0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x4a, 0x6f, 0x62, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x4c,
0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x6c, 0x61, 0x62, 0x65,
0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x02,
0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x1a, 0x39,
0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x5a, 0x0a, 0x08, 0x4d, 0x65, 0x74,
0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x0d, 0x67, 0x65, 0x6e,
0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08,
0x48, 0x00, 0x52, 0x0c, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65,
0x88, 0x01, 0x01, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65,
0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xfa, 0x01, 0x0a, 0x0d, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69,
0x6e, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x88,
0x01, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x67, 0x0a, 0x15, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f,
0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x18,
0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65,
0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x2e,
0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x72, 0x69, 0x61,
0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x65, 0x6e, 0x76, 0x69, 0x72,
0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x1a,
0x47, 0x0a, 0x19, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61,
0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x69, 0x6d, 0x61,
0x67, 0x65, 0x22, 0xf7, 0x01, 0x0a, 0x04, 0x53, 0x70, 0x65, 0x63, 0x12, 0x2f, 0x0a, 0x08, 0x6d,
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e,
0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x24, 0x0a, 0x03,
0x6a, 0x6f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x63, 0x68, 0x65,
0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x4a, 0x6f, 0x62, 0x42, 0x61, 0x73, 0x65, 0x52, 0x03, 0x6a,
0x6f, 0x62, 0x12, 0x3f, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73,
0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,
0x65, 0x72, 0x2e, 0x53, 0x70, 0x65, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x73, 0x1a, 0x57, 0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72,
0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75,
0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x73,
0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x48, 0x5a, 0x46,
0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x61, 0x6e, 0x67,
0x6f, 0x64, 0x62, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x2d, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64,
0x62, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73,
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x22, 0x9e,
0x01, 0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x42, 0x61, 0x73, 0x65, 0x12, 0x39, 0x0a,
0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e,
0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74,
0x42, 0x61, 0x73, 0x65, 0x2e, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x52, 0x06, 0x6c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x66,
0x69, 0x6c, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x66,
0x69, 0x6c, 0x65, 0x73, 0x1a, 0x39, 0x0a, 0x0b, 0x4c, 0x61, 0x62, 0x65, 0x6c, 0x73, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22,
0x5a, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
0x28, 0x0a, 0x0d, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x0c, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61,
0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x88, 0x01, 0x01, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x67, 0x65,
0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xfa, 0x01, 0x0a, 0x0d,
0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x12, 0x19, 0x0a,
0x05, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x05,
0x69, 0x6d, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x72, 0x67, 0x73,
0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x61, 0x72, 0x67, 0x73, 0x12, 0x67, 0x0a, 0x15,
0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x72, 0x69,
0x61, 0x62, 0x6c, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x32, 0x2e, 0x73, 0x63,
0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65,
0x72, 0x42, 0x61, 0x73, 0x65, 0x2e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52,
0x14, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x72, 0x69,
0x61, 0x62, 0x6c, 0x65, 0x73, 0x1a, 0x47, 0x0a, 0x19, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e,
0x6d, 0x65, 0x6e, 0x74, 0x56, 0x61, 0x72, 0x69, 0x61, 0x62, 0x6c, 0x65, 0x73, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x08,
0x0a, 0x06, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x22, 0xfc, 0x01, 0x0a, 0x04, 0x53, 0x70, 0x65,
0x63, 0x12, 0x2f, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e,
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0x12, 0x29, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x15, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x4f, 0x62, 0x6a,
0x65, 0x63, 0x74, 0x42, 0x61, 0x73, 0x65, 0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x3f, 0x0a,
0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x1f, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x53, 0x70,
0x65, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74,
0x72, 0x79, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x1a, 0x57,
0x0a, 0x0f, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x2e, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x43,
0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x42, 0x61, 0x73, 0x65, 0x52, 0x05, 0x76, 0x61,
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x93, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72,
0x65, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x63, 0x72, 0x65,
0x61, 0x74, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73, 0x75, 0x6d,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x73,
0x75, 0x6d, 0x88, 0x01, 0x01, 0x12, 0x15, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x48, 0x01, 0x52, 0x03, 0x75, 0x69, 0x64, 0x88, 0x01, 0x01, 0x12, 0x1a, 0x0a, 0x08,
0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
0x70, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x63, 0x68, 0x65,
0x63, 0x6b, 0x73, 0x75, 0x6d, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x75, 0x69, 0x64, 0x42, 0x48, 0x5a,
0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x61, 0x6e,
0x67, 0x6f, 0x64, 0x62, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x2d, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f,
0x64, 0x62, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f,
0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66,
0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -363,22 +449,23 @@ func file_integrations_scheduler_v1_definition_common_proto_rawDescGZIP() []byte
return file_integrations_scheduler_v1_definition_common_proto_rawDescData
}
var file_integrations_scheduler_v1_definition_common_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_integrations_scheduler_v1_definition_common_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_integrations_scheduler_v1_definition_common_proto_goTypes = []interface{}{
(*JobBase)(nil), // 0: scheduler.JobBase
(*ObjectBase)(nil), // 0: scheduler.ObjectBase
(*Metadata)(nil), // 1: scheduler.Metadata
(*ContainerBase)(nil), // 2: scheduler.ContainerBase
(*Spec)(nil), // 3: scheduler.Spec
nil, // 4: scheduler.JobBase.LabelsEntry
nil, // 5: scheduler.ContainerBase.EnvironmentVariablesEntry
nil, // 6: scheduler.Spec.ContainersEntry
(*StatusMetadata)(nil), // 4: scheduler.StatusMetadata
nil, // 5: scheduler.ObjectBase.LabelsEntry
nil, // 6: scheduler.ContainerBase.EnvironmentVariablesEntry
nil, // 7: scheduler.Spec.ContainersEntry
}
var file_integrations_scheduler_v1_definition_common_proto_depIdxs = []int32{
4, // 0: scheduler.JobBase.labels:type_name -> scheduler.JobBase.LabelsEntry
5, // 1: scheduler.ContainerBase.environment_variables:type_name -> scheduler.ContainerBase.EnvironmentVariablesEntry
5, // 0: scheduler.ObjectBase.labels:type_name -> scheduler.ObjectBase.LabelsEntry
6, // 1: scheduler.ContainerBase.environment_variables:type_name -> scheduler.ContainerBase.EnvironmentVariablesEntry
1, // 2: scheduler.Spec.metadata:type_name -> scheduler.Metadata
0, // 3: scheduler.Spec.job:type_name -> scheduler.JobBase
6, // 4: scheduler.Spec.containers:type_name -> scheduler.Spec.ContainersEntry
0, // 3: scheduler.Spec.base:type_name -> scheduler.ObjectBase
7, // 4: scheduler.Spec.containers:type_name -> scheduler.Spec.ContainersEntry
2, // 5: scheduler.Spec.ContainersEntry.value:type_name -> scheduler.ContainerBase
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
@ -394,7 +481,7 @@ func file_integrations_scheduler_v1_definition_common_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_integrations_scheduler_v1_definition_common_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JobBase); i {
switch v := v.(*ObjectBase); i {
case 0:
return &v.state
case 1:
@ -441,16 +528,29 @@ func file_integrations_scheduler_v1_definition_common_proto_init() {
return nil
}
}
file_integrations_scheduler_v1_definition_common_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*StatusMetadata); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_integrations_scheduler_v1_definition_common_proto_msgTypes[1].OneofWrappers = []interface{}{}
file_integrations_scheduler_v1_definition_common_proto_msgTypes[2].OneofWrappers = []interface{}{}
file_integrations_scheduler_v1_definition_common_proto_msgTypes[4].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_integrations_scheduler_v1_definition_common_proto_rawDesc,
NumEnums: 0,
NumMessages: 7,
NumMessages: 8,
NumExtensions: 0,
NumServices: 0,
},

View file

@ -24,8 +24,8 @@ package scheduler;
option go_package = "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition";
// Common base of the Jobs
message JobBase {
// Common base of the objects
message ObjectBase {
// Map of the Labels assigned to the job. Used for Profile selection
map<string, string> labels = 1;
@ -60,8 +60,23 @@ message Spec {
Metadata metadata = 1;
// Keeps requested Job base
JobBase job = 2;
ObjectBase base = 2;
// Keeps map of the containers
map<string, ContainerBase> containers = 3;
}
// Defines status of the scheduled object
message StatusMetadata {
// Defines if upstream object has been created
bool created = 1;
// Defines checksum
optional string checksum =2;
// Defines uid
optional string uid =3;
// Defiles list of applied profiles
repeated string profiles = 4;
}

View file

@ -46,8 +46,12 @@ type CronJob struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// defines object status metadate
Metadata *StatusMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
// Keeps the CronJob Settings
Spec *CronJobSpec `protobuf:"bytes,1,opt,name=spec,proto3" json:"spec,omitempty"`
Spec *CronJobSpec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty"`
// Keeps the CronJob Status
Status *CronJobStatus `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"`
}
func (x *CronJob) Reset() {
@ -82,6 +86,13 @@ func (*CronJob) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_cronjob_proto_rawDescGZIP(), []int{0}
}
func (x *CronJob) GetMetadata() *StatusMetadata {
if x != nil {
return x.Metadata
}
return nil
}
func (x *CronJob) GetSpec() *CronJobSpec {
if x != nil {
return x.Spec
@ -89,6 +100,13 @@ func (x *CronJob) GetSpec() *CronJobSpec {
return nil
}
func (x *CronJob) GetStatus() *CronJobStatus {
if x != nil {
return x.Status
}
return nil
}
// Information about CronJob run settings
type CronJobSpec struct {
state protoimpl.MessageState
@ -147,6 +165,55 @@ func (x *CronJobSpec) GetJob() *BatchJobSpec {
return nil
}
// Information about CronJob Status
type CronJobStatus struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Keeps list of created BatchJobs
BatchJobs []string `protobuf:"bytes,1,rep,name=batch_jobs,json=batchJobs,proto3" json:"batch_jobs,omitempty"`
}
func (x *CronJobStatus) Reset() {
*x = CronJobStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_integrations_scheduler_v1_definition_cronjob_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *CronJobStatus) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*CronJobStatus) ProtoMessage() {}
func (x *CronJobStatus) ProtoReflect() protoreflect.Message {
mi := &file_integrations_scheduler_v1_definition_cronjob_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use CronJobStatus.ProtoReflect.Descriptor instead.
func (*CronJobStatus) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_cronjob_proto_rawDescGZIP(), []int{2}
}
func (x *CronJobStatus) GetBatchJobs() []string {
if x != nil {
return x.BatchJobs
}
return nil
}
var File_integrations_scheduler_v1_definition_cronjob_proto protoreflect.FileDescriptor
var file_integrations_scheduler_v1_definition_cronjob_proto_rawDesc = []byte{
@ -154,24 +221,36 @@ var file_integrations_scheduler_v1_definition_cronjob_proto_rawDesc = []byte{
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x72, 0x6f, 0x6e, 0x6a, 0x6f, 0x62, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x1a,
0x33, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x63,
0x31, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x63,
0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x6a, 0x6f, 0x62, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x35, 0x0a, 0x07, 0x43, 0x72, 0x6f, 0x6e, 0x4a, 0x6f, 0x62, 0x12,
0x2a, 0x0a, 0x04, 0x73, 0x70, 0x65, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x4a, 0x6f,
0x62, 0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x22, 0x54, 0x0a, 0x0b, 0x43,
0x72, 0x6f, 0x6e, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63,
0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63,
0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x6a, 0x6f, 0x62, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e,
0x42, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x52, 0x03, 0x6a, 0x6f,
0x62, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x2d, 0x61, 0x72,
0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31,
0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x1a, 0x33, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65,
0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x62, 0x61, 0x74, 0x63, 0x68, 0x6a, 0x6f,
0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9e, 0x01, 0x0a, 0x07, 0x43, 0x72, 0x6f, 0x6e,
0x4a, 0x6f, 0x62, 0x12, 0x35, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65,
0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2a, 0x0a, 0x04, 0x73, 0x70,
0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64,
0x75, 0x6c, 0x65, 0x72, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63,
0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,
0x65, 0x72, 0x2e, 0x43, 0x72, 0x6f, 0x6e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x54, 0x0a, 0x0b, 0x43, 0x72, 0x6f, 0x6e,
0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64,
0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x63, 0x68, 0x65, 0x64,
0x75, 0x6c, 0x65, 0x12, 0x29, 0x0a, 0x03, 0x6a, 0x6f, 0x62, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
0x32, 0x17, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x42, 0x61, 0x74,
0x63, 0x68, 0x4a, 0x6f, 0x62, 0x53, 0x70, 0x65, 0x63, 0x52, 0x03, 0x6a, 0x6f, 0x62, 0x22, 0x2e,
0x0a, 0x0d, 0x43, 0x72, 0x6f, 0x6e, 0x4a, 0x6f, 0x62, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
0x1d, 0x0a, 0x0a, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x6a, 0x6f, 0x62, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x09, 0x52, 0x09, 0x62, 0x61, 0x74, 0x63, 0x68, 0x4a, 0x6f, 0x62, 0x73, 0x42, 0x48,
0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x61,
0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x6b, 0x75, 0x62, 0x65, 0x2d, 0x61, 0x72, 0x61, 0x6e, 0x67,
0x6f, 0x64, 0x62, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65,
0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -186,20 +265,24 @@ func file_integrations_scheduler_v1_definition_cronjob_proto_rawDescGZIP() []byt
return file_integrations_scheduler_v1_definition_cronjob_proto_rawDescData
}
var file_integrations_scheduler_v1_definition_cronjob_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_integrations_scheduler_v1_definition_cronjob_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_integrations_scheduler_v1_definition_cronjob_proto_goTypes = []interface{}{
(*CronJob)(nil), // 0: scheduler.CronJob
(*CronJobSpec)(nil), // 1: scheduler.CronJobSpec
(*BatchJobSpec)(nil), // 2: scheduler.BatchJobSpec
(*CronJobStatus)(nil), // 2: scheduler.CronJobStatus
(*StatusMetadata)(nil), // 3: scheduler.StatusMetadata
(*BatchJobSpec)(nil), // 4: scheduler.BatchJobSpec
}
var file_integrations_scheduler_v1_definition_cronjob_proto_depIdxs = []int32{
1, // 0: scheduler.CronJob.spec:type_name -> scheduler.CronJobSpec
2, // 1: scheduler.CronJobSpec.job:type_name -> scheduler.BatchJobSpec
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
3, // 0: scheduler.CronJob.metadata:type_name -> scheduler.StatusMetadata
1, // 1: scheduler.CronJob.spec:type_name -> scheduler.CronJobSpec
2, // 2: scheduler.CronJob.status:type_name -> scheduler.CronJobStatus
4, // 3: scheduler.CronJobSpec.job:type_name -> scheduler.BatchJobSpec
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
}
func init() { file_integrations_scheduler_v1_definition_cronjob_proto_init() }
@ -207,6 +290,7 @@ func file_integrations_scheduler_v1_definition_cronjob_proto_init() {
if File_integrations_scheduler_v1_definition_cronjob_proto != nil {
return
}
file_integrations_scheduler_v1_definition_common_proto_init()
file_integrations_scheduler_v1_definition_batchjob_proto_init()
if !protoimpl.UnsafeEnabled {
file_integrations_scheduler_v1_definition_cronjob_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
@ -233,6 +317,18 @@ func file_integrations_scheduler_v1_definition_cronjob_proto_init() {
return nil
}
}
file_integrations_scheduler_v1_definition_cronjob_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CronJobStatus); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -240,7 +336,7 @@ func file_integrations_scheduler_v1_definition_cronjob_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_integrations_scheduler_v1_definition_cronjob_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},

View file

@ -22,14 +22,21 @@ syntax = "proto3";
package scheduler;
import "integrations/scheduler/v1/definition/common.proto";
import "integrations/scheduler/v1/definition/batchjob.proto";
option go_package = "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition";
// Keeps information about Kubernetes Batch/V1 CronJob
message CronJob {
// defines object status metadate
StatusMetadata metadata = 1;
// Keeps the CronJob Settings
CronJobSpec spec = 1;
CronJobSpec spec = 2;
// Keeps the CronJob Status
CronJobStatus status = 3;
}
// Information about CronJob run settings
@ -40,3 +47,9 @@ message CronJobSpec {
// Keeps BatchJob settings
BatchJobSpec job = 2;
}
// Information about CronJob Status
message CronJobStatus {
// Keeps list of created BatchJobs
repeated string batch_jobs = 1;
}

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@ package scheduler;
import "integrations/scheduler/v1/definition/batchjob.proto";
import "integrations/scheduler/v1/definition/common.proto";
import "integrations/scheduler/v1/definition/cronjob.proto";
import "integrations/scheduler/v1/definition/deployment.proto";
option go_package = "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition";
@ -60,6 +61,23 @@ service SchedulerV1 {
// Deletes CronJob. If job does not exists, Exists flag is set to false
rpc DeleteCronJob(DeleteCronJobRequest) returns (DeleteCronJobResponse) {};
// Deployment
// Creates Deployment from specification
rpc CreateDeployment(CreateDeploymentRequest) returns (CreateDeploymentResponse) {};
// Returns Deployment. If job does not exists, Exists flag is set to false
rpc GetDeployment(GetDeploymentRequest) returns (GetDeploymentResponse) {};
// Updates Deployment from specification
rpc UpdateDeployment(UpdateDeploymentRequest) returns (UpdateDeploymentResponse) {};
// Returns list of the Deployments
rpc ListDeployment(ListDeploymentRequest) returns (ListDeploymentResponse) {};
// Deletes Deployment. If job does not exists, Exists flag is set to false
rpc DeleteDeployment(DeleteDeploymentRequest) returns (DeleteDeploymentResponse) {};
}
// BatchJob
@ -77,9 +95,6 @@ message CreateBatchJobRequest {
message CreateBatchJobResponse {
// Name of the scheduled job
string name = 1;
// List of the assigned profiles
repeated string profiles = 2;
}
// Get Request
@ -138,9 +153,6 @@ message CreateCronJobRequest {
message CreateCronJobResponse {
// Name of the scheduled job
string name = 1;
// List of the assigned profiles
repeated string profiles = 2;
}
// Get Request
@ -156,9 +168,6 @@ message GetCronJobResponse {
// CronJob run settings and current status
optional CronJob cron_job = 2;
// Keeps list of created BatchJobs
repeated string batch_jobs = 3;
}
// Update Request
@ -203,3 +212,78 @@ message DeleteCronJobResponse {
// Defines if job was found
bool exists = 1;
}
// Deployment
// Create Request
message CreateDeploymentRequest {
// Spec of the Schedule request
Spec spec = 1;
// Deployment run settings
DeploymentSpec deployment = 2;
}
// Create Response
message CreateDeploymentResponse {
// Name of the scheduled deployment
string name = 1;
}
// Get Request
message GetDeploymentRequest {
// Name of the scheduled deployment
string name = 1;
}
// Get Response
message GetDeploymentResponse {
// Defines if deployment was found
bool exists = 1;
// Deployment run settings and current status
optional Deployment deployment = 2;
}
// Update Request
message UpdateDeploymentRequest {
// Name of the scheduled deployment
string name = 1;
// Deployment spec to be updated
DeploymentSpec spec = 2;
}
// Update Response
message UpdateDeploymentResponse {
// Defines if deployment was found
bool exists = 1;
// Deployment run settings and current status
optional Deployment deployment = 2;
}
// List Request
message ListDeploymentRequest {
}
// List Response
message ListDeploymentResponse {
// List of the Deployments
repeated string deployments = 1;
}
// Delete Request
message DeleteDeploymentRequest {
// Name of the scheduled deployment
string name = 1;
// Defines if all child containers/pods should be removed together with deployment
optional bool delete_child_pods = 2;
}
// Delete Response
message DeleteDeploymentResponse {
// Defines if deployment was found
bool exists = 1;
}

View file

@ -40,6 +40,16 @@ type SchedulerV1Client interface {
ListCronJob(ctx context.Context, in *ListCronJobRequest, opts ...grpc.CallOption) (*ListCronJobResponse, error)
// Deletes CronJob. If job does not exists, Exists flag is set to false
DeleteCronJob(ctx context.Context, in *DeleteCronJobRequest, opts ...grpc.CallOption) (*DeleteCronJobResponse, error)
// Creates Deployment from specification
CreateDeployment(ctx context.Context, in *CreateDeploymentRequest, opts ...grpc.CallOption) (*CreateDeploymentResponse, error)
// Returns Deployment. If job does not exists, Exists flag is set to false
GetDeployment(ctx context.Context, in *GetDeploymentRequest, opts ...grpc.CallOption) (*GetDeploymentResponse, error)
// Updates Deployment from specification
UpdateDeployment(ctx context.Context, in *UpdateDeploymentRequest, opts ...grpc.CallOption) (*UpdateDeploymentResponse, error)
// Returns list of the Deployments
ListDeployment(ctx context.Context, in *ListDeploymentRequest, opts ...grpc.CallOption) (*ListDeploymentResponse, error)
// Deletes Deployment. If job does not exists, Exists flag is set to false
DeleteDeployment(ctx context.Context, in *DeleteDeploymentRequest, opts ...grpc.CallOption) (*DeleteDeploymentResponse, error)
}
type schedulerV1Client struct {
@ -131,6 +141,51 @@ func (c *schedulerV1Client) DeleteCronJob(ctx context.Context, in *DeleteCronJob
return out, nil
}
func (c *schedulerV1Client) CreateDeployment(ctx context.Context, in *CreateDeploymentRequest, opts ...grpc.CallOption) (*CreateDeploymentResponse, error) {
out := new(CreateDeploymentResponse)
err := c.cc.Invoke(ctx, "/scheduler.SchedulerV1/CreateDeployment", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *schedulerV1Client) GetDeployment(ctx context.Context, in *GetDeploymentRequest, opts ...grpc.CallOption) (*GetDeploymentResponse, error) {
out := new(GetDeploymentResponse)
err := c.cc.Invoke(ctx, "/scheduler.SchedulerV1/GetDeployment", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *schedulerV1Client) UpdateDeployment(ctx context.Context, in *UpdateDeploymentRequest, opts ...grpc.CallOption) (*UpdateDeploymentResponse, error) {
out := new(UpdateDeploymentResponse)
err := c.cc.Invoke(ctx, "/scheduler.SchedulerV1/UpdateDeployment", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *schedulerV1Client) ListDeployment(ctx context.Context, in *ListDeploymentRequest, opts ...grpc.CallOption) (*ListDeploymentResponse, error) {
out := new(ListDeploymentResponse)
err := c.cc.Invoke(ctx, "/scheduler.SchedulerV1/ListDeployment", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *schedulerV1Client) DeleteDeployment(ctx context.Context, in *DeleteDeploymentRequest, opts ...grpc.CallOption) (*DeleteDeploymentResponse, error) {
out := new(DeleteDeploymentResponse)
err := c.cc.Invoke(ctx, "/scheduler.SchedulerV1/DeleteDeployment", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// SchedulerV1Server is the server API for SchedulerV1 service.
// All implementations must embed UnimplementedSchedulerV1Server
// for forward compatibility
@ -153,6 +208,16 @@ type SchedulerV1Server interface {
ListCronJob(context.Context, *ListCronJobRequest) (*ListCronJobResponse, error)
// Deletes CronJob. If job does not exists, Exists flag is set to false
DeleteCronJob(context.Context, *DeleteCronJobRequest) (*DeleteCronJobResponse, error)
// Creates Deployment from specification
CreateDeployment(context.Context, *CreateDeploymentRequest) (*CreateDeploymentResponse, error)
// Returns Deployment. If job does not exists, Exists flag is set to false
GetDeployment(context.Context, *GetDeploymentRequest) (*GetDeploymentResponse, error)
// Updates Deployment from specification
UpdateDeployment(context.Context, *UpdateDeploymentRequest) (*UpdateDeploymentResponse, error)
// Returns list of the Deployments
ListDeployment(context.Context, *ListDeploymentRequest) (*ListDeploymentResponse, error)
// Deletes Deployment. If job does not exists, Exists flag is set to false
DeleteDeployment(context.Context, *DeleteDeploymentRequest) (*DeleteDeploymentResponse, error)
mustEmbedUnimplementedSchedulerV1Server()
}
@ -187,6 +252,21 @@ func (UnimplementedSchedulerV1Server) ListCronJob(context.Context, *ListCronJobR
func (UnimplementedSchedulerV1Server) DeleteCronJob(context.Context, *DeleteCronJobRequest) (*DeleteCronJobResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteCronJob not implemented")
}
func (UnimplementedSchedulerV1Server) CreateDeployment(context.Context, *CreateDeploymentRequest) (*CreateDeploymentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateDeployment not implemented")
}
func (UnimplementedSchedulerV1Server) GetDeployment(context.Context, *GetDeploymentRequest) (*GetDeploymentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDeployment not implemented")
}
func (UnimplementedSchedulerV1Server) UpdateDeployment(context.Context, *UpdateDeploymentRequest) (*UpdateDeploymentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateDeployment not implemented")
}
func (UnimplementedSchedulerV1Server) ListDeployment(context.Context, *ListDeploymentRequest) (*ListDeploymentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListDeployment not implemented")
}
func (UnimplementedSchedulerV1Server) DeleteDeployment(context.Context, *DeleteDeploymentRequest) (*DeleteDeploymentResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteDeployment not implemented")
}
func (UnimplementedSchedulerV1Server) mustEmbedUnimplementedSchedulerV1Server() {}
// UnsafeSchedulerV1Server may be embedded to opt out of forward compatibility for this service.
@ -362,6 +442,96 @@ func _SchedulerV1_DeleteCronJob_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler)
}
func _SchedulerV1_CreateDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateDeploymentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SchedulerV1Server).CreateDeployment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/scheduler.SchedulerV1/CreateDeployment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SchedulerV1Server).CreateDeployment(ctx, req.(*CreateDeploymentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SchedulerV1_GetDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetDeploymentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SchedulerV1Server).GetDeployment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/scheduler.SchedulerV1/GetDeployment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SchedulerV1Server).GetDeployment(ctx, req.(*GetDeploymentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SchedulerV1_UpdateDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(UpdateDeploymentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SchedulerV1Server).UpdateDeployment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/scheduler.SchedulerV1/UpdateDeployment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SchedulerV1Server).UpdateDeployment(ctx, req.(*UpdateDeploymentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SchedulerV1_ListDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListDeploymentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SchedulerV1Server).ListDeployment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/scheduler.SchedulerV1/ListDeployment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SchedulerV1Server).ListDeployment(ctx, req.(*ListDeploymentRequest))
}
return interceptor(ctx, in, info, handler)
}
func _SchedulerV1_DeleteDeployment_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteDeploymentRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(SchedulerV1Server).DeleteDeployment(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/scheduler.SchedulerV1/DeleteDeployment",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SchedulerV1Server).DeleteDeployment(ctx, req.(*DeleteDeploymentRequest))
}
return interceptor(ctx, in, info, handler)
}
// SchedulerV1_ServiceDesc is the grpc.ServiceDesc for SchedulerV1 service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@ -405,6 +575,26 @@ var SchedulerV1_ServiceDesc = grpc.ServiceDesc{
MethodName: "DeleteCronJob",
Handler: _SchedulerV1_DeleteCronJob_Handler,
},
{
MethodName: "CreateDeployment",
Handler: _SchedulerV1_CreateDeployment_Handler,
},
{
MethodName: "GetDeployment",
Handler: _SchedulerV1_GetDeployment_Handler,
},
{
MethodName: "UpdateDeployment",
Handler: _SchedulerV1_UpdateDeployment_Handler,
},
{
MethodName: "ListDeployment",
Handler: _SchedulerV1_ListDeployment_Handler,
},
{
MethodName: "DeleteDeployment",
Handler: _SchedulerV1_DeleteDeployment_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "integrations/scheduler/v1/definition/definition.proto",

View file

@ -0,0 +1,388 @@
//
// 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 protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.26.0
// protoc v3.21.1
// source: integrations/scheduler/v1/definition/deployment.proto
package definition
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Keeps information about Kubernetes Batch/V1 Job
type Deployment struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// defines object status metadate
Metadata *StatusMetadata `protobuf:"bytes,1,opt,name=metadata,proto3" json:"metadata,omitempty"`
// Keeps Deployment settings
Spec *DeploymentSpec `protobuf:"bytes,2,opt,name=spec,proto3" json:"spec,omitempty"`
// Keeps current Deployment Status
Status *DeploymentStatus `protobuf:"bytes,3,opt,name=status,proto3,oneof" json:"status,omitempty"`
}
func (x *Deployment) Reset() {
*x = Deployment{}
if protoimpl.UnsafeEnabled {
mi := &file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Deployment) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Deployment) ProtoMessage() {}
func (x *Deployment) ProtoReflect() protoreflect.Message {
mi := &file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Deployment.ProtoReflect.Descriptor instead.
func (*Deployment) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_deployment_proto_rawDescGZIP(), []int{0}
}
func (x *Deployment) GetMetadata() *StatusMetadata {
if x != nil {
return x.Metadata
}
return nil
}
func (x *Deployment) GetSpec() *DeploymentSpec {
if x != nil {
return x.Spec
}
return nil
}
func (x *Deployment) GetStatus() *DeploymentStatus {
if x != nil {
return x.Status
}
return nil
}
// Information about Deployment run settings
type DeploymentSpec struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Number of Pods which are started within a deployment. Defaults to 1
Replicas *int32 `protobuf:"varint,1,opt,name=replicas,proto3,oneof" json:"replicas,omitempty"`
}
func (x *DeploymentSpec) Reset() {
*x = DeploymentSpec{}
if protoimpl.UnsafeEnabled {
mi := &file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeploymentSpec) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeploymentSpec) ProtoMessage() {}
func (x *DeploymentSpec) ProtoReflect() protoreflect.Message {
mi := &file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeploymentSpec.ProtoReflect.Descriptor instead.
func (*DeploymentSpec) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_deployment_proto_rawDescGZIP(), []int{1}
}
func (x *DeploymentSpec) GetReplicas() int32 {
if x != nil && x.Replicas != nil {
return *x.Replicas
}
return 0
}
// Information about Deployment Status
type DeploymentStatus struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
Replicas int32 `protobuf:"varint,1,opt,name=replicas,proto3" json:"replicas,omitempty"`
// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
UpdatedReplicas int32 `protobuf:"varint,2,opt,name=updated_replicas,json=updatedReplicas,proto3" json:"updated_replicas,omitempty"`
// readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.
ReadyReplicas int32 `protobuf:"varint,3,opt,name=ready_replicas,json=readyReplicas,proto3" json:"ready_replicas,omitempty"`
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
AvailableReplicas int32 `protobuf:"varint,4,opt,name=available_replicas,json=availableReplicas,proto3" json:"available_replicas,omitempty"`
// Total number of unavailable pods targeted by this deployment. This is the total number of
// pods that are still required for the deployment to have 100% available capacity. They may
// either be pods that are running but not yet available or pods that still have not been created.
UnavailableReplicas int32 `protobuf:"varint,5,opt,name=unavailable_replicas,json=unavailableReplicas,proto3" json:"unavailable_replicas,omitempty"`
}
func (x *DeploymentStatus) Reset() {
*x = DeploymentStatus{}
if protoimpl.UnsafeEnabled {
mi := &file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DeploymentStatus) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DeploymentStatus) ProtoMessage() {}
func (x *DeploymentStatus) ProtoReflect() protoreflect.Message {
mi := &file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DeploymentStatus.ProtoReflect.Descriptor instead.
func (*DeploymentStatus) Descriptor() ([]byte, []int) {
return file_integrations_scheduler_v1_definition_deployment_proto_rawDescGZIP(), []int{2}
}
func (x *DeploymentStatus) GetReplicas() int32 {
if x != nil {
return x.Replicas
}
return 0
}
func (x *DeploymentStatus) GetUpdatedReplicas() int32 {
if x != nil {
return x.UpdatedReplicas
}
return 0
}
func (x *DeploymentStatus) GetReadyReplicas() int32 {
if x != nil {
return x.ReadyReplicas
}
return 0
}
func (x *DeploymentStatus) GetAvailableReplicas() int32 {
if x != nil {
return x.AvailableReplicas
}
return 0
}
func (x *DeploymentStatus) GetUnavailableReplicas() int32 {
if x != nil {
return x.UnavailableReplicas
}
return 0
}
var File_integrations_scheduler_v1_definition_deployment_proto protoreflect.FileDescriptor
var file_integrations_scheduler_v1_definition_deployment_proto_rawDesc = []byte{
0x0a, 0x35, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73,
0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69,
0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e,
0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,
0x65, 0x72, 0x1a, 0x31, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65,
0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb7, 0x01, 0x0a, 0x0a, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79,
0x6d, 0x65, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c,
0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2d, 0x0a, 0x04, 0x73,
0x70, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, 0x63, 0x68, 0x65,
0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74,
0x53, 0x70, 0x65, 0x63, 0x52, 0x04, 0x73, 0x70, 0x65, 0x63, 0x12, 0x38, 0x0a, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x63, 0x68,
0x65, 0x64, 0x75, 0x6c, 0x65, 0x72, 0x2e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e,
0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
0x73, 0x88, 0x01, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
0x3e, 0x0a, 0x0e, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x70, 0x65,
0x63, 0x12, 0x1f, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x88,
0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x22,
0xe2, 0x01, 0x0a, 0x10, 0x44, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x6d, 0x65, 0x6e, 0x74, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73,
0x12, 0x29, 0x0a, 0x10, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x70, 0x6c,
0x69, 0x63, 0x61, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61,
0x74, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x72,
0x65, 0x61, 0x64, 0x79, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x03, 0x20,
0x01, 0x28, 0x05, 0x52, 0x0d, 0x72, 0x65, 0x61, 0x64, 0x79, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63,
0x61, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f,
0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11,
0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61,
0x73, 0x12, 0x31, 0x0a, 0x14, 0x75, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65,
0x5f, 0x72, 0x65, 0x70, 0x6c, 0x69, 0x63, 0x61, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
0x13, 0x75, 0x6e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6c,
0x69, 0x63, 0x61, 0x73, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x6b, 0x75, 0x62, 0x65,
0x2d, 0x61, 0x72, 0x61, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x67, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x72,
0x2f, 0x76, 0x31, 0x2f, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_integrations_scheduler_v1_definition_deployment_proto_rawDescOnce sync.Once
file_integrations_scheduler_v1_definition_deployment_proto_rawDescData = file_integrations_scheduler_v1_definition_deployment_proto_rawDesc
)
func file_integrations_scheduler_v1_definition_deployment_proto_rawDescGZIP() []byte {
file_integrations_scheduler_v1_definition_deployment_proto_rawDescOnce.Do(func() {
file_integrations_scheduler_v1_definition_deployment_proto_rawDescData = protoimpl.X.CompressGZIP(file_integrations_scheduler_v1_definition_deployment_proto_rawDescData)
})
return file_integrations_scheduler_v1_definition_deployment_proto_rawDescData
}
var file_integrations_scheduler_v1_definition_deployment_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_integrations_scheduler_v1_definition_deployment_proto_goTypes = []interface{}{
(*Deployment)(nil), // 0: scheduler.Deployment
(*DeploymentSpec)(nil), // 1: scheduler.DeploymentSpec
(*DeploymentStatus)(nil), // 2: scheduler.DeploymentStatus
(*StatusMetadata)(nil), // 3: scheduler.StatusMetadata
}
var file_integrations_scheduler_v1_definition_deployment_proto_depIdxs = []int32{
3, // 0: scheduler.Deployment.metadata:type_name -> scheduler.StatusMetadata
1, // 1: scheduler.Deployment.spec:type_name -> scheduler.DeploymentSpec
2, // 2: scheduler.Deployment.status:type_name -> scheduler.DeploymentStatus
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_integrations_scheduler_v1_definition_deployment_proto_init() }
func file_integrations_scheduler_v1_definition_deployment_proto_init() {
if File_integrations_scheduler_v1_definition_deployment_proto != nil {
return
}
file_integrations_scheduler_v1_definition_common_proto_init()
if !protoimpl.UnsafeEnabled {
file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Deployment); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeploymentSpec); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeploymentStatus); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[0].OneofWrappers = []interface{}{}
file_integrations_scheduler_v1_definition_deployment_proto_msgTypes[1].OneofWrappers = []interface{}{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_integrations_scheduler_v1_definition_deployment_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_integrations_scheduler_v1_definition_deployment_proto_goTypes,
DependencyIndexes: file_integrations_scheduler_v1_definition_deployment_proto_depIdxs,
MessageInfos: file_integrations_scheduler_v1_definition_deployment_proto_msgTypes,
}.Build()
File_integrations_scheduler_v1_definition_deployment_proto = out.File
file_integrations_scheduler_v1_definition_deployment_proto_rawDesc = nil
file_integrations_scheduler_v1_definition_deployment_proto_goTypes = nil
file_integrations_scheduler_v1_definition_deployment_proto_depIdxs = nil
}

View file

@ -0,0 +1,66 @@
//
// 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
//
syntax = "proto3";
package scheduler;
import "integrations/scheduler/v1/definition/common.proto";
option go_package = "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition";
// Keeps information about Kubernetes Batch/V1 Job
message Deployment {
// defines object status metadate
StatusMetadata metadata = 1;
// Keeps Deployment settings
DeploymentSpec spec = 2;
// Keeps current Deployment Status
optional DeploymentStatus status = 3;
}
// Information about Deployment run settings
message DeploymentSpec {
// Number of Pods which are started within a deployment. Defaults to 1
optional int32 replicas = 1;
}
// Information about Deployment Status
message DeploymentStatus {
// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
int32 replicas=1;
// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
int32 updated_replicas = 2;
// readyReplicas is the number of pods targeted by this Deployment with a Ready Condition.
int32 ready_replicas = 3;
// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
int32 available_replicas = 4;
// Total number of unavailable pods targeted by this deployment. This is the total number of
// pods that are still required for the deployment to have 100% available capacity. They may
// either be pods that are running but not yet available or pods that still have not been created.
int32 unavailable_replicas = 5;
}

View file

@ -0,0 +1,210 @@
//
// 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 v1
import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"github.com/arangodb/kube-arangodb/pkg/debug_package/generators/kubernetes"
"github.com/arangodb/kube-arangodb/pkg/scheduler"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
)
func (i *implementation) CreateDeployment(ctx context.Context, request *pbSchedulerV1.CreateDeploymentRequest) (*pbSchedulerV1.CreateDeploymentResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
template := scheduler.SpecAsTemplate(request.GetSpec())
var spec schedulerApi.ArangoSchedulerDeployment
spec.Namespace = i.cfg.Namespace
if meta := request.GetSpec().GetMetadata(); meta != nil {
if util.TypeOrDefault(meta.GenerateName, false) {
spec.GenerateName = meta.Name
} else {
spec.Name = meta.Name
}
}
spec.Spec.Template = *template
if deployment := request.GetDeployment(); deployment != nil {
spec.Spec.Replicas = deployment.Replicas
}
if jobSpec := request.GetSpec(); jobSpec != nil {
if base := jobSpec.Base; base != nil {
spec.Labels = base.Labels
spec.Spec.Template.Labels = base.Labels
}
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(i.cfg.Namespace).Create(ctx, &spec, meta.CreateOptions{})
if err != nil {
return nil, err
}
return &pbSchedulerV1.CreateDeploymentResponse{
Name: job.Name,
}, nil
}
func (i *implementation) GetDeployment(ctx context.Context, request *pbSchedulerV1.GetDeploymentRequest) (*pbSchedulerV1.GetDeploymentResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
deployment, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.GetDeploymentResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.GetDeploymentResponse{
Exists: true,
Deployment: &pbSchedulerV1.Deployment{
Metadata: ExtractStatusMetadata(deployment.Status.ArangoSchedulerStatusMetadata),
Spec: &pbSchedulerV1.DeploymentSpec{
Replicas: deployment.Spec.Replicas,
},
Status: &pbSchedulerV1.DeploymentStatus{
Replicas: deployment.Status.DeploymentStatus.Replicas,
UpdatedReplicas: deployment.Status.DeploymentStatus.UpdatedReplicas,
ReadyReplicas: deployment.Status.DeploymentStatus.ReadyReplicas,
AvailableReplicas: deployment.Status.DeploymentStatus.AvailableReplicas,
UnavailableReplicas: deployment.Status.DeploymentStatus.UnavailableReplicas,
},
},
}, nil
}
func (i *implementation) UpdateDeployment(ctx context.Context, request *pbSchedulerV1.UpdateDeploymentRequest) (*pbSchedulerV1.UpdateDeploymentResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.UpdateDeploymentResponse{
Exists: false,
}, nil
}
return nil, err
}
if deployment := request.GetSpec(); deployment != nil {
job.Spec.Replicas = deployment.Replicas
}
job, err = i.client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(i.cfg.Namespace).Update(ctx, job, meta.UpdateOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.UpdateDeploymentResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.UpdateDeploymentResponse{
Exists: true,
Deployment: &pbSchedulerV1.Deployment{
Spec: &pbSchedulerV1.DeploymentSpec{
Replicas: job.Spec.Replicas,
},
},
}, nil
}
func (i *implementation) ListDeployment(ctx context.Context, request *pbSchedulerV1.ListDeploymentRequest) (*pbSchedulerV1.ListDeploymentResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
objects, err := kubernetes.ListObjects[*schedulerApi.ArangoSchedulerDeploymentList, *schedulerApi.ArangoSchedulerDeployment](ctx, i.client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(i.cfg.Namespace), func(result *schedulerApi.ArangoSchedulerDeploymentList) []*schedulerApi.ArangoSchedulerDeployment {
r := make([]*schedulerApi.ArangoSchedulerDeployment, len(result.Items))
for id := range result.Items {
r[id] = result.Items[id].DeepCopy()
}
return r
})
if err != nil {
return nil, err
}
return &pbSchedulerV1.ListDeploymentResponse{
Deployments: util.FormatList(objects, func(in *schedulerApi.ArangoSchedulerDeployment) string {
return in.GetName()
}),
}, nil
}
func (i *implementation) DeleteDeployment(ctx context.Context, request *pbSchedulerV1.DeleteDeploymentRequest) (*pbSchedulerV1.DeleteDeploymentResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
var d meta.DeleteOptions
if v := request.DeleteChildPods; v != nil {
if *v {
d.PropagationPolicy = util.NewType(meta.DeletePropagationBackground)
} else {
d.PropagationPolicy = util.NewType(meta.DeletePropagationOrphan)
}
}
err := i.client.Arango().SchedulerV1beta1().ArangoSchedulerDeployments(i.cfg.Namespace).Delete(ctx, request.GetName(), d)
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.DeleteDeploymentResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.DeleteDeploymentResponse{Exists: true}, nil
}

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
//
package v1
import (
"context"
"testing"
"github.com/stretchr/testify/require"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
"github.com/arangodb/kube-arangodb/pkg/util/tests"
)
func Test_Deployment(t *testing.T) {
ctx, c := context.WithCancel(context.Background())
defer c()
client := kclient.NewFakeClientBuilder().Add(
tests.NewMetaObject(t, tests.FakeNamespace, "test", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{}
}, tests.MarkArangoProfileAsReady),
tests.NewMetaObject(t, tests.FakeNamespace, "test-select-all", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{
Selectors: &schedulerApi.ProfileSelectors{
Label: &meta.LabelSelector{},
},
Template: &schedulerApi.ProfileTemplate{},
}
}, tests.MarkArangoProfileAsReady),
tests.NewMetaObject(t, tests.FakeNamespace, "test-select-specific", func(t *testing.T, obj *schedulerApi.ArangoProfile) {
obj.Spec = schedulerApi.ProfileSpec{
Selectors: &schedulerApi.ProfileSelectors{
Label: &meta.LabelSelector{
MatchLabels: map[string]string{
"A": "B",
},
},
},
Template: &schedulerApi.ProfileTemplate{},
}
}, tests.MarkArangoProfileAsReady),
).Client()
scheduler := Client(t, ctx, client, func(c Configuration) Configuration {
c.Namespace = tests.FakeNamespace
c.VerifyAccess = false
return c
})
t.Run("Ensure job does not exist - get", func(t *testing.T) {
resp, err := scheduler.GetDeployment(context.Background(), &pbSchedulerV1.GetDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.False(t, resp.GetExists())
})
t.Run("Ensure job does not exist - list", func(t *testing.T) {
resp, err := scheduler.ListDeployment(context.Background(), &pbSchedulerV1.ListDeploymentRequest{})
require.NoError(t, err)
require.Len(t, resp.GetDeployments(), 0)
})
t.Run("Schedule Job", func(t *testing.T) {
resp, err := scheduler.CreateDeployment(context.Background(), &pbSchedulerV1.CreateDeploymentRequest{
Spec: &pbSchedulerV1.Spec{
Metadata: &pbSchedulerV1.Metadata{
Name: "test",
},
Base: &pbSchedulerV1.ObjectBase{
Labels: nil,
Profiles: []string{
"test",
},
},
Containers: map[string]*pbSchedulerV1.ContainerBase{
"example": {
Image: util.NewType("ubuntu:20.04"),
Args: []string{
"/bin/bash",
"-c",
"true",
},
},
},
},
Deployment: &pbSchedulerV1.DeploymentSpec{
Replicas: util.NewType[int32](5),
},
})
require.NoError(t, err)
require.EqualValues(t, "test", resp.GetName())
})
t.Run("Ensure job exist - get", func(t *testing.T) {
resp, err := scheduler.GetDeployment(context.Background(), &pbSchedulerV1.GetDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.True(t, resp.GetExists())
})
t.Run("Ensure job exist - list", func(t *testing.T) {
resp, err := scheduler.ListDeployment(context.Background(), &pbSchedulerV1.ListDeploymentRequest{})
require.NoError(t, err)
require.Len(t, resp.GetDeployments(), 1)
require.Contains(t, resp.GetDeployments(), "test")
})
t.Run("Ensure job details - pre", func(t *testing.T) {
resp, err := scheduler.GetDeployment(context.Background(), &pbSchedulerV1.GetDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.True(t, resp.GetExists())
require.EqualValues(t, 0, resp.GetDeployment().GetStatus().GetReplicas())
})
t.Run("Ensure job details - update", func(t *testing.T) {
job := tests.NewMetaObject[*schedulerApi.ArangoSchedulerDeployment](t, tests.FakeNamespace, "test")
tests.RefreshObjectsC(t, client, &job)
job.Status.Replicas = 1
tests.UpdateObjectsC(t, client, &job)
})
t.Run("Ensure job details - post", func(t *testing.T) {
resp, err := scheduler.GetDeployment(context.Background(), &pbSchedulerV1.GetDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.True(t, resp.GetExists())
require.EqualValues(t, 1, resp.GetDeployment().GetStatus().GetReplicas())
})
t.Run("Delete Job", func(t *testing.T) {
resp, err := scheduler.DeleteDeployment(context.Background(), &pbSchedulerV1.DeleteDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.True(t, resp.GetExists())
})
t.Run("Re-Delete Job", func(t *testing.T) {
resp, err := scheduler.DeleteDeployment(context.Background(), &pbSchedulerV1.DeleteDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.False(t, resp.GetExists())
})
t.Run("Ensure job does not exist after deletion - get", func(t *testing.T) {
resp, err := scheduler.GetDeployment(context.Background(), &pbSchedulerV1.GetDeploymentRequest{
Name: "test",
})
require.NoError(t, err)
require.False(t, resp.GetExists())
})
t.Run("Ensure job does not exist after deletion - list", func(t *testing.T) {
resp, err := scheduler.ListDeployment(context.Background(), &pbSchedulerV1.ListDeploymentRequest{})
require.NoError(t, err)
require.Len(t, resp.GetDeployments(), 0)
})
}

View file

@ -0,0 +1,43 @@
//
// 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 v1
import (
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"github.com/arangodb/kube-arangodb/pkg/util"
)
func ExtractStatusMetadata(mt schedulerApi.ArangoSchedulerStatusMetadata) *pbSchedulerV1.StatusMetadata {
var r pbSchedulerV1.StatusMetadata
r.Profiles = mt.Profiles
if obj := mt.Object; obj == nil {
r.Created = false
} else {
r.Created = true
r.Checksum = util.NewType(obj.GetChecksum())
r.Uid = util.NewType(obj.GetChecksum())
}
return &r
}

View file

@ -24,16 +24,9 @@ import (
"context"
"google.golang.org/grpc"
batch "k8s.io/api/batch/v1"
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
pbSchedulerV1 "github.com/arangodb/kube-arangodb/integrations/scheduler/v1/definition"
"github.com/arangodb/kube-arangodb/pkg/debug_package/generators/kubernetes"
"github.com/arangodb/kube-arangodb/pkg/scheduler"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
kresources "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/resources"
"github.com/arangodb/kube-arangodb/pkg/util/kclient"
"github.com/arangodb/kube-arangodb/pkg/util/svc"
@ -52,58 +45,114 @@ func newInternal(ctx context.Context, client kclient.Client, cfg Configuration)
if err := kresources.VerifyAll(ctx, client.Kubernetes(),
kresources.AccessRequest{
Verb: "create",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "jobs",
Resource: "arangoschedulerbatchjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "list",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "jobs",
Resource: "arangoschedulerbatchjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "delete",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "jobs",
Resource: "arangoschedulerbatchjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "get",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "jobs",
Resource: "arangoschedulerbatchjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "create",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "cronjobs",
Resource: "arangoschedulercronjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "list",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "cronjobs",
Resource: "arangoschedulercronjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "delete",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "cronjobs",
Resource: "arangoschedulercronjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "get",
Group: "batch",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "cronjobs",
Resource: "arangoschedulercronjobs",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "create",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerpods",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "list",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerpods",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "delete",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerpods",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "get",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerpods",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "create",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerdeployments",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "list",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerdeployments",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "delete",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerdeployments",
Namespace: cfg.Namespace,
},
kresources.AccessRequest{
Verb: "get",
Group: "scheduler.arangodb.com",
Version: "v1",
Resource: "arangoschedulerdeployments",
Namespace: cfg.Namespace,
},
); err != nil {
@ -114,7 +163,6 @@ func newInternal(ctx context.Context, client kclient.Client, cfg Configuration)
return &implementation{
cfg: cfg,
client: client,
scheduler: scheduler.NewScheduler(client, cfg.Namespace),
}, nil
}
@ -122,7 +170,6 @@ type implementation struct {
cfg Configuration
client kclient.Client
scheduler scheduler.Scheduler
pbSchedulerV1.UnimplementedSchedulerV1Server
}
@ -138,367 +185,3 @@ func (i *implementation) Register(registrar *grpc.Server) {
func (i *implementation) Health() svc.HealthState {
return svc.Healthy
}
func (i *implementation) CreateBatchJob(ctx context.Context, request *pbSchedulerV1.CreateBatchJobRequest) (*pbSchedulerV1.CreateBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
rendered, profiles, err := i.scheduler.Render(ctx, request.GetSpec())
if err != nil {
return nil, err
}
rendered.Spec.RestartPolicy = core.RestartPolicyNever
var spec batch.Job
spec.Namespace = i.cfg.Namespace
if meta := request.GetSpec().GetMetadata(); meta != nil {
if util.TypeOrDefault(meta.GenerateName, false) {
spec.GenerateName = meta.Name
} else {
spec.Name = meta.Name
}
}
spec.Spec.Template = *rendered
if batchJob := request.GetBatchJob(); batchJob != nil {
if v := batchJob.Completions; v != nil {
spec.Spec.Completions = v
}
if v := batchJob.Parallelism; v != nil {
spec.Spec.Parallelism = v
}
if v := batchJob.BackoffLimit; v != nil {
spec.Spec.BackoffLimit = v
}
}
if batchJobSpec := request.GetSpec(); batchJobSpec != nil {
if job := batchJobSpec.Job; job != nil {
spec.Labels = job.Labels
}
}
job, err := i.client.Kubernetes().BatchV1().Jobs(i.cfg.Namespace).Create(ctx, &spec, meta.CreateOptions{})
if err != nil {
return nil, err
}
return &pbSchedulerV1.CreateBatchJobResponse{
Name: job.Name,
Profiles: profiles,
}, nil
}
func (i *implementation) GetBatchJob(ctx context.Context, request *pbSchedulerV1.GetBatchJobRequest) (*pbSchedulerV1.GetBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Kubernetes().BatchV1().Jobs(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.GetBatchJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.GetBatchJobResponse{
Exists: true,
BatchJob: &pbSchedulerV1.BatchJob{
Spec: &pbSchedulerV1.BatchJobSpec{
Parallelism: job.Spec.Parallelism,
Completions: job.Spec.Completions,
BackoffLimit: job.Spec.BackoffLimit,
},
Status: &pbSchedulerV1.BatchJobStatus{
Active: job.Status.Active,
Succeeded: job.Status.Succeeded,
Failed: job.Status.Failed,
},
},
}, nil
}
func (i *implementation) DeleteBatchJob(ctx context.Context, request *pbSchedulerV1.DeleteBatchJobRequest) (*pbSchedulerV1.DeleteBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
var d meta.DeleteOptions
if v := request.DeleteChildPods; v != nil {
if *v {
d.PropagationPolicy = util.NewType(meta.DeletePropagationBackground)
} else {
d.PropagationPolicy = util.NewType(meta.DeletePropagationOrphan)
}
}
err := i.client.Kubernetes().BatchV1().Jobs(i.cfg.Namespace).Delete(ctx, request.GetName(), d)
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.DeleteBatchJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.DeleteBatchJobResponse{Exists: true}, nil
}
func (i *implementation) ListBatchJob(ctx context.Context, request *pbSchedulerV1.ListBatchJobRequest) (*pbSchedulerV1.ListBatchJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
objects, err := kubernetes.ListObjects[*batch.JobList, *batch.Job](ctx, i.client.Kubernetes().BatchV1().Jobs(i.cfg.Namespace), func(result *batch.JobList) []*batch.Job {
r := make([]*batch.Job, len(result.Items))
for id := range result.Items {
r[id] = result.Items[id].DeepCopy()
}
return r
})
if err != nil {
return nil, err
}
return &pbSchedulerV1.ListBatchJobResponse{
BatchJobs: kubernetes.Extract(objects, func(in *batch.Job) string {
return in.GetName()
}),
}, nil
}
func (i *implementation) CreateCronJob(ctx context.Context, request *pbSchedulerV1.CreateCronJobRequest) (*pbSchedulerV1.CreateCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
rendered, profiles, err := i.scheduler.Render(ctx, request.GetSpec())
if err != nil {
return nil, err
}
rendered.Spec.RestartPolicy = core.RestartPolicyNever
var spec batch.CronJob
spec.Namespace = i.cfg.Namespace
if meta := request.GetSpec().GetMetadata(); meta != nil {
if util.TypeOrDefault(meta.GenerateName, false) {
spec.GenerateName = meta.Name
} else {
spec.Name = meta.Name
}
}
spec.Spec.JobTemplate.Spec.Template = *rendered
if cronJob := request.GetCronJob(); cronJob != nil {
spec.Spec.Schedule = cronJob.Schedule
if batchJob := cronJob.GetJob(); batchJob != nil {
if v := batchJob.Completions; v != nil {
spec.Spec.JobTemplate.Spec.Completions = v
}
if v := batchJob.Parallelism; v != nil {
spec.Spec.JobTemplate.Spec.Parallelism = v
}
if v := batchJob.BackoffLimit; v != nil {
spec.Spec.JobTemplate.Spec.BackoffLimit = v
}
}
}
if batchJobSpec := request.GetSpec(); batchJobSpec != nil {
if job := batchJobSpec.Job; job != nil {
spec.Labels = job.Labels
spec.Spec.JobTemplate.Labels = job.Labels
}
}
job, err := i.client.Kubernetes().BatchV1().CronJobs(i.cfg.Namespace).Create(ctx, &spec, meta.CreateOptions{})
if err != nil {
return nil, err
}
return &pbSchedulerV1.CreateCronJobResponse{
Name: job.Name,
Profiles: profiles,
}, nil
}
func (i *implementation) GetCronJob(ctx context.Context, request *pbSchedulerV1.GetCronJobRequest) (*pbSchedulerV1.GetCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Kubernetes().BatchV1().CronJobs(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.GetCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.GetCronJobResponse{
Exists: true,
CronJob: &pbSchedulerV1.CronJob{
Spec: &pbSchedulerV1.CronJobSpec{
Schedule: job.Spec.Schedule,
Job: &pbSchedulerV1.BatchJobSpec{
Parallelism: job.Spec.JobTemplate.Spec.Parallelism,
Completions: job.Spec.JobTemplate.Spec.Completions,
BackoffLimit: job.Spec.JobTemplate.Spec.BackoffLimit,
},
},
},
BatchJobs: kubernetes.Extract(job.Status.Active, func(in core.ObjectReference) string {
return in.Name
}),
}, nil
}
func (i *implementation) UpdateCronJob(ctx context.Context, request *pbSchedulerV1.UpdateCronJobRequest) (*pbSchedulerV1.UpdateCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
job, err := i.client.Kubernetes().BatchV1().CronJobs(i.cfg.Namespace).Get(ctx, request.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.UpdateCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
if cronJob := request.GetSpec(); cronJob != nil {
job.Spec.Schedule = cronJob.Schedule
if batchJob := cronJob.GetJob(); batchJob != nil {
if v := batchJob.Completions; v != nil {
job.Spec.JobTemplate.Spec.Completions = v
}
if v := batchJob.Parallelism; v != nil {
job.Spec.JobTemplate.Spec.Parallelism = v
}
if v := batchJob.BackoffLimit; v != nil {
job.Spec.JobTemplate.Spec.BackoffLimit = v
}
}
}
job, err = i.client.Kubernetes().BatchV1().CronJobs(i.cfg.Namespace).Update(ctx, job, meta.UpdateOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.UpdateCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.UpdateCronJobResponse{
Exists: true,
CronJob: &pbSchedulerV1.CronJob{
Spec: &pbSchedulerV1.CronJobSpec{
Schedule: job.Spec.Schedule,
Job: &pbSchedulerV1.BatchJobSpec{
Parallelism: job.Spec.JobTemplate.Spec.Parallelism,
Completions: job.Spec.JobTemplate.Spec.Completions,
BackoffLimit: job.Spec.JobTemplate.Spec.BackoffLimit,
},
},
},
}, nil
}
func (i *implementation) ListCronJob(ctx context.Context, request *pbSchedulerV1.ListCronJobRequest) (*pbSchedulerV1.ListCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
objects, err := kubernetes.ListObjects[*batch.CronJobList, *batch.CronJob](ctx, i.client.Kubernetes().BatchV1().CronJobs(i.cfg.Namespace), func(result *batch.CronJobList) []*batch.CronJob {
r := make([]*batch.CronJob, len(result.Items))
for id := range result.Items {
r[id] = result.Items[id].DeepCopy()
}
return r
})
if err != nil {
return nil, err
}
return &pbSchedulerV1.ListCronJobResponse{
CronJobs: kubernetes.Extract(objects, func(in *batch.CronJob) string {
return in.GetName()
}),
}, nil
}
func (i *implementation) DeleteCronJob(ctx context.Context, request *pbSchedulerV1.DeleteCronJobRequest) (*pbSchedulerV1.DeleteCronJobResponse, error) {
if request == nil {
return nil, errors.Errorf("Request is nil")
}
var d meta.DeleteOptions
if v := request.DeleteChildPods; v != nil {
if *v {
d.PropagationPolicy = util.NewType(meta.DeletePropagationBackground)
} else {
d.PropagationPolicy = util.NewType(meta.DeletePropagationOrphan)
}
}
err := i.client.Kubernetes().BatchV1().CronJobs(i.cfg.Namespace).Delete(ctx, request.GetName(), d)
if err != nil {
if kerrors.IsNotFound(err) {
return &pbSchedulerV1.DeleteCronJobResponse{
Exists: false,
}, nil
}
return nil, err
}
return &pbSchedulerV1.DeleteCronJobResponse{Exists: true}, nil
}

View file

@ -229,6 +229,42 @@ func Test_GenerateCRValidationSchemas(t *testing.T) {
},
},
},
"scheduler-pod": {
fmt.Sprintf("%s/pkg/apis/scheduler/v1alpha1", root): {
"v1beta1": {
objects: map[string]interface{}{
"spec": schedulerApi.ArangoSchedulerPod{}.Spec,
},
},
},
},
"scheduler-deployment": {
fmt.Sprintf("%s/pkg/apis/scheduler/v1alpha1", root): {
"v1beta1": {
objects: map[string]interface{}{
"spec": schedulerApi.ArangoSchedulerDeployment{}.Spec,
},
},
},
},
"scheduler-batchjob": {
fmt.Sprintf("%s/pkg/apis/scheduler/v1alpha1", root): {
"v1beta1": {
objects: map[string]interface{}{
"spec": schedulerApi.ArangoSchedulerBatchJob{}.Spec,
},
},
},
},
"scheduler-cronjob": {
fmt.Sprintf("%s/pkg/apis/scheduler/v1alpha1", root): {
"v1beta1": {
objects: map[string]interface{}{
"spec": schedulerApi.ArangoSchedulerCronJob{}.Spec,
},
},
},
},
"ml-extension": {
fmt.Sprintf("%s/pkg/apis/ml/v1alpha1", root): {
"v1alpha1": {

View file

@ -25,5 +25,21 @@ const (
ArangoProfileResourceKind = "ArangoProfile"
ArangoProfileResourcePlural = "arangoprofiles"
PodCRDName = PodResourcePlural + "." + ArangoSchedulerGroupName
PodResourceKind = "ArangoSchedulerPod"
PodResourcePlural = "arangoschedulerpods"
DeploymentCRDName = DeploymentResourcePlural + "." + ArangoSchedulerGroupName
DeploymentResourceKind = "ArangoSchedulerDeployment"
DeploymentResourcePlural = "arangoschedulerdeployments"
BatchJobCRDName = BatchJobResourcePlural + "." + ArangoSchedulerGroupName
BatchJobResourceKind = "ArangoSchedulerBatchJob"
BatchJobResourcePlural = "arangoschedulerbatchjobs"
CronJobCRDName = CronJobResourcePlural + "." + ArangoSchedulerGroupName
CronJobResourceKind = "ArangoSchedulerCronJob"
CronJobResourcePlural = "arangoschedulercronjobs"
ArangoSchedulerGroupName = "scheduler.arangodb.com"
)

View file

@ -20,7 +20,11 @@
package v1beta1
import meta "k8s.io/apimachinery/pkg/apis/meta/v1"
import (
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@ -44,6 +48,18 @@ type ArangoProfile struct {
Status ProfileStatus `json:"status"`
}
// AsOwner creates an OwnerReference for the given ArangoSchedulerBatchJob
func (a *ArangoProfile) AsOwner() meta.OwnerReference {
trueVar := true
return meta.OwnerReference{
APIVersion: SchemeGroupVersion.String(),
Kind: scheduler.ArangoProfileResourceKind,
Name: a.Name,
UID: a.UID,
Controller: &trueVar,
}
}
func (a *ArangoProfile) GetStatus() ProfileStatus {
return a.Status
}

View file

@ -55,19 +55,19 @@ func (p ProfileTemplates) Merge() *ProfileTemplate {
func (p ProfileTemplates) RenderOnTemplate(pod *core.PodTemplateSpec) error {
t := p.Merge()
// Apply Pod Spec
// Apply ArangoSchedulerPod Spec
if err := t.GetPod().Apply(pod); err != nil {
return errors.Wrapf(err, "Error while rendering Pod")
return errors.Wrapf(err, "Error while rendering ArangoSchedulerPod")
}
// Apply Generic Containers Spec
if err := t.GetContainer().ApplyGeneric(pod); err != nil {
return errors.Wrapf(err, "Error while rendering Pod")
return errors.Wrapf(err, "Error while rendering ArangoSchedulerPod")
}
// Apply Containers Spec
if err := t.GetContainer().ApplyContainers(pod); err != nil {
return errors.Wrapf(err, "Error while rendering Pod")
return errors.Wrapf(err, "Error while rendering ArangoSchedulerPod")
}
return nil

View file

@ -50,6 +50,14 @@ func addKnownTypes(s *runtime.Scheme) error {
s.AddKnownTypes(SchemeGroupVersion,
&ArangoProfile{},
&ArangoProfileList{},
&ArangoSchedulerPod{},
&ArangoSchedulerPodList{},
&ArangoSchedulerDeployment{},
&ArangoSchedulerDeploymentList{},
&ArangoSchedulerBatchJob{},
&ArangoSchedulerBatchJobList{},
&ArangoSchedulerCronJob{},
&ArangoSchedulerCronJobList{},
)
meta.AddToGroupVersion(s, SchemeGroupVersion)
return 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
//
package v1beta1
import sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
type ArangoSchedulerStatusMetadata struct {
// Object keeps the information about object
Object *sharedApi.Object `json:"object,omitempty"`
// Profiles keeps the information about applied profiles
Profiles []string `json:"profiles,omitempty"`
}

View file

@ -0,0 +1,83 @@
//
// 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 v1beta1
import (
batch "k8s.io/api/batch/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerBatchJobList is a list of BatchJobs.
type ArangoSchedulerBatchJobList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []ArangoSchedulerBatchJob `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerBatchJob wraps batch. ArangoSchedulerBatchJob with profile details
type ArangoSchedulerBatchJob struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec ArangoSchedulerBatchJobSpec `json:"spec"`
Status ArangoSchedulerBatchJobStatus `json:"status"`
}
type ArangoSchedulerBatchJobSpec struct {
// Profiles keeps list of the profiles
Profiles []string `json:"profiles,omitempty"`
batch.JobSpec `json:",inline"`
}
type ArangoSchedulerBatchJobStatus struct {
ArangoSchedulerStatusMetadata `json:",inline"`
batch.JobStatus `json:",inline"`
}
// AsOwner creates an OwnerReference for the given ArangoSchedulerBatchJob
func (d *ArangoSchedulerBatchJob) AsOwner() meta.OwnerReference {
trueVar := true
return meta.OwnerReference{
APIVersion: SchemeGroupVersion.String(),
Kind: scheduler.BatchJobResourceKind,
Name: d.Name,
UID: d.UID,
Controller: &trueVar,
}
}
func (d *ArangoSchedulerBatchJob) GetStatus() ArangoSchedulerBatchJobStatus {
return d.Status
}
func (d *ArangoSchedulerBatchJob) SetStatus(status ArangoSchedulerBatchJobStatus) {
d.Status = status
}

View file

@ -0,0 +1,83 @@
//
// 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 v1beta1
import (
batch "k8s.io/api/batch/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerCronJobList is a list of CronJobs.
type ArangoSchedulerCronJobList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []ArangoSchedulerCronJob `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerCronJob wraps batch. ArangoSchedulerCronJob with profile details
type ArangoSchedulerCronJob struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec ArangoSchedulerCronJobSpec `json:"spec"`
Status ArangoSchedulerCronJobStatus `json:"status"`
}
type ArangoSchedulerCronJobSpec struct {
// Profiles keeps list of the profiles
Profiles []string `json:"profiles,omitempty"`
batch.CronJobSpec `json:",inline"`
}
type ArangoSchedulerCronJobStatus struct {
ArangoSchedulerStatusMetadata `json:",inline"`
batch.CronJobStatus `json:",inline"`
}
// AsOwner creates an OwnerReference for the given ArangoSchedulerCronJob
func (d *ArangoSchedulerCronJob) AsOwner() meta.OwnerReference {
trueVar := true
return meta.OwnerReference{
APIVersion: SchemeGroupVersion.String(),
Kind: scheduler.CronJobResourceKind,
Name: d.Name,
UID: d.UID,
Controller: &trueVar,
}
}
func (d *ArangoSchedulerCronJob) GetStatus() ArangoSchedulerCronJobStatus {
return d.Status
}
func (d *ArangoSchedulerCronJob) SetStatus(status ArangoSchedulerCronJobStatus) {
d.Status = status
}

View file

@ -0,0 +1,83 @@
//
// 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 v1beta1
import (
apps "k8s.io/api/apps/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerDeploymentList is a list of Deployments.
type ArangoSchedulerDeploymentList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []ArangoSchedulerDeployment `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerDeployment wraps apps. ArangoSchedulerDeployment with profile details
type ArangoSchedulerDeployment struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec ArangoSchedulerDeploymentSpec `json:"spec"`
Status ArangoSchedulerDeploymentStatus `json:"status"`
}
type ArangoSchedulerDeploymentSpec struct {
// Profiles keeps list of the profiles
Profiles []string `json:"profiles,omitempty"`
apps.DeploymentSpec `json:",inline"`
}
type ArangoSchedulerDeploymentStatus struct {
ArangoSchedulerStatusMetadata `json:",inline"`
apps.DeploymentStatus `json:",inline"`
}
// AsOwner creates an OwnerReference for the given ArangoSchedulerDeployment
func (d *ArangoSchedulerDeployment) AsOwner() meta.OwnerReference {
trueVar := true
return meta.OwnerReference{
APIVersion: SchemeGroupVersion.String(),
Kind: scheduler.DeploymentResourceKind,
Name: d.Name,
UID: d.UID,
Controller: &trueVar,
}
}
func (d *ArangoSchedulerDeployment) GetStatus() ArangoSchedulerDeploymentStatus {
return d.Status
}
func (d *ArangoSchedulerDeployment) SetStatus(status ArangoSchedulerDeploymentStatus) {
d.Status = status
}

View file

@ -0,0 +1,83 @@
//
// 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 v1beta1
import (
core "k8s.io/api/core/v1"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/arangodb/kube-arangodb/pkg/apis/scheduler"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerPodList is a list of Pods.
type ArangoSchedulerPodList struct {
meta.TypeMeta `json:",inline"`
meta.ListMeta `json:"metadata,omitempty"`
Items []ArangoSchedulerPod `json:"items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// ArangoSchedulerPod wraps core. ArangoSchedulerPod with profile details
type ArangoSchedulerPod struct {
meta.TypeMeta `json:",inline"`
meta.ObjectMeta `json:"metadata,omitempty"`
Spec ArangoSchedulerPodSpec `json:"spec"`
Status ArangoSchedulerPodStatus `json:"status"`
}
type ArangoSchedulerPodSpec struct {
// Profiles keeps list of the profiles
Profiles []string `json:"profiles,omitempty"`
core.PodSpec `json:",inline"`
}
type ArangoSchedulerPodStatus struct {
ArangoSchedulerStatusMetadata `json:",inline"`
core.PodStatus `json:",inline"`
}
// AsOwner creates an OwnerReference for the given ArangoSchedulerPod
func (d *ArangoSchedulerPod) AsOwner() meta.OwnerReference {
trueVar := true
return meta.OwnerReference{
APIVersion: SchemeGroupVersion.String(),
Kind: scheduler.PodResourceKind,
Name: d.Name,
UID: d.UID,
Controller: &trueVar,
}
}
func (d *ArangoSchedulerPod) GetStatus() ArangoSchedulerPodStatus {
return d.Status
}
func (d *ArangoSchedulerPod) SetStatus(status ArangoSchedulerPodStatus) {
d.Status = status
}

View file

@ -29,7 +29,8 @@ import (
deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
container "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/container"
pod "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1/pod"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -94,6 +95,436 @@ func (in *ArangoProfileList) DeepCopyObject() runtime.Object {
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerBatchJob) DeepCopyInto(out *ArangoSchedulerBatchJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerBatchJob.
func (in *ArangoSchedulerBatchJob) DeepCopy() *ArangoSchedulerBatchJob {
if in == nil {
return nil
}
out := new(ArangoSchedulerBatchJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerBatchJob) 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 *ArangoSchedulerBatchJobList) DeepCopyInto(out *ArangoSchedulerBatchJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ArangoSchedulerBatchJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerBatchJobList.
func (in *ArangoSchedulerBatchJobList) DeepCopy() *ArangoSchedulerBatchJobList {
if in == nil {
return nil
}
out := new(ArangoSchedulerBatchJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerBatchJobList) 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 *ArangoSchedulerBatchJobSpec) DeepCopyInto(out *ArangoSchedulerBatchJobSpec) {
*out = *in
if in.Profiles != nil {
in, out := &in.Profiles, &out.Profiles
*out = make([]string, len(*in))
copy(*out, *in)
}
in.JobSpec.DeepCopyInto(&out.JobSpec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerBatchJobSpec.
func (in *ArangoSchedulerBatchJobSpec) DeepCopy() *ArangoSchedulerBatchJobSpec {
if in == nil {
return nil
}
out := new(ArangoSchedulerBatchJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerBatchJobStatus) DeepCopyInto(out *ArangoSchedulerBatchJobStatus) {
*out = *in
in.ArangoSchedulerStatusMetadata.DeepCopyInto(&out.ArangoSchedulerStatusMetadata)
in.JobStatus.DeepCopyInto(&out.JobStatus)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerBatchJobStatus.
func (in *ArangoSchedulerBatchJobStatus) DeepCopy() *ArangoSchedulerBatchJobStatus {
if in == nil {
return nil
}
out := new(ArangoSchedulerBatchJobStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerCronJob) DeepCopyInto(out *ArangoSchedulerCronJob) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerCronJob.
func (in *ArangoSchedulerCronJob) DeepCopy() *ArangoSchedulerCronJob {
if in == nil {
return nil
}
out := new(ArangoSchedulerCronJob)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerCronJob) 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 *ArangoSchedulerCronJobList) DeepCopyInto(out *ArangoSchedulerCronJobList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ArangoSchedulerCronJob, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerCronJobList.
func (in *ArangoSchedulerCronJobList) DeepCopy() *ArangoSchedulerCronJobList {
if in == nil {
return nil
}
out := new(ArangoSchedulerCronJobList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerCronJobList) 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 *ArangoSchedulerCronJobSpec) DeepCopyInto(out *ArangoSchedulerCronJobSpec) {
*out = *in
if in.Profiles != nil {
in, out := &in.Profiles, &out.Profiles
*out = make([]string, len(*in))
copy(*out, *in)
}
in.CronJobSpec.DeepCopyInto(&out.CronJobSpec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerCronJobSpec.
func (in *ArangoSchedulerCronJobSpec) DeepCopy() *ArangoSchedulerCronJobSpec {
if in == nil {
return nil
}
out := new(ArangoSchedulerCronJobSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerCronJobStatus) DeepCopyInto(out *ArangoSchedulerCronJobStatus) {
*out = *in
in.ArangoSchedulerStatusMetadata.DeepCopyInto(&out.ArangoSchedulerStatusMetadata)
in.CronJobStatus.DeepCopyInto(&out.CronJobStatus)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerCronJobStatus.
func (in *ArangoSchedulerCronJobStatus) DeepCopy() *ArangoSchedulerCronJobStatus {
if in == nil {
return nil
}
out := new(ArangoSchedulerCronJobStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerDeployment) DeepCopyInto(out *ArangoSchedulerDeployment) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerDeployment.
func (in *ArangoSchedulerDeployment) DeepCopy() *ArangoSchedulerDeployment {
if in == nil {
return nil
}
out := new(ArangoSchedulerDeployment)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerDeployment) 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 *ArangoSchedulerDeploymentList) DeepCopyInto(out *ArangoSchedulerDeploymentList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ArangoSchedulerDeployment, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerDeploymentList.
func (in *ArangoSchedulerDeploymentList) DeepCopy() *ArangoSchedulerDeploymentList {
if in == nil {
return nil
}
out := new(ArangoSchedulerDeploymentList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerDeploymentList) 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 *ArangoSchedulerDeploymentSpec) DeepCopyInto(out *ArangoSchedulerDeploymentSpec) {
*out = *in
if in.Profiles != nil {
in, out := &in.Profiles, &out.Profiles
*out = make([]string, len(*in))
copy(*out, *in)
}
in.DeploymentSpec.DeepCopyInto(&out.DeploymentSpec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerDeploymentSpec.
func (in *ArangoSchedulerDeploymentSpec) DeepCopy() *ArangoSchedulerDeploymentSpec {
if in == nil {
return nil
}
out := new(ArangoSchedulerDeploymentSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerDeploymentStatus) DeepCopyInto(out *ArangoSchedulerDeploymentStatus) {
*out = *in
in.ArangoSchedulerStatusMetadata.DeepCopyInto(&out.ArangoSchedulerStatusMetadata)
in.DeploymentStatus.DeepCopyInto(&out.DeploymentStatus)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerDeploymentStatus.
func (in *ArangoSchedulerDeploymentStatus) DeepCopy() *ArangoSchedulerDeploymentStatus {
if in == nil {
return nil
}
out := new(ArangoSchedulerDeploymentStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerPod) DeepCopyInto(out *ArangoSchedulerPod) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerPod.
func (in *ArangoSchedulerPod) DeepCopy() *ArangoSchedulerPod {
if in == nil {
return nil
}
out := new(ArangoSchedulerPod)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerPod) 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 *ArangoSchedulerPodList) DeepCopyInto(out *ArangoSchedulerPodList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ArangoSchedulerPod, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerPodList.
func (in *ArangoSchedulerPodList) DeepCopy() *ArangoSchedulerPodList {
if in == nil {
return nil
}
out := new(ArangoSchedulerPodList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ArangoSchedulerPodList) 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 *ArangoSchedulerPodSpec) DeepCopyInto(out *ArangoSchedulerPodSpec) {
*out = *in
if in.Profiles != nil {
in, out := &in.Profiles, &out.Profiles
*out = make([]string, len(*in))
copy(*out, *in)
}
in.PodSpec.DeepCopyInto(&out.PodSpec)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerPodSpec.
func (in *ArangoSchedulerPodSpec) DeepCopy() *ArangoSchedulerPodSpec {
if in == nil {
return nil
}
out := new(ArangoSchedulerPodSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerPodStatus) DeepCopyInto(out *ArangoSchedulerPodStatus) {
*out = *in
in.ArangoSchedulerStatusMetadata.DeepCopyInto(&out.ArangoSchedulerStatusMetadata)
in.PodStatus.DeepCopyInto(&out.PodStatus)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerPodStatus.
func (in *ArangoSchedulerPodStatus) DeepCopy() *ArangoSchedulerPodStatus {
if in == nil {
return nil
}
out := new(ArangoSchedulerPodStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ArangoSchedulerStatusMetadata) DeepCopyInto(out *ArangoSchedulerStatusMetadata) {
*out = *in
if in.Object != nil {
in, out := &in.Object, &out.Object
*out = new(v1.Object)
(*in).DeepCopyInto(*out)
}
if in.Profiles != nil {
in, out := &in.Profiles, &out.Profiles
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoSchedulerStatusMetadata.
func (in *ArangoSchedulerStatusMetadata) DeepCopy() *ArangoSchedulerStatusMetadata {
if in == nil {
return nil
}
out := new(ArangoSchedulerStatusMetadata)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ProfileAcceptedTemplate) DeepCopyInto(out *ProfileAcceptedTemplate) {
*out = *in
@ -148,7 +579,7 @@ func (in *ProfileSelectors) DeepCopyInto(out *ProfileSelectors) {
*out = *in
if in.Label != nil {
in, out := &in.Label, &out.Label
*out = new(v1.LabelSelector)
*out = new(metav1.LabelSelector)
(*in).DeepCopyInto(*out)
}
return

View file

@ -87,6 +87,10 @@ func AllDefinitions() []Definition {
// Scheduler
SchedulerProfileDefinitionWithOptions(),
SchedulerPodDefinitionWithOptions(),
SchedulerDeploymentDefinitionWithOptions(),
SchedulerBatchJobDefinitionWithOptions(),
SchedulerCronJobDefinitionWithOptions(),
// Analytics
AnalyticsGAEDefinitionWithOptions(),

View file

@ -92,6 +92,10 @@ func Test_CRD(t *testing.T) {
{ml.ArangoMLCronJobCRDName, MLCronJobDefinitionWithOptions},
{ml.ArangoMLBatchJobCRDName, MLBatchJobDefinitionWithOptions},
{scheduler.ArangoProfileCRDName, SchedulerProfileDefinitionWithOptions},
{scheduler.PodCRDName, SchedulerPodDefinitionWithOptions},
{scheduler.DeploymentCRDName, SchedulerDeploymentDefinitionWithOptions},
{scheduler.BatchJobCRDName, SchedulerBatchJobDefinitionWithOptions},
{scheduler.CronJobCRDName, SchedulerCronJobDefinitionWithOptions},
}
for _, tc := range testCases {
@ -143,6 +147,10 @@ func Test_CRDGetters(t *testing.T) {
ReplicationDeploymentReplicationWithOptions,
StorageLocalStorageWithOptions,
SchedulerProfileWithOptions,
SchedulerPodWithOptions,
SchedulerDeploymentWithOptions,
SchedulerBatchJobWithOptions,
SchedulerCronJobWithOptions,
AnalyticsGAEWithOptions,
NetworkingRouteWithOptions,
}

View file

@ -0,0 +1,51 @@
//
// 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"
)
func SchedulerBatchJobWithOptions(opts ...func(*CRDOptions)) *apiextensions.CustomResourceDefinition {
return getCRD(SchedulerBatchJobDefinitionData(), opts...)
}
func SchedulerBatchJobDefinitionWithOptions(opts ...func(*CRDOptions)) Definition {
return Definition{
DefinitionData: SchedulerBatchJobDefinitionData(),
CRD: SchedulerBatchJobWithOptions(opts...),
}
}
func SchedulerBatchJobDefinitionData() DefinitionData {
return DefinitionData{
definition: schedulerBatchJob,
schemaDefinition: schedulerBatchJobSchemaRaw,
}
}
//go:embed scheduler-batchjob.yaml
var schedulerBatchJob []byte
//go:embed scheduler-batchjob.schema.generated.yaml
var schedulerBatchJobSchemaRaw []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: arangoschedulerbatchjobs.scheduler.arangodb.com
spec:
group: scheduler.arangodb.com
names:
kind: ArangoSchedulerBatchJob
listKind: ArangoSchedulerBatchJobList
plural: arangoschedulerbatchjobs
singular: arangoschedulerbatchjob
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}

View file

@ -0,0 +1,51 @@
//
// 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"
)
func SchedulerCronJobWithOptions(opts ...func(*CRDOptions)) *apiextensions.CustomResourceDefinition {
return getCRD(SchedulerCronJobDefinitionData(), opts...)
}
func SchedulerCronJobDefinitionWithOptions(opts ...func(*CRDOptions)) Definition {
return Definition{
DefinitionData: SchedulerCronJobDefinitionData(),
CRD: SchedulerCronJobWithOptions(opts...),
}
}
func SchedulerCronJobDefinitionData() DefinitionData {
return DefinitionData{
definition: schedulerCronJob,
schemaDefinition: schedulerCronJobSchemaRaw,
}
}
//go:embed scheduler-cronjob.yaml
var schedulerCronJob []byte
//go:embed scheduler-cronjob.schema.generated.yaml
var schedulerCronJobSchemaRaw []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: arangoschedulercronjobs.scheduler.arangodb.com
spec:
group: scheduler.arangodb.com
names:
kind: ArangoSchedulerCronJob
listKind: ArangoSchedulerCronJobList
plural: arangoschedulercronjobs
singular: arangoschedulercronjob
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}

View file

@ -0,0 +1,51 @@
//
// 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"
)
func SchedulerDeploymentWithOptions(opts ...func(*CRDOptions)) *apiextensions.CustomResourceDefinition {
return getCRD(SchedulerDeploymentDefinitionData(), opts...)
}
func SchedulerDeploymentDefinitionWithOptions(opts ...func(*CRDOptions)) Definition {
return Definition{
DefinitionData: SchedulerDeploymentDefinitionData(),
CRD: SchedulerDeploymentWithOptions(opts...),
}
}
func SchedulerDeploymentDefinitionData() DefinitionData {
return DefinitionData{
definition: schedulerDeployment,
schemaDefinition: schedulerDeploymentSchemaRaw,
}
}
//go:embed scheduler-deployment.yaml
var schedulerDeployment []byte
//go:embed scheduler-deployment.schema.generated.yaml
var schedulerDeploymentSchemaRaw []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: arangoschedulerdeployments.scheduler.arangodb.com
spec:
group: scheduler.arangodb.com
names:
kind: ArangoSchedulerDeployment
listKind: ArangoSchedulerDeploymentList
plural: arangoschedulerdeployments
singular: arangoschedulerdeployment
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}

View file

@ -0,0 +1,51 @@
//
// 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"
)
func SchedulerPodWithOptions(opts ...func(*CRDOptions)) *apiextensions.CustomResourceDefinition {
return getCRD(SchedulerPodDefinitionData(), opts...)
}
func SchedulerPodDefinitionWithOptions(opts ...func(*CRDOptions)) Definition {
return Definition{
DefinitionData: SchedulerPodDefinitionData(),
CRD: SchedulerPodWithOptions(opts...),
}
}
func SchedulerPodDefinitionData() DefinitionData {
return DefinitionData{
definition: schedulerPod,
schemaDefinition: schedulerPodSchemaRaw,
}
}
//go:embed scheduler-pod.yaml
var schedulerPod []byte
//go:embed scheduler-pod.schema.generated.yaml
var schedulerPodSchemaRaw []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: arangoschedulerpods.scheduler.arangodb.com
spec:
group: scheduler.arangodb.com
names:
kind: ArangoSchedulerPod
listKind: ArangoSchedulerPodList
plural: arangoschedulerpods
singular: arangoschedulerpod
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
served: true
storage: true
subresources:
status: {}

58
pkg/crd/scheduling.go Normal file
View file

@ -0,0 +1,58 @@
//
// 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())
}, &crds.CRDOptions{
WithSchema: true,
WithPreserve: false,
})
registerCRDWithPanic(func(opts *crds.CRDOptions) crds.Definition {
return crds.SchedulerPodDefinitionWithOptions(opts.AsFunc())
}, &crds.CRDOptions{
WithSchema: true,
WithPreserve: false,
})
registerCRDWithPanic(func(opts *crds.CRDOptions) crds.Definition {
return crds.SchedulerDeploymentDefinitionWithOptions(opts.AsFunc())
}, &crds.CRDOptions{
WithSchema: true,
WithPreserve: false,
})
registerCRDWithPanic(func(opts *crds.CRDOptions) crds.Definition {
return crds.SchedulerBatchJobDefinitionWithOptions(opts.AsFunc())
}, &crds.CRDOptions{
WithSchema: true,
WithPreserve: false,
})
registerCRDWithPanic(func(opts *crds.CRDOptions) crds.Definition {
return crds.SchedulerCronJobDefinitionWithOptions(opts.AsFunc())
}, &crds.CRDOptions{
WithSchema: true,
WithPreserve: false,
})
}

View file

@ -22,82 +22,15 @@ package kubernetes
import (
"context"
"sort"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/generic"
)
func Extract[T1, T2 any](in List[T1], ex func(in T1) T2) List[T2] {
r := make(List[T2], len(in))
for id := range r {
r[id] = ex(in[id])
}
return r
}
type List[T any] []T
func (l List[T]) Sort(pred func(a, b T) bool) List[T] {
sort.Slice(l, func(i, j int) bool {
return pred(l[i], l[j])
})
return l
}
func (l List[T]) Append(obj ...T) List[T] {
r := make(List[T], 0, len(l)+len(obj))
r = append(r, l...)
r = append(r, obj...)
return r
}
func (l List[T]) Filter(f func(a T) bool) List[T] {
r := make(List[T], 0, len(l))
for _, o := range l {
if !f(o) {
continue
}
r = append(r, o)
}
return r
}
func (l List[T]) Contains(f func(a T) bool) bool {
for _, o := range l {
if f(o) {
return true
}
}
return false
}
func (l List[T]) Unique(f func(existing List[T], a T) bool) List[T] {
r := make(List[T], 0, len(l))
for _, o := range l {
if f(r, o) {
continue
}
r = append(r, o)
}
return r
}
type ObjectList[T meta.Object] map[types.UID]T
func (d ObjectList[T]) ByName(name string) (T, bool) {
@ -110,7 +43,7 @@ func (d ObjectList[T]) ByName(name string) (T, bool) {
return util.Default[T](), false
}
func (d ObjectList[T]) AsList() List[T] {
func (d ObjectList[T]) AsList() util.List[T] {
list := make([]T, 0, len(d))
for _, p := range d {
list = append(list, p)
@ -119,7 +52,7 @@ func (d ObjectList[T]) AsList() List[T] {
return list
}
func MapObjects[L k8sutil.ListContinue, T meta.Object](ctx context.Context, k k8sutil.ListAPI[L], extract func(result L) []T) (ObjectList[T], error) {
func MapObjects[L generic.ListContinue, T meta.Object](ctx context.Context, k generic.ListInterface[L], extract func(result L) []T) (ObjectList[T], error) {
objects := ObjectList[T]{}
if err := k8sutil.APIList[L](ctx, k, meta.ListOptions{}, func(result L, err error) error {
@ -140,7 +73,7 @@ func MapObjects[L k8sutil.ListContinue, T meta.Object](ctx context.Context, k k8
return objects, nil
}
func ListObjects[L k8sutil.ListContinue, T meta.Object](ctx context.Context, k k8sutil.ListAPI[L], extract func(result L) []T) ([]T, error) {
func ListObjects[L generic.ListContinue, T meta.Object](ctx context.Context, k generic.ListInterface[L], extract func(result L) []T) ([]T, error) {
objects, err := MapObjects[L, T](ctx, k, extract)
if err != nil {
return nil, err

View file

@ -153,7 +153,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
defer cancel()
pod, err := ib.Context.ACS().CurrentClusterCache().Pod().V1().Read().Get(ctxChild, podName, meta.GetOptions{})
if err == nil {
// Pod found
// ArangoSchedulerPod found
if k8sutil.IsPodFailed(pod, utils.StringList{shared.ServerContainerName}) {
// Wait some time before deleting the pod
if time.Now().After(pod.GetCreationTimestamp().Add(30 * time.Second)) {
@ -161,14 +161,14 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
return ib.Context.ACS().CurrentClusterCache().PodsModInterface().V1().Delete(ctxChild, podName, meta.DeleteOptions{})
})
if err != nil && !kerrors.IsNotFound(err) {
log.Err(err).Warn("Failed to delete Image ID Pod")
log.Err(err).Warn("Failed to delete Image ID ArangoSchedulerPod")
return false, nil
}
}
return false, nil
}
if !k8sutil.IsPodReady(pod) {
log.Debug("Image ID Pod is not yet ready")
log.Debug("Image ID ArangoSchedulerPod is not yet ready")
return true, nil
}
@ -181,14 +181,14 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
// Try fetching the ArangoDB version
client, err := arangod.CreateArangodImageIDClient(ctx, ib.APIObject, pod.Status.PodIP, false)
if err != nil {
log.Err(err).Warn("Failed to create Image ID Pod client")
log.Err(err).Warn("Failed to create Image ID ArangoSchedulerPod client")
return true, nil
}
ctxChild, cancel = globals.GetGlobalTimeouts().ArangoD().WithTimeout(ctx)
defer cancel()
v, err := client.Version(ctxChild)
if err != nil {
log.Err(err).Debug("Failed to fetch version from Image ID Pod")
log.Err(err).Debug("Failed to fetch version from Image ID ArangoSchedulerPod")
return true, nil
}
version := v.Version
@ -199,7 +199,7 @@ func (ib *imagesBuilder) fetchArangoDBImageIDAndVersion(ctx context.Context, cac
return ib.Context.ACS().CurrentClusterCache().PodsModInterface().V1().Delete(ctxChild, podName, meta.DeleteOptions{})
})
if err != nil && !kerrors.IsNotFound(err) {
log.Err(err).Warn("Failed to delete Image ID Pod")
log.Err(err).Warn("Failed to delete Image ID ArangoSchedulerPod")
return true, nil
}

View file

@ -25,6 +25,7 @@ import (
"fmt"
"time"
"k8s.io/apimachinery/pkg/api/equality"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
@ -33,8 +34,11 @@ import (
"github.com/arangodb/kube-arangodb/pkg/integrations/sidecar"
"github.com/arangodb/kube-arangodb/pkg/metrics"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/constants"
"github.com/arangodb/kube-arangodb/pkg/util/errors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil"
inspectorInterface "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/patcher"
)
@ -43,11 +47,22 @@ var (
inspectArangoProfilesDurationGauges = metrics.MustRegisterGaugeVec(metricsComponent, "inspect_arango_profiles_duration", "Amount of time taken by a single inspection of all ArangoProfiles for a deployment (in sec)", metrics.DeploymentName)
)
func matchArangoProfilesLabels(labels map[string]string) *schedulerApi.ProfileSelectors {
if labels == nil {
return nil
}
return &schedulerApi.ProfileSelectors{
Label: &meta.LabelSelector{
MatchLabels: labels,
},
}
}
// EnsureArangoProfiles creates all ArangoProfiles needed to run the given deployment
func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspectorInterface.Inspector) error {
start := time.Now()
spec := r.context.GetSpec()
arangoProfiles := cachedStatus.ArangoProfileModInterface().V1Beta1()
apiObject := r.context.GetAPIObject()
deploymentName := apiObject.GetName()
@ -56,74 +71,167 @@ func (r *Resources) EnsureArangoProfiles(ctx context.Context, cachedStatus inspe
reconcileRequired := k8sutil.NewReconcile(cachedStatus)
intName := fmt.Sprintf("%s-int", deploymentName)
integration, err := sidecar.NewIntegration(&schedulerContainerResourcesApi.Image{
Image: util.NewType(r.context.GetOperatorImage()),
}, spec.Integration.GetSidecar())
if err != nil {
return err
}
integrationChecksum, err := integration.Checksum()
if err != nil {
return err
}
if c, err := cachedStatus.ArangoProfile().V1Beta1(); err == nil {
gen := func(name, version string, integrations ...sidecar.Integration) func() (string, *schedulerApi.ArangoProfile, error) {
return func() (string, *schedulerApi.ArangoProfile, error) {
counterMetric.Inc()
if s, ok := c.GetSimple(intName); !ok {
s = &schedulerApi.ArangoProfile{
fullName := fmt.Sprintf("%s-int-%s-%s", deploymentName, name, version)
integration, err := sidecar.NewIntegrationEnablement(integrations...)
if err != nil {
return "", nil, err
}
return fullName, &schedulerApi.ArangoProfile{
ObjectMeta: meta.ObjectMeta{
Name: intName,
Name: fullName,
Namespace: apiObject.GetNamespace(),
OwnerReferences: []meta.OwnerReference{
apiObject.AsOwner(),
},
},
Spec: schedulerApi.ProfileSpec{
Selectors: matchArangoProfilesLabels(map[string]string{
constants.ProfilesDeployment: deploymentName,
fmt.Sprintf("%s/%s", constants.ProfilesIntegrationPrefix, name): version,
}),
Template: integration,
},
}, nil
}
}
if _, err := cachedStatus.ArangoProfileModInterface().V1Beta1().Create(ctx, s, meta.CreateOptions{}); err != nil {
if changed, err := r.ensureArangoProfilesFactory(ctx, cachedStatus,
func() (string, *schedulerApi.ArangoProfile, error) {
counterMetric.Inc()
name := fmt.Sprintf("%s-int", deploymentName)
integration, err := sidecar.NewIntegration(&schedulerContainerResourcesApi.Image{
Image: util.NewType(r.context.GetOperatorImage()),
}, spec.Integration.GetSidecar())
if err != nil {
return "", nil, err
}
return name, &schedulerApi.ArangoProfile{
ObjectMeta: meta.ObjectMeta{
Name: name,
Namespace: apiObject.GetNamespace(),
OwnerReferences: []meta.OwnerReference{
apiObject.AsOwner(),
},
},
Spec: schedulerApi.ProfileSpec{
Selectors: matchArangoProfilesLabels(map[string]string{
constants.ProfilesDeployment: deploymentName,
}),
Template: integration,
},
}, nil
},
gen("authz", "v0", sidecar.IntegrationAuthorizationV0{}),
gen("authn", "v1", sidecar.IntegrationAuthenticationV1{Spec: spec, DeploymentName: apiObject.GetName()}),
); err != nil {
return err
} else if changed {
reconcileRequired.Required()
}
reconcileRequired.Required()
return reconcileRequired.Reconcile(ctx)
}
func (r *Resources) ensureArangoProfilesFactory(ctx context.Context, cachedStatus inspectorInterface.Inspector, expected ...func() (string, *schedulerApi.ArangoProfile, error)) (bool, error) {
var changed bool
for _, e := range expected {
name, profile, err := e()
if err != nil {
return false, err
}
if c, err := r.ensureArangoProfile(ctx, cachedStatus, name, profile); err != nil {
return false, err
} else if c {
changed = true
}
}
return changed, nil
}
func (r *Resources) ensureArangoProfile(ctx context.Context, cachedStatus inspectorInterface.Inspector, name string, expected *schedulerApi.ArangoProfile) (bool, error) {
arangoProfiles := cachedStatus.ArangoProfileModInterface().V1Beta1()
if expected.GetName() != name {
return false, errors.Errorf("Name mismatch")
}
if c, err := cachedStatus.ArangoProfile().V1Beta1(); err == nil {
if s, ok := c.GetSimple(name); !ok {
if expected != nil {
if _, err := arangoProfiles.Create(ctx, expected, meta.CreateOptions{}); err != nil {
return false, err
}
return true, nil
}
} else {
if expected == nil {
if err := arangoProfiles.Delete(ctx, s.GetName(), meta.DeleteOptions{}); err != nil {
if !kerrors.IsNotFound(err) {
return false, err
}
}
return true, nil
}
expectedChecksum, err := expected.Spec.Template.Checksum()
if err != nil {
return false, err
}
currChecksum, err := s.Spec.Template.Checksum()
if err != nil {
return err
return false, err
}
if s.Spec.Selectors != nil {
if expected.Spec.Selectors == nil && s.Spec.Selectors != nil {
// Remove
if _, changed, err := patcher.Patcher[*schedulerApi.ArangoProfile](ctx, arangoProfiles, s, meta.PatchOptions{},
func(in *schedulerApi.ArangoProfile) []patch.Item {
return []patch.Item{
patch.ItemRemove(patch.NewPath("spec", "selectors")),
}
}); err != nil {
return err
return false, err
} else if changed {
reconcileRequired.Required()
return true, nil
}
}
if currChecksum != integrationChecksum {
} else if !equality.Semantic.DeepEqual(expected.Spec.Selectors, s.Spec.Selectors) {
if _, changed, err := patcher.Patcher[*schedulerApi.ArangoProfile](ctx, arangoProfiles, s, meta.PatchOptions{},
func(in *schedulerApi.ArangoProfile) []patch.Item {
return []patch.Item{
patch.ItemReplace(patch.NewPath("spec", "template"), integration),
patch.ItemReplace(patch.NewPath("spec", "selectors"), expected.Spec.Selectors),
}
}); err != nil {
return err
return false, err
} else if changed {
reconcileRequired.Required()
return true, nil
}
}
if currChecksum != expectedChecksum {
if _, changed, err := patcher.Patcher[*schedulerApi.ArangoProfile](ctx, arangoProfiles, s, meta.PatchOptions{},
func(in *schedulerApi.ArangoProfile) []patch.Item {
return []patch.Item{
patch.ItemReplace(patch.NewPath("spec", "template"), util.TypeOrDefault(expected.Spec.Template)),
}
}); err != nil {
return false, err
} else if changed {
return true, nil
}
}
}
}
return reconcileRequired.Reconcile(ctx)
return false, nil
}

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 v1beta1
import (
"context"
"time"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// ArangoSchedulerBatchJobsGetter has a method to return a ArangoSchedulerBatchJobInterface.
// A group's client should implement this interface.
type ArangoSchedulerBatchJobsGetter interface {
ArangoSchedulerBatchJobs(namespace string) ArangoSchedulerBatchJobInterface
}
// ArangoSchedulerBatchJobInterface has methods to work with ArangoSchedulerBatchJob resources.
type ArangoSchedulerBatchJobInterface interface {
Create(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.CreateOptions) (*v1beta1.ArangoSchedulerBatchJob, error)
Update(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerBatchJob, error)
UpdateStatus(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerBatchJob, 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) (*v1beta1.ArangoSchedulerBatchJob, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ArangoSchedulerBatchJobList, 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 *v1beta1.ArangoSchedulerBatchJob, err error)
ArangoSchedulerBatchJobExpansion
}
// arangoSchedulerBatchJobs implements ArangoSchedulerBatchJobInterface
type arangoSchedulerBatchJobs struct {
client rest.Interface
ns string
}
// newArangoSchedulerBatchJobs returns a ArangoSchedulerBatchJobs
func newArangoSchedulerBatchJobs(c *SchedulerV1beta1Client, namespace string) *arangoSchedulerBatchJobs {
return &arangoSchedulerBatchJobs{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the arangoSchedulerBatchJob, and returns the corresponding arangoSchedulerBatchJob object, and an error if there is any.
func (c *arangoSchedulerBatchJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
result = &v1beta1.ArangoSchedulerBatchJob{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoSchedulerBatchJobs that match those selectors.
func (c *arangoSchedulerBatchJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerBatchJobList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ArangoSchedulerBatchJobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoSchedulerBatchJobs.
func (c *arangoSchedulerBatchJobs) 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("arangoschedulerbatchjobs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a arangoSchedulerBatchJob and creates it. Returns the server's representation of the arangoSchedulerBatchJob, and an error, if there is any.
func (c *arangoSchedulerBatchJobs) Create(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
result = &v1beta1.ArangoSchedulerBatchJob{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerBatchJob).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoSchedulerBatchJob and updates it. Returns the server's representation of the arangoSchedulerBatchJob, and an error, if there is any.
func (c *arangoSchedulerBatchJobs) Update(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
result = &v1beta1.ArangoSchedulerBatchJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
Name(arangoSchedulerBatchJob.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerBatchJob).
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 *arangoSchedulerBatchJobs) UpdateStatus(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
result = &v1beta1.ArangoSchedulerBatchJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
Name(arangoSchedulerBatchJob.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerBatchJob).
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoSchedulerBatchJob and deletes it. Returns an error if one occurs.
func (c *arangoSchedulerBatchJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoSchedulerBatchJobs) 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("arangoschedulerbatchjobs").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoSchedulerBatchJob.
func (c *arangoSchedulerBatchJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
result = &v1beta1.ArangoSchedulerBatchJob{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangoschedulerbatchjobs").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

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 v1beta1
import (
"context"
"time"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// ArangoSchedulerCronJobsGetter has a method to return a ArangoSchedulerCronJobInterface.
// A group's client should implement this interface.
type ArangoSchedulerCronJobsGetter interface {
ArangoSchedulerCronJobs(namespace string) ArangoSchedulerCronJobInterface
}
// ArangoSchedulerCronJobInterface has methods to work with ArangoSchedulerCronJob resources.
type ArangoSchedulerCronJobInterface interface {
Create(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.CreateOptions) (*v1beta1.ArangoSchedulerCronJob, error)
Update(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerCronJob, error)
UpdateStatus(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerCronJob, 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) (*v1beta1.ArangoSchedulerCronJob, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ArangoSchedulerCronJobList, 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 *v1beta1.ArangoSchedulerCronJob, err error)
ArangoSchedulerCronJobExpansion
}
// arangoSchedulerCronJobs implements ArangoSchedulerCronJobInterface
type arangoSchedulerCronJobs struct {
client rest.Interface
ns string
}
// newArangoSchedulerCronJobs returns a ArangoSchedulerCronJobs
func newArangoSchedulerCronJobs(c *SchedulerV1beta1Client, namespace string) *arangoSchedulerCronJobs {
return &arangoSchedulerCronJobs{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the arangoSchedulerCronJob, and returns the corresponding arangoSchedulerCronJob object, and an error if there is any.
func (c *arangoSchedulerCronJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
result = &v1beta1.ArangoSchedulerCronJob{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulercronjobs").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoSchedulerCronJobs that match those selectors.
func (c *arangoSchedulerCronJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerCronJobList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ArangoSchedulerCronJobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulercronjobs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoSchedulerCronJobs.
func (c *arangoSchedulerCronJobs) 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("arangoschedulercronjobs").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a arangoSchedulerCronJob and creates it. Returns the server's representation of the arangoSchedulerCronJob, and an error, if there is any.
func (c *arangoSchedulerCronJobs) Create(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
result = &v1beta1.ArangoSchedulerCronJob{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangoschedulercronjobs").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerCronJob).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoSchedulerCronJob and updates it. Returns the server's representation of the arangoSchedulerCronJob, and an error, if there is any.
func (c *arangoSchedulerCronJobs) Update(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
result = &v1beta1.ArangoSchedulerCronJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulercronjobs").
Name(arangoSchedulerCronJob.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerCronJob).
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 *arangoSchedulerCronJobs) UpdateStatus(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
result = &v1beta1.ArangoSchedulerCronJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulercronjobs").
Name(arangoSchedulerCronJob.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerCronJob).
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoSchedulerCronJob and deletes it. Returns an error if one occurs.
func (c *arangoSchedulerCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangoschedulercronjobs").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoSchedulerCronJobs) 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("arangoschedulercronjobs").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoSchedulerCronJob.
func (c *arangoSchedulerCronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerCronJob, err error) {
result = &v1beta1.ArangoSchedulerCronJob{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangoschedulercronjobs").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

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 v1beta1
import (
"context"
"time"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// ArangoSchedulerDeploymentsGetter has a method to return a ArangoSchedulerDeploymentInterface.
// A group's client should implement this interface.
type ArangoSchedulerDeploymentsGetter interface {
ArangoSchedulerDeployments(namespace string) ArangoSchedulerDeploymentInterface
}
// ArangoSchedulerDeploymentInterface has methods to work with ArangoSchedulerDeployment resources.
type ArangoSchedulerDeploymentInterface interface {
Create(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.CreateOptions) (*v1beta1.ArangoSchedulerDeployment, error)
Update(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerDeployment, error)
UpdateStatus(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerDeployment, 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) (*v1beta1.ArangoSchedulerDeployment, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ArangoSchedulerDeploymentList, 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 *v1beta1.ArangoSchedulerDeployment, err error)
ArangoSchedulerDeploymentExpansion
}
// arangoSchedulerDeployments implements ArangoSchedulerDeploymentInterface
type arangoSchedulerDeployments struct {
client rest.Interface
ns string
}
// newArangoSchedulerDeployments returns a ArangoSchedulerDeployments
func newArangoSchedulerDeployments(c *SchedulerV1beta1Client, namespace string) *arangoSchedulerDeployments {
return &arangoSchedulerDeployments{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the arangoSchedulerDeployment, and returns the corresponding arangoSchedulerDeployment object, and an error if there is any.
func (c *arangoSchedulerDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
result = &v1beta1.ArangoSchedulerDeployment{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulerdeployments").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoSchedulerDeployments that match those selectors.
func (c *arangoSchedulerDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerDeploymentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ArangoSchedulerDeploymentList{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulerdeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoSchedulerDeployments.
func (c *arangoSchedulerDeployments) 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("arangoschedulerdeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a arangoSchedulerDeployment and creates it. Returns the server's representation of the arangoSchedulerDeployment, and an error, if there is any.
func (c *arangoSchedulerDeployments) Create(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
result = &v1beta1.ArangoSchedulerDeployment{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangoschedulerdeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerDeployment).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoSchedulerDeployment and updates it. Returns the server's representation of the arangoSchedulerDeployment, and an error, if there is any.
func (c *arangoSchedulerDeployments) Update(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
result = &v1beta1.ArangoSchedulerDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulerdeployments").
Name(arangoSchedulerDeployment.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerDeployment).
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 *arangoSchedulerDeployments) UpdateStatus(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
result = &v1beta1.ArangoSchedulerDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulerdeployments").
Name(arangoSchedulerDeployment.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerDeployment).
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoSchedulerDeployment and deletes it. Returns an error if one occurs.
func (c *arangoSchedulerDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangoschedulerdeployments").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoSchedulerDeployments) 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("arangoschedulerdeployments").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoSchedulerDeployment.
func (c *arangoSchedulerDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerDeployment, err error) {
result = &v1beta1.ArangoSchedulerDeployment{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangoschedulerdeployments").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

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 v1beta1
import (
"context"
"time"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// ArangoSchedulerPodsGetter has a method to return a ArangoSchedulerPodInterface.
// A group's client should implement this interface.
type ArangoSchedulerPodsGetter interface {
ArangoSchedulerPods(namespace string) ArangoSchedulerPodInterface
}
// ArangoSchedulerPodInterface has methods to work with ArangoSchedulerPod resources.
type ArangoSchedulerPodInterface interface {
Create(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.CreateOptions) (*v1beta1.ArangoSchedulerPod, error)
Update(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerPod, error)
UpdateStatus(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerPod, 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) (*v1beta1.ArangoSchedulerPod, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.ArangoSchedulerPodList, 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 *v1beta1.ArangoSchedulerPod, err error)
ArangoSchedulerPodExpansion
}
// arangoSchedulerPods implements ArangoSchedulerPodInterface
type arangoSchedulerPods struct {
client rest.Interface
ns string
}
// newArangoSchedulerPods returns a ArangoSchedulerPods
func newArangoSchedulerPods(c *SchedulerV1beta1Client, namespace string) *arangoSchedulerPods {
return &arangoSchedulerPods{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the arangoSchedulerPod, and returns the corresponding arangoSchedulerPod object, and an error if there is any.
func (c *arangoSchedulerPods) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
result = &v1beta1.ArangoSchedulerPod{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulerpods").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of ArangoSchedulerPods that match those selectors.
func (c *arangoSchedulerPods) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerPodList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.ArangoSchedulerPodList{}
err = c.client.Get().
Namespace(c.ns).
Resource("arangoschedulerpods").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested arangoSchedulerPods.
func (c *arangoSchedulerPods) 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("arangoschedulerpods").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a arangoSchedulerPod and creates it. Returns the server's representation of the arangoSchedulerPod, and an error, if there is any.
func (c *arangoSchedulerPods) Create(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
result = &v1beta1.ArangoSchedulerPod{}
err = c.client.Post().
Namespace(c.ns).
Resource("arangoschedulerpods").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerPod).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a arangoSchedulerPod and updates it. Returns the server's representation of the arangoSchedulerPod, and an error, if there is any.
func (c *arangoSchedulerPods) Update(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
result = &v1beta1.ArangoSchedulerPod{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulerpods").
Name(arangoSchedulerPod.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerPod).
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 *arangoSchedulerPods) UpdateStatus(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
result = &v1beta1.ArangoSchedulerPod{}
err = c.client.Put().
Namespace(c.ns).
Resource("arangoschedulerpods").
Name(arangoSchedulerPod.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(arangoSchedulerPod).
Do(ctx).
Into(result)
return
}
// Delete takes name of the arangoSchedulerPod and deletes it. Returns an error if one occurs.
func (c *arangoSchedulerPods) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("arangoschedulerpods").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *arangoSchedulerPods) 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("arangoschedulerpods").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched arangoSchedulerPod.
func (c *arangoSchedulerPods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerPod, err error) {
result = &v1beta1.ArangoSchedulerPod{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("arangoschedulerpods").
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"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// FakeArangoSchedulerBatchJobs implements ArangoSchedulerBatchJobInterface
type FakeArangoSchedulerBatchJobs struct {
Fake *FakeSchedulerV1beta1
ns string
}
var arangoschedulerbatchjobsResource = v1beta1.SchemeGroupVersion.WithResource("arangoschedulerbatchjobs")
var arangoschedulerbatchjobsKind = v1beta1.SchemeGroupVersion.WithKind("ArangoSchedulerBatchJob")
// Get takes name of the arangoSchedulerBatchJob, and returns the corresponding arangoSchedulerBatchJob object, and an error if there is any.
func (c *FakeArangoSchedulerBatchJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangoschedulerbatchjobsResource, c.ns, name), &v1beta1.ArangoSchedulerBatchJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerBatchJob), err
}
// List takes label and field selectors, and returns the list of ArangoSchedulerBatchJobs that match those selectors.
func (c *FakeArangoSchedulerBatchJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerBatchJobList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangoschedulerbatchjobsResource, arangoschedulerbatchjobsKind, c.ns, opts), &v1beta1.ArangoSchedulerBatchJobList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ArangoSchedulerBatchJobList{ListMeta: obj.(*v1beta1.ArangoSchedulerBatchJobList).ListMeta}
for _, item := range obj.(*v1beta1.ArangoSchedulerBatchJobList).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 arangoSchedulerBatchJobs.
func (c *FakeArangoSchedulerBatchJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangoschedulerbatchjobsResource, c.ns, opts))
}
// Create takes the representation of a arangoSchedulerBatchJob and creates it. Returns the server's representation of the arangoSchedulerBatchJob, and an error, if there is any.
func (c *FakeArangoSchedulerBatchJobs) Create(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangoschedulerbatchjobsResource, c.ns, arangoSchedulerBatchJob), &v1beta1.ArangoSchedulerBatchJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerBatchJob), err
}
// Update takes the representation of a arangoSchedulerBatchJob and updates it. Returns the server's representation of the arangoSchedulerBatchJob, and an error, if there is any.
func (c *FakeArangoSchedulerBatchJobs) Update(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangoschedulerbatchjobsResource, c.ns, arangoSchedulerBatchJob), &v1beta1.ArangoSchedulerBatchJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerBatchJob), 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 *FakeArangoSchedulerBatchJobs) UpdateStatus(ctx context.Context, arangoSchedulerBatchJob *v1beta1.ArangoSchedulerBatchJob, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerBatchJob, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangoschedulerbatchjobsResource, "status", c.ns, arangoSchedulerBatchJob), &v1beta1.ArangoSchedulerBatchJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerBatchJob), err
}
// Delete takes name of the arangoSchedulerBatchJob and deletes it. Returns an error if one occurs.
func (c *FakeArangoSchedulerBatchJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(arangoschedulerbatchjobsResource, c.ns, name, opts), &v1beta1.ArangoSchedulerBatchJob{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoSchedulerBatchJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangoschedulerbatchjobsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ArangoSchedulerBatchJobList{})
return err
}
// Patch applies the patch and returns the patched arangoSchedulerBatchJob.
func (c *FakeArangoSchedulerBatchJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerBatchJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangoschedulerbatchjobsResource, c.ns, name, pt, data, subresources...), &v1beta1.ArangoSchedulerBatchJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerBatchJob), err
}

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"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// FakeArangoSchedulerCronJobs implements ArangoSchedulerCronJobInterface
type FakeArangoSchedulerCronJobs struct {
Fake *FakeSchedulerV1beta1
ns string
}
var arangoschedulercronjobsResource = v1beta1.SchemeGroupVersion.WithResource("arangoschedulercronjobs")
var arangoschedulercronjobsKind = v1beta1.SchemeGroupVersion.WithKind("ArangoSchedulerCronJob")
// Get takes name of the arangoSchedulerCronJob, and returns the corresponding arangoSchedulerCronJob object, and an error if there is any.
func (c *FakeArangoSchedulerCronJobs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangoschedulercronjobsResource, c.ns, name), &v1beta1.ArangoSchedulerCronJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerCronJob), err
}
// List takes label and field selectors, and returns the list of ArangoSchedulerCronJobs that match those selectors.
func (c *FakeArangoSchedulerCronJobs) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerCronJobList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangoschedulercronjobsResource, arangoschedulercronjobsKind, c.ns, opts), &v1beta1.ArangoSchedulerCronJobList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ArangoSchedulerCronJobList{ListMeta: obj.(*v1beta1.ArangoSchedulerCronJobList).ListMeta}
for _, item := range obj.(*v1beta1.ArangoSchedulerCronJobList).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 arangoSchedulerCronJobs.
func (c *FakeArangoSchedulerCronJobs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangoschedulercronjobsResource, c.ns, opts))
}
// Create takes the representation of a arangoSchedulerCronJob and creates it. Returns the server's representation of the arangoSchedulerCronJob, and an error, if there is any.
func (c *FakeArangoSchedulerCronJobs) Create(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangoschedulercronjobsResource, c.ns, arangoSchedulerCronJob), &v1beta1.ArangoSchedulerCronJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerCronJob), err
}
// Update takes the representation of a arangoSchedulerCronJob and updates it. Returns the server's representation of the arangoSchedulerCronJob, and an error, if there is any.
func (c *FakeArangoSchedulerCronJobs) Update(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerCronJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangoschedulercronjobsResource, c.ns, arangoSchedulerCronJob), &v1beta1.ArangoSchedulerCronJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerCronJob), 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 *FakeArangoSchedulerCronJobs) UpdateStatus(ctx context.Context, arangoSchedulerCronJob *v1beta1.ArangoSchedulerCronJob, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerCronJob, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangoschedulercronjobsResource, "status", c.ns, arangoSchedulerCronJob), &v1beta1.ArangoSchedulerCronJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerCronJob), err
}
// Delete takes name of the arangoSchedulerCronJob and deletes it. Returns an error if one occurs.
func (c *FakeArangoSchedulerCronJobs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(arangoschedulercronjobsResource, c.ns, name, opts), &v1beta1.ArangoSchedulerCronJob{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoSchedulerCronJobs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangoschedulercronjobsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ArangoSchedulerCronJobList{})
return err
}
// Patch applies the patch and returns the patched arangoSchedulerCronJob.
func (c *FakeArangoSchedulerCronJobs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerCronJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangoschedulercronjobsResource, c.ns, name, pt, data, subresources...), &v1beta1.ArangoSchedulerCronJob{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerCronJob), err
}

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"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// FakeArangoSchedulerDeployments implements ArangoSchedulerDeploymentInterface
type FakeArangoSchedulerDeployments struct {
Fake *FakeSchedulerV1beta1
ns string
}
var arangoschedulerdeploymentsResource = v1beta1.SchemeGroupVersion.WithResource("arangoschedulerdeployments")
var arangoschedulerdeploymentsKind = v1beta1.SchemeGroupVersion.WithKind("ArangoSchedulerDeployment")
// Get takes name of the arangoSchedulerDeployment, and returns the corresponding arangoSchedulerDeployment object, and an error if there is any.
func (c *FakeArangoSchedulerDeployments) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangoschedulerdeploymentsResource, c.ns, name), &v1beta1.ArangoSchedulerDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerDeployment), err
}
// List takes label and field selectors, and returns the list of ArangoSchedulerDeployments that match those selectors.
func (c *FakeArangoSchedulerDeployments) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerDeploymentList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangoschedulerdeploymentsResource, arangoschedulerdeploymentsKind, c.ns, opts), &v1beta1.ArangoSchedulerDeploymentList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ArangoSchedulerDeploymentList{ListMeta: obj.(*v1beta1.ArangoSchedulerDeploymentList).ListMeta}
for _, item := range obj.(*v1beta1.ArangoSchedulerDeploymentList).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 arangoSchedulerDeployments.
func (c *FakeArangoSchedulerDeployments) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangoschedulerdeploymentsResource, c.ns, opts))
}
// Create takes the representation of a arangoSchedulerDeployment and creates it. Returns the server's representation of the arangoSchedulerDeployment, and an error, if there is any.
func (c *FakeArangoSchedulerDeployments) Create(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangoschedulerdeploymentsResource, c.ns, arangoSchedulerDeployment), &v1beta1.ArangoSchedulerDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerDeployment), err
}
// Update takes the representation of a arangoSchedulerDeployment and updates it. Returns the server's representation of the arangoSchedulerDeployment, and an error, if there is any.
func (c *FakeArangoSchedulerDeployments) Update(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangoschedulerdeploymentsResource, c.ns, arangoSchedulerDeployment), &v1beta1.ArangoSchedulerDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerDeployment), 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 *FakeArangoSchedulerDeployments) UpdateStatus(ctx context.Context, arangoSchedulerDeployment *v1beta1.ArangoSchedulerDeployment, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerDeployment, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangoschedulerdeploymentsResource, "status", c.ns, arangoSchedulerDeployment), &v1beta1.ArangoSchedulerDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerDeployment), err
}
// Delete takes name of the arangoSchedulerDeployment and deletes it. Returns an error if one occurs.
func (c *FakeArangoSchedulerDeployments) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(arangoschedulerdeploymentsResource, c.ns, name, opts), &v1beta1.ArangoSchedulerDeployment{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoSchedulerDeployments) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangoschedulerdeploymentsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ArangoSchedulerDeploymentList{})
return err
}
// Patch applies the patch and returns the patched arangoSchedulerDeployment.
func (c *FakeArangoSchedulerDeployments) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerDeployment, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangoschedulerdeploymentsResource, c.ns, name, pt, data, subresources...), &v1beta1.ArangoSchedulerDeployment{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerDeployment), err
}

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"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
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"
)
// FakeArangoSchedulerPods implements ArangoSchedulerPodInterface
type FakeArangoSchedulerPods struct {
Fake *FakeSchedulerV1beta1
ns string
}
var arangoschedulerpodsResource = v1beta1.SchemeGroupVersion.WithResource("arangoschedulerpods")
var arangoschedulerpodsKind = v1beta1.SchemeGroupVersion.WithKind("ArangoSchedulerPod")
// Get takes name of the arangoSchedulerPod, and returns the corresponding arangoSchedulerPod object, and an error if there is any.
func (c *FakeArangoSchedulerPods) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(arangoschedulerpodsResource, c.ns, name), &v1beta1.ArangoSchedulerPod{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerPod), err
}
// List takes label and field selectors, and returns the list of ArangoSchedulerPods that match those selectors.
func (c *FakeArangoSchedulerPods) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.ArangoSchedulerPodList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(arangoschedulerpodsResource, arangoschedulerpodsKind, c.ns, opts), &v1beta1.ArangoSchedulerPodList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.ArangoSchedulerPodList{ListMeta: obj.(*v1beta1.ArangoSchedulerPodList).ListMeta}
for _, item := range obj.(*v1beta1.ArangoSchedulerPodList).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 arangoSchedulerPods.
func (c *FakeArangoSchedulerPods) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(arangoschedulerpodsResource, c.ns, opts))
}
// Create takes the representation of a arangoSchedulerPod and creates it. Returns the server's representation of the arangoSchedulerPod, and an error, if there is any.
func (c *FakeArangoSchedulerPods) Create(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.CreateOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(arangoschedulerpodsResource, c.ns, arangoSchedulerPod), &v1beta1.ArangoSchedulerPod{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerPod), err
}
// Update takes the representation of a arangoSchedulerPod and updates it. Returns the server's representation of the arangoSchedulerPod, and an error, if there is any.
func (c *FakeArangoSchedulerPods) Update(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.UpdateOptions) (result *v1beta1.ArangoSchedulerPod, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(arangoschedulerpodsResource, c.ns, arangoSchedulerPod), &v1beta1.ArangoSchedulerPod{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerPod), 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 *FakeArangoSchedulerPods) UpdateStatus(ctx context.Context, arangoSchedulerPod *v1beta1.ArangoSchedulerPod, opts v1.UpdateOptions) (*v1beta1.ArangoSchedulerPod, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(arangoschedulerpodsResource, "status", c.ns, arangoSchedulerPod), &v1beta1.ArangoSchedulerPod{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerPod), err
}
// Delete takes name of the arangoSchedulerPod and deletes it. Returns an error if one occurs.
func (c *FakeArangoSchedulerPods) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteActionWithOptions(arangoschedulerpodsResource, c.ns, name, opts), &v1beta1.ArangoSchedulerPod{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeArangoSchedulerPods) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(arangoschedulerpodsResource, c.ns, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.ArangoSchedulerPodList{})
return err
}
// Patch applies the patch and returns the patched arangoSchedulerPod.
func (c *FakeArangoSchedulerPods) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.ArangoSchedulerPod, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(arangoschedulerpodsResource, c.ns, name, pt, data, subresources...), &v1beta1.ArangoSchedulerPod{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.ArangoSchedulerPod), err
}

View file

@ -36,6 +36,22 @@ func (c *FakeSchedulerV1beta1) ArangoProfiles(namespace string) v1beta1.ArangoPr
return &FakeArangoProfiles{c, namespace}
}
func (c *FakeSchedulerV1beta1) ArangoSchedulerBatchJobs(namespace string) v1beta1.ArangoSchedulerBatchJobInterface {
return &FakeArangoSchedulerBatchJobs{c, namespace}
}
func (c *FakeSchedulerV1beta1) ArangoSchedulerCronJobs(namespace string) v1beta1.ArangoSchedulerCronJobInterface {
return &FakeArangoSchedulerCronJobs{c, namespace}
}
func (c *FakeSchedulerV1beta1) ArangoSchedulerDeployments(namespace string) v1beta1.ArangoSchedulerDeploymentInterface {
return &FakeArangoSchedulerDeployments{c, namespace}
}
func (c *FakeSchedulerV1beta1) ArangoSchedulerPods(namespace string) v1beta1.ArangoSchedulerPodInterface {
return &FakeArangoSchedulerPods{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeSchedulerV1beta1) RESTClient() rest.Interface {

View file

@ -23,3 +23,11 @@
package v1beta1
type ArangoProfileExpansion interface{}
type ArangoSchedulerBatchJobExpansion interface{}
type ArangoSchedulerCronJobExpansion interface{}
type ArangoSchedulerDeploymentExpansion interface{}
type ArangoSchedulerPodExpansion interface{}

View file

@ -33,6 +33,10 @@ import (
type SchedulerV1beta1Interface interface {
RESTClient() rest.Interface
ArangoProfilesGetter
ArangoSchedulerBatchJobsGetter
ArangoSchedulerCronJobsGetter
ArangoSchedulerDeploymentsGetter
ArangoSchedulerPodsGetter
}
// SchedulerV1beta1Client is used to interact with features provided by the scheduler.arangodb.com group.
@ -44,6 +48,22 @@ func (c *SchedulerV1beta1Client) ArangoProfiles(namespace string) ArangoProfileI
return newArangoProfiles(c, namespace)
}
func (c *SchedulerV1beta1Client) ArangoSchedulerBatchJobs(namespace string) ArangoSchedulerBatchJobInterface {
return newArangoSchedulerBatchJobs(c, namespace)
}
func (c *SchedulerV1beta1Client) ArangoSchedulerCronJobs(namespace string) ArangoSchedulerCronJobInterface {
return newArangoSchedulerCronJobs(c, namespace)
}
func (c *SchedulerV1beta1Client) ArangoSchedulerDeployments(namespace string) ArangoSchedulerDeploymentInterface {
return newArangoSchedulerDeployments(c, namespace)
}
func (c *SchedulerV1beta1Client) ArangoSchedulerPods(namespace string) ArangoSchedulerPodInterface {
return newArangoSchedulerPods(c, namespace)
}
// NewForConfig creates a new SchedulerV1beta1Client for the given config.
// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
// where httpClient was generated with rest.HTTPClientFor(c).

View file

@ -137,6 +137,14 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=scheduler.arangodb.com, Version=v1beta1
case schedulerv1beta1.SchemeGroupVersion.WithResource("arangoprofiles"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduler().V1beta1().ArangoProfiles().Informer()}, nil
case schedulerv1beta1.SchemeGroupVersion.WithResource("arangoschedulerbatchjobs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduler().V1beta1().ArangoSchedulerBatchJobs().Informer()}, nil
case schedulerv1beta1.SchemeGroupVersion.WithResource("arangoschedulercronjobs"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduler().V1beta1().ArangoSchedulerCronJobs().Informer()}, nil
case schedulerv1beta1.SchemeGroupVersion.WithResource("arangoschedulerdeployments"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduler().V1beta1().ArangoSchedulerDeployments().Informer()}, nil
case schedulerv1beta1.SchemeGroupVersion.WithResource("arangoschedulerpods"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Scheduler().V1beta1().ArangoSchedulerPods().Informer()}, nil
// Group=storage.arangodb.com, Version=v1alpha
case v1alpha.SchemeGroupVersion.WithResource("arangolocalstorages"):

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 v1beta1
import (
"context"
time "time"
schedulerv1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/scheduler/v1beta1"
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"
)
// ArangoSchedulerBatchJobInformer provides access to a shared informer and lister for
// ArangoSchedulerBatchJobs.
type ArangoSchedulerBatchJobInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ArangoSchedulerBatchJobLister
}
type arangoSchedulerBatchJobInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewArangoSchedulerBatchJobInformer constructs a new informer for ArangoSchedulerBatchJob 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 NewArangoSchedulerBatchJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerBatchJobInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredArangoSchedulerBatchJobInformer constructs a new informer for ArangoSchedulerBatchJob 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 NewFilteredArangoSchedulerBatchJobInformer(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.SchedulerV1beta1().ArangoSchedulerBatchJobs(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SchedulerV1beta1().ArangoSchedulerBatchJobs(namespace).Watch(context.TODO(), options)
},
},
&schedulerv1beta1.ArangoSchedulerBatchJob{},
resyncPeriod,
indexers,
)
}
func (f *arangoSchedulerBatchJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerBatchJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *arangoSchedulerBatchJobInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&schedulerv1beta1.ArangoSchedulerBatchJob{}, f.defaultInformer)
}
func (f *arangoSchedulerBatchJobInformer) Lister() v1beta1.ArangoSchedulerBatchJobLister {
return v1beta1.NewArangoSchedulerBatchJobLister(f.Informer().GetIndexer())
}

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 v1beta1
import (
"context"
time "time"
schedulerv1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/scheduler/v1beta1"
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"
)
// ArangoSchedulerCronJobInformer provides access to a shared informer and lister for
// ArangoSchedulerCronJobs.
type ArangoSchedulerCronJobInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ArangoSchedulerCronJobLister
}
type arangoSchedulerCronJobInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewArangoSchedulerCronJobInformer constructs a new informer for ArangoSchedulerCronJob 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 NewArangoSchedulerCronJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerCronJobInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredArangoSchedulerCronJobInformer constructs a new informer for ArangoSchedulerCronJob 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 NewFilteredArangoSchedulerCronJobInformer(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.SchedulerV1beta1().ArangoSchedulerCronJobs(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SchedulerV1beta1().ArangoSchedulerCronJobs(namespace).Watch(context.TODO(), options)
},
},
&schedulerv1beta1.ArangoSchedulerCronJob{},
resyncPeriod,
indexers,
)
}
func (f *arangoSchedulerCronJobInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerCronJobInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *arangoSchedulerCronJobInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&schedulerv1beta1.ArangoSchedulerCronJob{}, f.defaultInformer)
}
func (f *arangoSchedulerCronJobInformer) Lister() v1beta1.ArangoSchedulerCronJobLister {
return v1beta1.NewArangoSchedulerCronJobLister(f.Informer().GetIndexer())
}

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 v1beta1
import (
"context"
time "time"
schedulerv1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/scheduler/v1beta1"
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"
)
// ArangoSchedulerDeploymentInformer provides access to a shared informer and lister for
// ArangoSchedulerDeployments.
type ArangoSchedulerDeploymentInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ArangoSchedulerDeploymentLister
}
type arangoSchedulerDeploymentInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewArangoSchedulerDeploymentInformer constructs a new informer for ArangoSchedulerDeployment 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 NewArangoSchedulerDeploymentInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerDeploymentInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredArangoSchedulerDeploymentInformer constructs a new informer for ArangoSchedulerDeployment 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 NewFilteredArangoSchedulerDeploymentInformer(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.SchedulerV1beta1().ArangoSchedulerDeployments(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SchedulerV1beta1().ArangoSchedulerDeployments(namespace).Watch(context.TODO(), options)
},
},
&schedulerv1beta1.ArangoSchedulerDeployment{},
resyncPeriod,
indexers,
)
}
func (f *arangoSchedulerDeploymentInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerDeploymentInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *arangoSchedulerDeploymentInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&schedulerv1beta1.ArangoSchedulerDeployment{}, f.defaultInformer)
}
func (f *arangoSchedulerDeploymentInformer) Lister() v1beta1.ArangoSchedulerDeploymentLister {
return v1beta1.NewArangoSchedulerDeploymentLister(f.Informer().GetIndexer())
}

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 v1beta1
import (
"context"
time "time"
schedulerv1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/scheduler/v1beta1"
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"
)
// ArangoSchedulerPodInformer provides access to a shared informer and lister for
// ArangoSchedulerPods.
type ArangoSchedulerPodInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.ArangoSchedulerPodLister
}
type arangoSchedulerPodInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewArangoSchedulerPodInformer constructs a new informer for ArangoSchedulerPod 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 NewArangoSchedulerPodInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerPodInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredArangoSchedulerPodInformer constructs a new informer for ArangoSchedulerPod 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 NewFilteredArangoSchedulerPodInformer(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.SchedulerV1beta1().ArangoSchedulerPods(namespace).List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.SchedulerV1beta1().ArangoSchedulerPods(namespace).Watch(context.TODO(), options)
},
},
&schedulerv1beta1.ArangoSchedulerPod{},
resyncPeriod,
indexers,
)
}
func (f *arangoSchedulerPodInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredArangoSchedulerPodInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *arangoSchedulerPodInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&schedulerv1beta1.ArangoSchedulerPod{}, f.defaultInformer)
}
func (f *arangoSchedulerPodInformer) Lister() v1beta1.ArangoSchedulerPodLister {
return v1beta1.NewArangoSchedulerPodLister(f.Informer().GetIndexer())
}

View file

@ -30,6 +30,14 @@ import (
type Interface interface {
// ArangoProfiles returns a ArangoProfileInformer.
ArangoProfiles() ArangoProfileInformer
// ArangoSchedulerBatchJobs returns a ArangoSchedulerBatchJobInformer.
ArangoSchedulerBatchJobs() ArangoSchedulerBatchJobInformer
// ArangoSchedulerCronJobs returns a ArangoSchedulerCronJobInformer.
ArangoSchedulerCronJobs() ArangoSchedulerCronJobInformer
// ArangoSchedulerDeployments returns a ArangoSchedulerDeploymentInformer.
ArangoSchedulerDeployments() ArangoSchedulerDeploymentInformer
// ArangoSchedulerPods returns a ArangoSchedulerPodInformer.
ArangoSchedulerPods() ArangoSchedulerPodInformer
}
type version struct {
@ -47,3 +55,23 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (v *version) ArangoProfiles() ArangoProfileInformer {
return &arangoProfileInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ArangoSchedulerBatchJobs returns a ArangoSchedulerBatchJobInformer.
func (v *version) ArangoSchedulerBatchJobs() ArangoSchedulerBatchJobInformer {
return &arangoSchedulerBatchJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ArangoSchedulerCronJobs returns a ArangoSchedulerCronJobInformer.
func (v *version) ArangoSchedulerCronJobs() ArangoSchedulerCronJobInformer {
return &arangoSchedulerCronJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ArangoSchedulerDeployments returns a ArangoSchedulerDeploymentInformer.
func (v *version) ArangoSchedulerDeployments() ArangoSchedulerDeploymentInformer {
return &arangoSchedulerDeploymentInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// ArangoSchedulerPods returns a ArangoSchedulerPodInformer.
func (v *version) ArangoSchedulerPods() ArangoSchedulerPodInformer {
return &arangoSchedulerPodInformer{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 v1beta1
import (
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ArangoSchedulerBatchJobLister helps list ArangoSchedulerBatchJobs.
// All objects returned here must be treated as read-only.
type ArangoSchedulerBatchJobLister interface {
// List lists all ArangoSchedulerBatchJobs in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerBatchJob, err error)
// ArangoSchedulerBatchJobs returns an object that can list and get ArangoSchedulerBatchJobs.
ArangoSchedulerBatchJobs(namespace string) ArangoSchedulerBatchJobNamespaceLister
ArangoSchedulerBatchJobListerExpansion
}
// arangoSchedulerBatchJobLister implements the ArangoSchedulerBatchJobLister interface.
type arangoSchedulerBatchJobLister struct {
indexer cache.Indexer
}
// NewArangoSchedulerBatchJobLister returns a new ArangoSchedulerBatchJobLister.
func NewArangoSchedulerBatchJobLister(indexer cache.Indexer) ArangoSchedulerBatchJobLister {
return &arangoSchedulerBatchJobLister{indexer: indexer}
}
// List lists all ArangoSchedulerBatchJobs in the indexer.
func (s *arangoSchedulerBatchJobLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerBatchJob, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerBatchJob))
})
return ret, err
}
// ArangoSchedulerBatchJobs returns an object that can list and get ArangoSchedulerBatchJobs.
func (s *arangoSchedulerBatchJobLister) ArangoSchedulerBatchJobs(namespace string) ArangoSchedulerBatchJobNamespaceLister {
return arangoSchedulerBatchJobNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ArangoSchedulerBatchJobNamespaceLister helps list and get ArangoSchedulerBatchJobs.
// All objects returned here must be treated as read-only.
type ArangoSchedulerBatchJobNamespaceLister interface {
// List lists all ArangoSchedulerBatchJobs in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerBatchJob, err error)
// Get retrieves the ArangoSchedulerBatchJob from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ArangoSchedulerBatchJob, error)
ArangoSchedulerBatchJobNamespaceListerExpansion
}
// arangoSchedulerBatchJobNamespaceLister implements the ArangoSchedulerBatchJobNamespaceLister
// interface.
type arangoSchedulerBatchJobNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ArangoSchedulerBatchJobs in the indexer for a given namespace.
func (s arangoSchedulerBatchJobNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerBatchJob, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerBatchJob))
})
return ret, err
}
// Get retrieves the ArangoSchedulerBatchJob from the indexer for a given namespace and name.
func (s arangoSchedulerBatchJobNamespaceLister) Get(name string) (*v1beta1.ArangoSchedulerBatchJob, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("arangoschedulerbatchjob"), name)
}
return obj.(*v1beta1.ArangoSchedulerBatchJob), nil
}

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 v1beta1
import (
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ArangoSchedulerCronJobLister helps list ArangoSchedulerCronJobs.
// All objects returned here must be treated as read-only.
type ArangoSchedulerCronJobLister interface {
// List lists all ArangoSchedulerCronJobs in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerCronJob, err error)
// ArangoSchedulerCronJobs returns an object that can list and get ArangoSchedulerCronJobs.
ArangoSchedulerCronJobs(namespace string) ArangoSchedulerCronJobNamespaceLister
ArangoSchedulerCronJobListerExpansion
}
// arangoSchedulerCronJobLister implements the ArangoSchedulerCronJobLister interface.
type arangoSchedulerCronJobLister struct {
indexer cache.Indexer
}
// NewArangoSchedulerCronJobLister returns a new ArangoSchedulerCronJobLister.
func NewArangoSchedulerCronJobLister(indexer cache.Indexer) ArangoSchedulerCronJobLister {
return &arangoSchedulerCronJobLister{indexer: indexer}
}
// List lists all ArangoSchedulerCronJobs in the indexer.
func (s *arangoSchedulerCronJobLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerCronJob, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerCronJob))
})
return ret, err
}
// ArangoSchedulerCronJobs returns an object that can list and get ArangoSchedulerCronJobs.
func (s *arangoSchedulerCronJobLister) ArangoSchedulerCronJobs(namespace string) ArangoSchedulerCronJobNamespaceLister {
return arangoSchedulerCronJobNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ArangoSchedulerCronJobNamespaceLister helps list and get ArangoSchedulerCronJobs.
// All objects returned here must be treated as read-only.
type ArangoSchedulerCronJobNamespaceLister interface {
// List lists all ArangoSchedulerCronJobs in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerCronJob, err error)
// Get retrieves the ArangoSchedulerCronJob from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ArangoSchedulerCronJob, error)
ArangoSchedulerCronJobNamespaceListerExpansion
}
// arangoSchedulerCronJobNamespaceLister implements the ArangoSchedulerCronJobNamespaceLister
// interface.
type arangoSchedulerCronJobNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ArangoSchedulerCronJobs in the indexer for a given namespace.
func (s arangoSchedulerCronJobNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerCronJob, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerCronJob))
})
return ret, err
}
// Get retrieves the ArangoSchedulerCronJob from the indexer for a given namespace and name.
func (s arangoSchedulerCronJobNamespaceLister) Get(name string) (*v1beta1.ArangoSchedulerCronJob, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("arangoschedulercronjob"), name)
}
return obj.(*v1beta1.ArangoSchedulerCronJob), nil
}

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 v1beta1
import (
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ArangoSchedulerDeploymentLister helps list ArangoSchedulerDeployments.
// All objects returned here must be treated as read-only.
type ArangoSchedulerDeploymentLister interface {
// List lists all ArangoSchedulerDeployments in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerDeployment, err error)
// ArangoSchedulerDeployments returns an object that can list and get ArangoSchedulerDeployments.
ArangoSchedulerDeployments(namespace string) ArangoSchedulerDeploymentNamespaceLister
ArangoSchedulerDeploymentListerExpansion
}
// arangoSchedulerDeploymentLister implements the ArangoSchedulerDeploymentLister interface.
type arangoSchedulerDeploymentLister struct {
indexer cache.Indexer
}
// NewArangoSchedulerDeploymentLister returns a new ArangoSchedulerDeploymentLister.
func NewArangoSchedulerDeploymentLister(indexer cache.Indexer) ArangoSchedulerDeploymentLister {
return &arangoSchedulerDeploymentLister{indexer: indexer}
}
// List lists all ArangoSchedulerDeployments in the indexer.
func (s *arangoSchedulerDeploymentLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerDeployment, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerDeployment))
})
return ret, err
}
// ArangoSchedulerDeployments returns an object that can list and get ArangoSchedulerDeployments.
func (s *arangoSchedulerDeploymentLister) ArangoSchedulerDeployments(namespace string) ArangoSchedulerDeploymentNamespaceLister {
return arangoSchedulerDeploymentNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ArangoSchedulerDeploymentNamespaceLister helps list and get ArangoSchedulerDeployments.
// All objects returned here must be treated as read-only.
type ArangoSchedulerDeploymentNamespaceLister interface {
// List lists all ArangoSchedulerDeployments in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerDeployment, err error)
// Get retrieves the ArangoSchedulerDeployment from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ArangoSchedulerDeployment, error)
ArangoSchedulerDeploymentNamespaceListerExpansion
}
// arangoSchedulerDeploymentNamespaceLister implements the ArangoSchedulerDeploymentNamespaceLister
// interface.
type arangoSchedulerDeploymentNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ArangoSchedulerDeployments in the indexer for a given namespace.
func (s arangoSchedulerDeploymentNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerDeployment, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerDeployment))
})
return ret, err
}
// Get retrieves the ArangoSchedulerDeployment from the indexer for a given namespace and name.
func (s arangoSchedulerDeploymentNamespaceLister) Get(name string) (*v1beta1.ArangoSchedulerDeployment, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("arangoschedulerdeployment"), name)
}
return obj.(*v1beta1.ArangoSchedulerDeployment), nil
}

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 v1beta1
import (
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// ArangoSchedulerPodLister helps list ArangoSchedulerPods.
// All objects returned here must be treated as read-only.
type ArangoSchedulerPodLister interface {
// List lists all ArangoSchedulerPods in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerPod, err error)
// ArangoSchedulerPods returns an object that can list and get ArangoSchedulerPods.
ArangoSchedulerPods(namespace string) ArangoSchedulerPodNamespaceLister
ArangoSchedulerPodListerExpansion
}
// arangoSchedulerPodLister implements the ArangoSchedulerPodLister interface.
type arangoSchedulerPodLister struct {
indexer cache.Indexer
}
// NewArangoSchedulerPodLister returns a new ArangoSchedulerPodLister.
func NewArangoSchedulerPodLister(indexer cache.Indexer) ArangoSchedulerPodLister {
return &arangoSchedulerPodLister{indexer: indexer}
}
// List lists all ArangoSchedulerPods in the indexer.
func (s *arangoSchedulerPodLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerPod, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerPod))
})
return ret, err
}
// ArangoSchedulerPods returns an object that can list and get ArangoSchedulerPods.
func (s *arangoSchedulerPodLister) ArangoSchedulerPods(namespace string) ArangoSchedulerPodNamespaceLister {
return arangoSchedulerPodNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ArangoSchedulerPodNamespaceLister helps list and get ArangoSchedulerPods.
// All objects returned here must be treated as read-only.
type ArangoSchedulerPodNamespaceLister interface {
// List lists all ArangoSchedulerPods in the indexer for a given namespace.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerPod, err error)
// Get retrieves the ArangoSchedulerPod from the indexer for a given namespace and name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.ArangoSchedulerPod, error)
ArangoSchedulerPodNamespaceListerExpansion
}
// arangoSchedulerPodNamespaceLister implements the ArangoSchedulerPodNamespaceLister
// interface.
type arangoSchedulerPodNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ArangoSchedulerPods in the indexer for a given namespace.
func (s arangoSchedulerPodNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.ArangoSchedulerPod, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.ArangoSchedulerPod))
})
return ret, err
}
// Get retrieves the ArangoSchedulerPod from the indexer for a given namespace and name.
func (s arangoSchedulerPodNamespaceLister) Get(name string) (*v1beta1.ArangoSchedulerPod, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("arangoschedulerpod"), name)
}
return obj.(*v1beta1.ArangoSchedulerPod), nil
}

View file

@ -29,3 +29,35 @@ type ArangoProfileListerExpansion interface{}
// ArangoProfileNamespaceListerExpansion allows custom methods to be added to
// ArangoProfileNamespaceLister.
type ArangoProfileNamespaceListerExpansion interface{}
// ArangoSchedulerBatchJobListerExpansion allows custom methods to be added to
// ArangoSchedulerBatchJobLister.
type ArangoSchedulerBatchJobListerExpansion interface{}
// ArangoSchedulerBatchJobNamespaceListerExpansion allows custom methods to be added to
// ArangoSchedulerBatchJobNamespaceLister.
type ArangoSchedulerBatchJobNamespaceListerExpansion interface{}
// ArangoSchedulerCronJobListerExpansion allows custom methods to be added to
// ArangoSchedulerCronJobLister.
type ArangoSchedulerCronJobListerExpansion interface{}
// ArangoSchedulerCronJobNamespaceListerExpansion allows custom methods to be added to
// ArangoSchedulerCronJobNamespaceLister.
type ArangoSchedulerCronJobNamespaceListerExpansion interface{}
// ArangoSchedulerDeploymentListerExpansion allows custom methods to be added to
// ArangoSchedulerDeploymentLister.
type ArangoSchedulerDeploymentListerExpansion interface{}
// ArangoSchedulerDeploymentNamespaceListerExpansion allows custom methods to be added to
// ArangoSchedulerDeploymentNamespaceLister.
type ArangoSchedulerDeploymentNamespaceListerExpansion interface{}
// ArangoSchedulerPodListerExpansion allows custom methods to be added to
// ArangoSchedulerPodLister.
type ArangoSchedulerPodListerExpansion interface{}
// ArangoSchedulerPodNamespaceListerExpansion allows custom methods to be added to
// ArangoSchedulerPodNamespaceLister.
type ArangoSchedulerPodNamespaceListerExpansion interface{}

View file

@ -0,0 +1,114 @@
//
// 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 parent
import (
"context"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"github.com/arangodb/kube-arangodb/pkg/logging"
operator "github.com/arangodb/kube-arangodb/pkg/operatorV2"
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/generic"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
)
var logger = logging.Global().RegisterAndGetLogger("generic-parent-operator", logging.Info)
type NotifyHandlerClientFactory[T meta.Object, C NotifyHandlerClient[T]] func(namespace string) C
type NotifyHandlerClient[T meta.Object] interface {
generic.GetInterface[T]
}
func NewNotifyHandler[T meta.Object, C NotifyHandlerClient[T]](name string, operator operator.Operator, client NotifyHandlerClientFactory[T, C], gvk schema.GroupVersionKind, notifiable ...schema.GroupVersionKind) operator.Handler {
return notifyHandler[T, C]{
name: name,
client: client,
gvk: gvk,
operator: operator,
notifiable: notifiable,
}
}
type notifyHandler[T meta.Object, C NotifyHandlerClient[T]] struct {
operator operator.Operator
name string
client NotifyHandlerClientFactory[T, C]
gvk schema.GroupVersionKind
notifiable []schema.GroupVersionKind
}
func (p notifyHandler[T, C]) Name() string {
return p.name
}
func (p notifyHandler[T, C]) Handle(ctx context.Context, item operation.Item) error {
logger := logger.WrapObj(item)
if item.Operation == operation.Update {
obj, err := p.client(item.Namespace).Get(ctx, item.Name, meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
logger.Debug("Not Found")
return nil
}
logger.Err(err).Warn("Unexpected Error")
return err
}
for _, owner := range obj.GetOwnerReferences() {
if i, err := operation.NewItemFromGVKObject(item.Operation, schema.FromAPIVersionAndKind(owner.APIVersion, owner.Kind), obj); err == nil {
if p.isNotifiable(i) {
logger.Debug("Parent notified")
p.operator.EnqueueItem(i)
} else {
logger.Debug("Parent notify skipped")
}
}
}
}
return nil
}
func (p notifyHandler[T, C]) isNotifiable(i operation.Item) bool {
for _, g := range p.notifiable {
if version := g.Version; version != "" && version != i.Version {
continue
}
if kind := g.Kind; kind != "" && kind != i.Kind {
continue
}
if group := g.Group; group != "" && group != i.Group {
continue
}
return true
}
return false
}
func (p notifyHandler[T, C]) CanBeHandled(item operation.Item) bool {
return item.GVK(p.gvk)
}

View file

@ -0,0 +1,228 @@
//
// 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 batchjob
import (
"context"
"fmt"
batch "k8s.io/api/batch/v1"
"k8s.io/apimachinery/pkg/api/equality"
apiErrors "k8s.io/apimachinery/pkg/api/errors"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
"github.com/arangodb/kube-arangodb/pkg/deployment/patch"
arangoClientSet "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
"github.com/arangodb/kube-arangodb/pkg/logging"
operator "github.com/arangodb/kube-arangodb/pkg/operatorV2"
"github.com/arangodb/kube-arangodb/pkg/operatorV2/event"
"github.com/arangodb/kube-arangodb/pkg/operatorV2/operation"
"github.com/arangodb/kube-arangodb/pkg/scheduler"
"github.com/arangodb/kube-arangodb/pkg/util"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/patcher"
)
var logger = logging.Global().RegisterAndGetLogger("scheduler-batchjob-operator", logging.Info)
type handler struct {
client arangoClientSet.Interface
kubeClient kubernetes.Interface
eventRecorder event.RecorderInstance
operator operator.Operator
}
func (h *handler) Name() string {
return Kind()
}
func (h *handler) Handle(ctx context.Context, item operation.Item) error {
// Get Backup object. It also covers NotFound case
object, err := util.WithKubernetesContextTimeoutP2A2(ctx, h.client.SchedulerV1beta1().ArangoSchedulerBatchJobs(item.Namespace).Get, item.Name, meta.GetOptions{})
if err != nil {
if apiErrors.IsNotFound(err) {
return nil
}
return err
}
status := object.Status.DeepCopy()
changed, reconcileErr := operator.HandleP3WithStop(ctx, item, object, status, h.handle)
if reconcileErr != nil && !operator.IsReconcile(reconcileErr) {
logger.Err(reconcileErr).Warn("Fail for %s %s/%s",
item.Kind,
item.Namespace,
item.Name)
return reconcileErr
}
if !changed {
return reconcileErr
}
logger.Debug("Updating %s %s/%s",
item.Kind,
item.Namespace,
item.Name)
if _, err := operator.WithSchedulerBatchJobUpdateStatusInterfaceRetry(context.Background(), h.client.SchedulerV1beta1().ArangoSchedulerBatchJobs(object.GetNamespace()), object, *status, meta.UpdateOptions{}); err != nil {
return err
}
return reconcileErr
}
func (h *handler) handle(ctx context.Context, item operation.Item, extension *schedulerApi.ArangoSchedulerBatchJob, status *schedulerApi.ArangoSchedulerBatchJobStatus) (bool, error) {
return operator.HandleP3(ctx, item, extension, status, h.HandleObject)
}
func (h *handler) HandleObject(ctx context.Context, item operation.Item, extension *schedulerApi.ArangoSchedulerBatchJob, status *schedulerApi.ArangoSchedulerBatchJobStatus) (bool, error) {
calculatedProfiles, profilesChecksum, err := scheduler.Profiles(ctx, h.client.SchedulerV1beta1().ArangoProfiles(extension.GetNamespace()), extension.GetLabels(), extension.Spec.Profiles...)
if err != nil {
return false, err
}
var batchJobTemplate batch.Job
batchJobTemplate.ObjectMeta = meta.ObjectMeta{
Name: extension.ObjectMeta.Name,
Labels: extension.ObjectMeta.Labels,
Annotations: extension.ObjectMeta.Annotations,
}
extension.Spec.JobSpec.DeepCopyInto(&batchJobTemplate.Spec)
deploymentSpecHash, err := util.SHA256FromJSON(batchJobTemplate)
if err != nil {
return false, err
}
hash := util.SHA256FromString(fmt.Sprintf("%s|%s", profilesChecksum, deploymentSpecHash))
if err := schedulerApi.ProfileTemplates(util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) *schedulerApi.ProfileTemplate {
return a.V.Template
})).RenderOnTemplate(&batchJobTemplate.Spec.Template); err != nil {
return false, err
}
if status.Object == nil {
// Create
obj := &batch.Job{}
obj.ObjectMeta = meta.ObjectMeta{
Name: extension.ObjectMeta.Name,
Labels: extension.ObjectMeta.Labels,
Annotations: extension.ObjectMeta.Annotations,
}
batchJobTemplate.Spec.DeepCopyInto(&obj.Spec)
obj.OwnerReferences = append(obj.OwnerReferences, extension.AsOwner())
newObj, err := h.kubeClient.BatchV1().Jobs(extension.GetNamespace()).Create(ctx, obj, meta.CreateOptions{})
if err != nil {
h.eventRecorder.Warning(extension, "Create Failed", "Unable to create Job: %s", err.Error())
return false, err
}
h.eventRecorder.Normal(extension, "Created", "Job %s created", newObj.GetName())
status.Object = util.NewType(sharedApi.NewObjectWithChecksum(newObj, hash))
return true, operator.Reconcile("Job Reference Changed")
}
// Find existing
obj, err := h.kubeClient.BatchV1().Jobs(status.Object.GetNamespace(extension)).Get(ctx, status.Object.GetName(), meta.GetOptions{})
if err != nil {
if kerrors.IsNotFound(err) {
// Object removed
h.eventRecorder.Warning(extension, "Removed", "Job %s is gone", status.Object.GetName())
status.Object = nil
return true, operator.Reconcile("Job Reference Removed")
}
return false, err
}
profileNames := util.FormatList(calculatedProfiles, func(a util.KV[string, schedulerApi.ProfileAcceptedTemplate]) string {
return a.K
})
// Try to fetch status
if !equality.Semantic.DeepEqual(status.Profiles, profileNames) {
status.Profiles = profileNames
return true, operator.Reconcile("Status Changed")
}
// Try to fetch status
if !equality.Semantic.DeepEqual(status.JobStatus, obj.Status) {
obj.Status.DeepCopyInto(&status.JobStatus)
return true, operator.Reconcile("Status Changed")
}
if obj.GetDeletionTimestamp() != nil {
// Object is deleting, check later
return false, operator.Reconcile("Job Deleting")
}
if !status.Object.Equals(obj) {
// Object changed or was recreated
h.eventRecorder.Warning(extension, "Removed", "Job %s reference is invalid", status.Object.GetName())
if err := h.kubeClient.BatchV1().Jobs(status.Object.GetNamespace(extension)).Delete(ctx, status.Object.GetName(), meta.DeleteOptions{}); err != nil {
return false, err
}
return false, operator.Reconcile("Job Deleted")
}
// Object is equal, lets check if changed
if hash != status.Object.GetChecksum() {
// Checksum changed, lets apply changes
_, _, err := patcher.Patcher[*batch.Job](ctx, h.kubeClient.BatchV1().Jobs(status.Object.GetNamespace(extension)), obj, meta.PatchOptions{}, func(in *batch.Job) []patch.Item {
return []patch.Item{
patch.ItemReplace(patch.NewPath("spec"), batchJobTemplate.Spec),
}
}, patcher.PatchMetadata(obj))
if err != nil {
h.eventRecorder.Warning(extension, "Patch Failed", "Unable to patch Job: %s", err.Error())
return false, err
}
h.eventRecorder.Normal(extension, "Updated", "Job %s patched", obj.GetName())
status.Object.Checksum = util.NewType(hash)
return true, nil
}
return false, nil
}
func (h *handler) CanBeHandled(item operation.Item) bool {
return item.Group == Group() &&
item.Version == Version() &&
item.Kind == Kind()
}
func (h *handler) init() {}

Some files were not shown because too many files have changed in this diff Show more