blob: 8cc99d440d4c87d2f41da9535be71363a3f9780e [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001/*
2Copyright 2017 The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17package v1alpha1
18
19import (
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.
29type 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.
39type 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.
61type 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}