|
| 1 | +// |
| 2 | +// DISCLAIMER |
| 3 | +// |
| 4 | +// Copyright 2016-2021 ArangoDB GmbH, Cologne, Germany |
| 5 | +// |
| 6 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +// you may not use this file except in compliance with the License. |
| 8 | +// You may obtain a copy of the License at |
| 9 | +// |
| 10 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +// |
| 12 | +// Unless required by applicable law or agreed to in writing, software |
| 13 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +// See the License for the specific language governing permissions and |
| 16 | +// limitations under the License. |
| 17 | +// |
| 18 | +// Copyright holder is ArangoDB GmbH, Cologne, Germany |
| 19 | +// |
| 20 | +// Author Jakub Wierzbowski |
| 21 | +// |
| 22 | + |
| 23 | +package v1 |
| 24 | + |
| 25 | +import ( |
| 26 | + "github.com/arangodb/kube-arangodb/pkg/apis/apps" |
| 27 | + |
| 28 | + batchv1 "k8s.io/api/batch/v1" |
| 29 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 30 | +) |
| 31 | + |
| 32 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 33 | + |
| 34 | +// ArangoJobList is a list of ArangoDB jobs. |
| 35 | +type ArangoJobList struct { |
| 36 | + metav1.TypeMeta `json:",inline"` |
| 37 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 38 | + |
| 39 | + Items []ArangoJob `json:"items"` |
| 40 | +} |
| 41 | + |
| 42 | +// +genclient |
| 43 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 44 | + |
| 45 | +// ArangoJob contains definition and status of the ArangoDB type Job. |
| 46 | +type ArangoJob struct { |
| 47 | + metav1.TypeMeta `json:",inline"` |
| 48 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 49 | + Spec ArangoJobSpec `json:"spec,omitempty"` |
| 50 | + Status batchv1.JobStatus `json:"status,omitempty"` |
| 51 | +} |
| 52 | + |
| 53 | +// AsOwner creates an OwnerReference for the given job |
| 54 | +func (a *ArangoJob) AsOwner() metav1.OwnerReference { |
| 55 | + trueVar := true |
| 56 | + return metav1.OwnerReference{ |
| 57 | + APIVersion: SchemeGroupVersion.String(), |
| 58 | + Kind: apps.ArangoJobResourceKind, |
| 59 | + Name: a.Name, |
| 60 | + UID: a.UID, |
| 61 | + Controller: &trueVar, |
| 62 | + } |
| 63 | +} |
0 commit comments