1/*
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 testapigroup
18
19import (
20	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21)
22
23type (
24	ConditionStatus   string
25	CarpConditionType string
26	CarpPhase         string
27	RestartPolicy     string
28)
29
30// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
31
32// Carp is a collection of containers, used as either input (create, update) or as output (list, get).
33type Carp struct {
34	metav1.TypeMeta
35	// +optional
36	metav1.ObjectMeta
37
38	// Spec defines the behavior of a carp.
39	// +optional
40	Spec CarpSpec
41
42	// Status represents the current information about a carp. This data may not be up
43	// to date.
44	// +optional
45	Status CarpStatus
46}
47
48// CarpStatus represents information about the status of a carp. Status may trail the actual
49// state of a system.
50type CarpStatus struct {
51	// +optional
52	Phase CarpPhase
53	// +optional
54	Conditions []CarpCondition
55	// A human readable message indicating details about why the carp is in this state.
56	// +optional
57	Message string
58	// A brief CamelCase message indicating details about why the carp is in this state. e.g. 'DiskPressure'
59	// +optional
60	Reason string
61
62	// +optional
63	HostIP string
64	// +optional
65	CarpIP string
66
67	// Date and time at which the object was acknowledged by the Kubelet.
68	// This is before the Kubelet pulled the container image(s) for the carp.
69	// +optional
70	StartTime *metav1.Time
71}
72
73type CarpCondition struct {
74	Type   CarpConditionType
75	Status ConditionStatus
76	// +optional
77	LastProbeTime metav1.Time
78	// +optional
79	LastTransitionTime metav1.Time
80	// +optional
81	Reason string
82	// +optional
83	Message string
84}
85
86// CarpSpec is a description of a carp
87type CarpSpec struct {
88	// +optional
89	RestartPolicy RestartPolicy
90	// Optional duration in seconds the carp needs to terminate gracefully. May be decreased in delete request.
91	// Value must be non-negative integer. The value zero indicates delete immediately.
92	// If this value is nil, the default grace period will be used instead.
93	// The grace period is the duration in seconds after the processes running in the carp are sent
94	// a termination signal and the time when the processes are forcibly halted with a kill signal.
95	// Set this value longer than the expected cleanup time for your process.
96	// +optional
97	TerminationGracePeriodSeconds *int64
98	// Optional duration in seconds relative to the StartTime that the carp may be active on a node
99	// before the system actively tries to terminate the carp; value must be positive integer
100	// +optional
101	ActiveDeadlineSeconds *int64
102	// NodeSelector is a selector which must be true for the carp to fit on a node
103	// +optional
104	NodeSelector map[string]string
105
106	// ServiceAccountName is the name of the ServiceAccount to use to run this carp
107	// The carp will be allowed to use secrets referenced by the ServiceAccount
108	ServiceAccountName string
109
110	// NodeName is a request to schedule this carp onto a specific node.  If it is non-empty,
111	// the scheduler simply schedules this carp onto that node, assuming that it fits resource
112	// requirements.
113	// +optional
114	NodeName string
115	// Specifies the hostname of the Carp.
116	// If not specified, the carp's hostname will be set to a system-defined value.
117	// +optional
118	Hostname string
119	// If specified, the fully qualified Carp hostname will be "<hostname>.<subdomain>.<carp namespace>.svc.<cluster domain>".
120	// If not specified, the carp will not have a domainname at all.
121	// +optional
122	Subdomain string
123	// If specified, the carp will be dispatched by specified scheduler.
124	// If not specified, the carp will be dispatched by default scheduler.
125	// +optional
126	SchedulerName string
127}
128
129// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
130
131// CarpList is a list of Carps.
132type CarpList struct {
133	metav1.TypeMeta
134	// +optional
135	metav1.ListMeta
136
137	Items []Carp
138}
139