k8s.io/apiserver@v0.31.1/pkg/apis/example/types.go (about) 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 example 18 19 import ( 20 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 21 ) 22 23 type ( 24 ConditionStatus string 25 PodConditionType string 26 PodPhase string 27 RestartPolicy string 28 ) 29 30 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 31 32 // Pod is a collection of containers, used as either input (create, update) or as output (list, get). 33 type Pod struct { 34 metav1.TypeMeta 35 // +optional 36 metav1.ObjectMeta 37 38 // Spec defines the behavior of a pod. 39 // +optional 40 Spec PodSpec 41 42 // Status represents the current information about a pod. This data may not be up 43 // to date. 44 // +optional 45 Status PodStatus 46 } 47 48 // PodStatus represents information about the status of a pod. Status may trail the actual 49 // state of a system. 50 type PodStatus struct { 51 // +optional 52 Phase PodPhase 53 // +optional 54 Conditions []PodCondition 55 // A human readable message indicating details about why the pod is in this state. 56 // +optional 57 Message string 58 // A brief CamelCase message indicating details about why the pod is in this state. e.g. 'DiskPressure' 59 // +optional 60 Reason string 61 62 // +optional 63 HostIP string 64 // +optional 65 PodIP 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 pod. 69 // +optional 70 StartTime *metav1.Time 71 } 72 73 type PodCondition struct { 74 Type PodConditionType 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 // PodSpec is a description of a pod 87 type PodSpec struct { 88 // +optional 89 RestartPolicy RestartPolicy 90 // Optional duration in seconds the pod 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 pod 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 pod may be active on a node 99 // before the system actively tries to terminate the pod; value must be positive integer 100 // +optional 101 ActiveDeadlineSeconds *int64 102 // NodeSelector is a selector which must be true for the pod 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 pod 107 // The pod will be allowed to use secrets referenced by the ServiceAccount 108 ServiceAccountName string 109 110 // NodeName is a request to schedule this pod onto a specific node. If it is non-empty, 111 // the scheduler simply schedules this pod onto that node, assuming that it fits resource 112 // requirements. 113 // +optional 114 NodeName string 115 // Specifies the hostname of the Pod. 116 // If not specified, the pod's hostname will be set to a system-defined value. 117 // +optional 118 Hostname string 119 // If specified, the fully qualified Pod hostname will be "<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>". 120 // If not specified, the pod will not have a domainname at all. 121 // +optional 122 Subdomain string 123 // If specified, the pod will be dispatched by specified scheduler. 124 // If not specified, the pod 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 // PodList is a list of Pods. 132 type PodList struct { 133 metav1.TypeMeta 134 // +optional 135 metav1.ListMeta 136 137 Items []Pod 138 } 139 140 // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object 141 142 // ReplicaSet ensures that a specified number of pod replicas are running at any given time. 143 type ReplicaSet struct { 144 metav1.TypeMeta 145 // +optional 146 metav1.ObjectMeta 147 148 // Spec defines the desired behavior of this ReplicaSet. 149 // +optional 150 Spec ReplicaSetSpec 151 152 // Status is the current status of this ReplicaSet. This data may be 153 // out of date by some window of time. 154 // +optional 155 Status ReplicaSetStatus 156 } 157 158 // ReplicaSetSpec is the specification of a ReplicaSet. 159 // As the internal representation of a ReplicaSet, it must have 160 // a Template set. 161 type ReplicaSetSpec struct { 162 // Replicas is the number of desired replicas. 163 Replicas int32 164 } 165 166 // ReplicaSetStatus represents the current status of a ReplicaSet. 167 type ReplicaSetStatus struct { 168 // Replicas is the number of actual replicas. 169 Replicas int32 170 }