Matteo Scandolo | a428586 | 2020-12-01 18:10:10 -0800 | [diff] [blame^] | 1 | /* |
| 2 | Copyright 2017 The Kubernetes Authors. |
| 3 | |
| 4 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | you may not use this file except in compliance with the License. |
| 6 | You may obtain a copy of the License at |
| 7 | |
| 8 | http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | |
| 10 | Unless required by applicable law or agreed to in writing, software |
| 11 | distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | See the License for the specific language governing permissions and |
| 14 | limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package v1alpha1 |
| 18 | |
| 19 | import ( |
| 20 | "k8s.io/api/core/v1" |
| 21 | metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | ) |
| 23 | |
| 24 | // +genclient |
| 25 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 26 | |
| 27 | // PodPreset is a policy resource that defines additional runtime |
| 28 | // requirements for a Pod. |
| 29 | type PodPreset struct { |
| 30 | metav1.TypeMeta `json:",inline"` |
| 31 | // +optional |
| 32 | metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 33 | |
| 34 | // +optional |
| 35 | Spec PodPresetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` |
| 36 | } |
| 37 | |
| 38 | // PodPresetSpec is a description of a pod preset. |
| 39 | type PodPresetSpec struct { |
| 40 | // Selector is a label query over a set of resources, in this case pods. |
| 41 | // Required. |
| 42 | Selector metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,1,opt,name=selector"` |
| 43 | |
| 44 | // Env defines the collection of EnvVar to inject into containers. |
| 45 | // +optional |
| 46 | Env []v1.EnvVar `json:"env,omitempty" protobuf:"bytes,2,rep,name=env"` |
| 47 | // EnvFrom defines the collection of EnvFromSource to inject into containers. |
| 48 | // +optional |
| 49 | EnvFrom []v1.EnvFromSource `json:"envFrom,omitempty" protobuf:"bytes,3,rep,name=envFrom"` |
| 50 | // Volumes defines the collection of Volume to inject into the pod. |
| 51 | // +optional |
| 52 | Volumes []v1.Volume `json:"volumes,omitempty" protobuf:"bytes,4,rep,name=volumes"` |
| 53 | // VolumeMounts defines the collection of VolumeMount to inject into containers. |
| 54 | // +optional |
| 55 | VolumeMounts []v1.VolumeMount `json:"volumeMounts,omitempty" protobuf:"bytes,5,rep,name=volumeMounts"` |
| 56 | } |
| 57 | |
| 58 | // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 59 | |
| 60 | // PodPresetList is a list of PodPreset objects. |
| 61 | type PodPresetList struct { |
| 62 | metav1.TypeMeta `json:",inline"` |
| 63 | // Standard list metadata. |
| 64 | // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata |
| 65 | // +optional |
| 66 | metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` |
| 67 | |
| 68 | // Items is a list of schema objects. |
| 69 | Items []PodPreset `json:"items" protobuf:"bytes,2,rep,name=items"` |
| 70 | } |