blob: 7d802b9446749171df24f06aaf63c12345dc98fa [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001/*
2Copyright 2015 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 v1beta1
18
19import (
20 appsv1beta1 "k8s.io/api/apps/v1beta1"
21 v1 "k8s.io/api/core/v1"
22 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23 "k8s.io/apimachinery/pkg/util/intstr"
24)
25
26// describes the attributes of a scale subresource
27type ScaleSpec struct {
28 // desired number of instances for the scaled object.
29 // +optional
30 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
31}
32
33// represents the current status of a scale subresource.
34type ScaleStatus struct {
35 // actual number of observed instances of the scaled object.
36 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
37
38 // label query over pods that should match the replicas count. More info: http://kubernetes.io/docs/user-guide/labels#label-selectors
39 // +optional
40 Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"`
41
42 // label selector for pods that should match the replicas count. This is a serializated
43 // version of both map-based and more expressive set-based selectors. This is done to
44 // avoid introspection in the clients. The string will be in the same format as the
45 // query-param syntax. If the target type only supports map-based selectors, both this
46 // field and map-based selector field are populated.
47 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
48 // +optional
49 TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
50}
51
52// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
53
54// represents a scaling request for a resource.
55type Scale struct {
56 metav1.TypeMeta `json:",inline"`
57 // Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
58 // +optional
59 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
60
61 // defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
62 // +optional
63 Spec ScaleSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
64
65 // current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only.
66 // +optional
67 Status ScaleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
68}
69
70// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
71
72// Dummy definition
73type ReplicationControllerDummy struct {
74 metav1.TypeMeta `json:",inline"`
75}
76
77// +genclient
78// +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
79// +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
80// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
81
82// DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for
83// more information.
84// Deployment enables declarative updates for Pods and ReplicaSets.
85type Deployment struct {
86 metav1.TypeMeta `json:",inline"`
87 // Standard object metadata.
88 // +optional
89 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
90
91 // Specification of the desired behavior of the Deployment.
92 // +optional
93 Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
94
95 // Most recently observed status of the Deployment.
96 // +optional
97 Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
98}
99
100// DeploymentSpec is the specification of the desired behavior of the Deployment.
101type DeploymentSpec struct {
102 // Number of desired pods. This is a pointer to distinguish between explicit
103 // zero and not specified. Defaults to 1.
104 // +optional
105 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
106
107 // Label selector for pods. Existing ReplicaSets whose pods are
108 // selected by this will be the ones affected by this deployment.
109 // +optional
110 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
111
112 // Template describes the pods that will be created.
113 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
114
115 // The deployment strategy to use to replace existing pods with new ones.
116 // +optional
117 // +patchStrategy=retainKeys
118 Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
119
120 // Minimum number of seconds for which a newly created pod should be ready
121 // without any of its container crashing, for it to be considered available.
122 // Defaults to 0 (pod will be considered available as soon as it is ready)
123 // +optional
124 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,5,opt,name=minReadySeconds"`
125
126 // The number of old ReplicaSets to retain to allow rollback.
127 // This is a pointer to distinguish between explicit zero and not specified.
128 // This is set to the max value of int32 (i.e. 2147483647) by default, which
129 // means "retaining all old RelicaSets".
130 // +optional
131 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
132
133 // Indicates that the deployment is paused and will not be processed by the
134 // deployment controller.
135 // +optional
136 Paused bool `json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"`
137
138 // DEPRECATED.
139 // The config this deployment is rolling back to. Will be cleared after rollback is done.
140 // +optional
141 RollbackTo *RollbackConfig `json:"rollbackTo,omitempty" protobuf:"bytes,8,opt,name=rollbackTo"`
142
143 // The maximum time in seconds for a deployment to make progress before it
144 // is considered to be failed. The deployment controller will continue to
145 // process failed deployments and a condition with a ProgressDeadlineExceeded
146 // reason will be surfaced in the deployment status. Note that progress will
147 // not be estimated during the time a deployment is paused. This is set to
148 // the max value of int32 (i.e. 2147483647) by default, which means "no deadline".
149 // +optional
150 ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"`
151}
152
153// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
154
155// DEPRECATED.
156// DeploymentRollback stores the information required to rollback a deployment.
157type DeploymentRollback struct {
158 metav1.TypeMeta `json:",inline"`
159 // Required: This must match the Name of a deployment.
160 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
161 // The annotations to be updated to a deployment
162 // +optional
163 UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty" protobuf:"bytes,2,rep,name=updatedAnnotations"`
164 // The config of this deployment rollback.
165 RollbackTo RollbackConfig `json:"rollbackTo" protobuf:"bytes,3,opt,name=rollbackTo"`
166}
167
168// DEPRECATED.
169type RollbackConfig struct {
170 // The revision to rollback to. If set to 0, rollback to the last revision.
171 // +optional
172 Revision int64 `json:"revision,omitempty" protobuf:"varint,1,opt,name=revision"`
173}
174
175const (
176 // DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
177 // to existing RCs (and label key that is added to its pods) to prevent the existing RCs
178 // to select new pods (and old pods being select by new RC).
179 DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
180)
181
182// DeploymentStrategy describes how to replace existing pods with new ones.
183type DeploymentStrategy struct {
184 // Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
185 // +optional
186 Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
187
188 // Rolling update config params. Present only if DeploymentStrategyType =
189 // RollingUpdate.
190 //---
191 // TODO: Update this to follow our convention for oneOf, whatever we decide it
192 // to be.
193 // +optional
194 RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
195}
196
197type DeploymentStrategyType string
198
199const (
200 // Kill all existing pods before creating new ones.
201 RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate"
202
203 // Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one.
204 RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate"
205)
206
207// Spec to control the desired behavior of rolling update.
208type RollingUpdateDeployment struct {
209 // The maximum number of pods that can be unavailable during the update.
210 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
211 // Absolute number is calculated from percentage by rounding down.
212 // This can not be 0 if MaxSurge is 0.
213 // By default, a fixed value of 1 is used.
214 // Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods
215 // immediately when the rolling update starts. Once new pods are ready, old RC
216 // can be scaled down further, followed by scaling up the new RC, ensuring
217 // that the total number of pods available at all times during the update is at
218 // least 70% of desired pods.
219 // +optional
220 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
221
222 // The maximum number of pods that can be scheduled above the desired number of
223 // pods.
224 // Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
225 // This can not be 0 if MaxUnavailable is 0.
226 // Absolute number is calculated from percentage by rounding up.
227 // By default, a value of 1 is used.
228 // Example: when this is set to 30%, the new RC can be scaled up immediately when
229 // the rolling update starts, such that the total number of old and new pods do not exceed
230 // 130% of desired pods. Once old pods have been killed,
231 // new RC can be scaled up further, ensuring that total number of pods running
232 // at any time during the update is at most 130% of desired pods.
233 // +optional
234 MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`
235}
236
237// DeploymentStatus is the most recently observed status of the Deployment.
238type DeploymentStatus struct {
239 // The generation observed by the deployment controller.
240 // +optional
241 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
242
243 // Total number of non-terminated pods targeted by this deployment (their labels match the selector).
244 // +optional
245 Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
246
247 // Total number of non-terminated pods targeted by this deployment that have the desired template spec.
248 // +optional
249 UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
250
251 // Total number of ready pods targeted by this deployment.
252 // +optional
253 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
254
255 // Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
256 // +optional
257 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
258
259 // Total number of unavailable pods targeted by this deployment. This is the total number of
260 // pods that are still required for the deployment to have 100% available capacity. They may
261 // either be pods that are running but not yet available or pods that still have not been created.
262 // +optional
263 UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
264
265 // Represents the latest available observations of a deployment's current state.
266 // +patchMergeKey=type
267 // +patchStrategy=merge
268 Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
269
270 // Count of hash collisions for the Deployment. The Deployment controller uses this
271 // field as a collision avoidance mechanism when it needs to create the name for the
272 // newest ReplicaSet.
273 // +optional
274 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"`
275}
276
277type DeploymentConditionType string
278
279// These are valid conditions of a deployment.
280const (
281 // Available means the deployment is available, ie. at least the minimum available
282 // replicas required are up and running for at least minReadySeconds.
283 DeploymentAvailable DeploymentConditionType = "Available"
284 // Progressing means the deployment is progressing. Progress for a deployment is
285 // considered when a new replica set is created or adopted, and when new pods scale
286 // up or old pods scale down. Progress is not estimated for paused deployments or
287 // when progressDeadlineSeconds is not specified.
288 DeploymentProgressing DeploymentConditionType = "Progressing"
289 // ReplicaFailure is added in a deployment when one of its pods fails to be created
290 // or deleted.
291 DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
292)
293
294// DeploymentCondition describes the state of a deployment at a certain point.
295type DeploymentCondition struct {
296 // Type of deployment condition.
297 Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"`
298 // Status of the condition, one of True, False, Unknown.
299 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
300 // The last time this condition was updated.
301 LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
302 // Last time the condition transitioned from one status to another.
303 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"`
304 // The reason for the condition's last transition.
305 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
306 // A human readable message indicating details about the transition.
307 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
308}
309
310// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
311
312// DeploymentList is a list of Deployments.
313type DeploymentList struct {
314 metav1.TypeMeta `json:",inline"`
315 // Standard list metadata.
316 // +optional
317 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
318
319 // Items is the list of Deployments.
320 Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
321}
322
323type DaemonSetUpdateStrategy struct {
324 // Type of daemon set update. Can be "RollingUpdate" or "OnDelete".
325 // Default is OnDelete.
326 // +optional
327 Type DaemonSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
328
329 // Rolling update config params. Present only if type = "RollingUpdate".
330 //---
331 // TODO: Update this to follow our convention for oneOf, whatever we decide it
332 // to be. Same as Deployment `strategy.rollingUpdate`.
333 // See https://github.com/kubernetes/kubernetes/issues/35345
334 // +optional
335 RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
336}
337
338type DaemonSetUpdateStrategyType string
339
340const (
341 // Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
342 RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate"
343
344 // Replace the old daemons only when it's killed
345 OnDeleteDaemonSetStrategyType DaemonSetUpdateStrategyType = "OnDelete"
346)
347
348// Spec to control the desired behavior of daemon set rolling update.
349type RollingUpdateDaemonSet struct {
350 // The maximum number of DaemonSet pods that can be unavailable during the
351 // update. Value can be an absolute number (ex: 5) or a percentage of total
352 // number of DaemonSet pods at the start of the update (ex: 10%). Absolute
353 // number is calculated from percentage by rounding up.
354 // This cannot be 0.
355 // Default value is 1.
356 // Example: when this is set to 30%, at most 30% of the total number of nodes
357 // that should be running the daemon pod (i.e. status.desiredNumberScheduled)
358 // can have their pods stopped for an update at any given
359 // time. The update starts by stopping at most 30% of those DaemonSet pods
360 // and then brings up new DaemonSet pods in their place. Once the new pods
361 // are available, it then proceeds onto other DaemonSet pods, thus ensuring
362 // that at least 70% of original number of DaemonSet pods are available at
363 // all times during the update.
364 // +optional
365 MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
366}
367
368// DaemonSetSpec is the specification of a daemon set.
369type DaemonSetSpec struct {
370 // A label query over pods that are managed by the daemon set.
371 // Must match in order to be controlled.
372 // If empty, defaulted to labels on Pod template.
373 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
374 // +optional
375 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,1,opt,name=selector"`
376
377 // An object that describes the pod that will be created.
378 // The DaemonSet will create exactly one copy of this pod on every node
379 // that matches the template's node selector (or on every node if no node
380 // selector is specified).
381 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
382 Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"`
383
384 // An update strategy to replace existing DaemonSet pods with new pods.
385 // +optional
386 UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,3,opt,name=updateStrategy"`
387
388 // The minimum number of seconds for which a newly created DaemonSet pod should
389 // be ready without any of its container crashing, for it to be considered
390 // available. Defaults to 0 (pod will be considered available as soon as it
391 // is ready).
392 // +optional
393 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
394
395 // DEPRECATED.
396 // A sequence number representing a specific generation of the template.
397 // Populated by the system. It can be set only during the creation.
398 // +optional
399 TemplateGeneration int64 `json:"templateGeneration,omitempty" protobuf:"varint,5,opt,name=templateGeneration"`
400
401 // The number of old history to retain to allow rollback.
402 // This is a pointer to distinguish between explicit zero and not specified.
403 // Defaults to 10.
404 // +optional
405 RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
406}
407
408// DaemonSetStatus represents the current status of a daemon set.
409type DaemonSetStatus struct {
410 // The number of nodes that are running at least 1
411 // daemon pod and are supposed to run the daemon pod.
412 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
413 CurrentNumberScheduled int32 `json:"currentNumberScheduled" protobuf:"varint,1,opt,name=currentNumberScheduled"`
414
415 // The number of nodes that are running the daemon pod, but are
416 // not supposed to run the daemon pod.
417 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
418 NumberMisscheduled int32 `json:"numberMisscheduled" protobuf:"varint,2,opt,name=numberMisscheduled"`
419
420 // The total number of nodes that should be running the daemon
421 // pod (including nodes correctly running the daemon pod).
422 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
423 DesiredNumberScheduled int32 `json:"desiredNumberScheduled" protobuf:"varint,3,opt,name=desiredNumberScheduled"`
424
425 // The number of nodes that should be running the daemon pod and have one
426 // or more of the daemon pod running and ready.
427 NumberReady int32 `json:"numberReady" protobuf:"varint,4,opt,name=numberReady"`
428
429 // The most recent generation observed by the daemon set controller.
430 // +optional
431 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,5,opt,name=observedGeneration"`
432
433 // The total number of nodes that are running updated daemon pod
434 // +optional
435 UpdatedNumberScheduled int32 `json:"updatedNumberScheduled,omitempty" protobuf:"varint,6,opt,name=updatedNumberScheduled"`
436
437 // The number of nodes that should be running the
438 // daemon pod and have one or more of the daemon pod running and
439 // available (ready for at least spec.minReadySeconds)
440 // +optional
441 NumberAvailable int32 `json:"numberAvailable,omitempty" protobuf:"varint,7,opt,name=numberAvailable"`
442
443 // The number of nodes that should be running the
444 // daemon pod and have none of the daemon pod running and available
445 // (ready for at least spec.minReadySeconds)
446 // +optional
447 NumberUnavailable int32 `json:"numberUnavailable,omitempty" protobuf:"varint,8,opt,name=numberUnavailable"`
448
449 // Count of hash collisions for the DaemonSet. The DaemonSet controller
450 // uses this field as a collision avoidance mechanism when it needs to
451 // create the name for the newest ControllerRevision.
452 // +optional
453 CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
454
455 // Represents the latest available observations of a DaemonSet's current state.
456 // +optional
457 // +patchMergeKey=type
458 // +patchStrategy=merge
459 Conditions []DaemonSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
460}
461
462type DaemonSetConditionType string
463
464// TODO: Add valid condition types of a DaemonSet.
465
466// DaemonSetCondition describes the state of a DaemonSet at a certain point.
467type DaemonSetCondition struct {
468 // Type of DaemonSet condition.
469 Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"`
470 // Status of the condition, one of True, False, Unknown.
471 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
472 // Last time the condition transitioned from one status to another.
473 // +optional
474 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
475 // The reason for the condition's last transition.
476 // +optional
477 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
478 // A human readable message indicating details about the transition.
479 // +optional
480 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
481}
482
483// +genclient
484// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
485
486// DEPRECATED - This group version of DaemonSet is deprecated by apps/v1beta2/DaemonSet. See the release notes for
487// more information.
488// DaemonSet represents the configuration of a daemon set.
489type DaemonSet struct {
490 metav1.TypeMeta `json:",inline"`
491 // Standard object's metadata.
492 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
493 // +optional
494 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
495
496 // The desired behavior of this daemon set.
497 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
498 // +optional
499 Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
500
501 // The current status of this daemon set. This data may be
502 // out of date by some window of time.
503 // Populated by the system.
504 // Read-only.
505 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
506 // +optional
507 Status DaemonSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
508}
509
510const (
511 // DEPRECATED: DefaultDaemonSetUniqueLabelKey is used instead.
512 // DaemonSetTemplateGenerationKey is the key of the labels that is added
513 // to daemon set pods to distinguish between old and new pod templates
514 // during DaemonSet template update.
515 DaemonSetTemplateGenerationKey string = "pod-template-generation"
516
517 // DefaultDaemonSetUniqueLabelKey is the default label key that is added
518 // to existing DaemonSet pods to distinguish between old and new
519 // DaemonSet pods during DaemonSet template updates.
520 DefaultDaemonSetUniqueLabelKey = appsv1beta1.ControllerRevisionHashLabelKey
521)
522
523// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
524
525// DaemonSetList is a collection of daemon sets.
526type DaemonSetList struct {
527 metav1.TypeMeta `json:",inline"`
528 // Standard list metadata.
529 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
530 // +optional
531 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
532
533 // A list of daemon sets.
534 Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"`
535}
536
537// +genclient
538// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
539
540// Ingress is a collection of rules that allow inbound connections to reach the
541// endpoints defined by a backend. An Ingress can be configured to give services
542// externally-reachable urls, load balance traffic, terminate SSL, offer name
543// based virtual hosting etc.
544// DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information.
545type Ingress struct {
546 metav1.TypeMeta `json:",inline"`
547 // Standard object's metadata.
548 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
549 // +optional
550 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
551
552 // Spec is the desired state of the Ingress.
553 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
554 // +optional
555 Spec IngressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
556
557 // Status is the current state of the Ingress.
558 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
559 // +optional
560 Status IngressStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
561}
562
563// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
564
565// IngressList is a collection of Ingress.
566type IngressList struct {
567 metav1.TypeMeta `json:",inline"`
568 // Standard object's metadata.
569 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
570 // +optional
571 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
572
573 // Items is the list of Ingress.
574 Items []Ingress `json:"items" protobuf:"bytes,2,rep,name=items"`
575}
576
577// IngressSpec describes the Ingress the user wishes to exist.
578type IngressSpec struct {
579 // A default backend capable of servicing requests that don't match any
580 // rule. At least one of 'backend' or 'rules' must be specified. This field
581 // is optional to allow the loadbalancer controller or defaulting logic to
582 // specify a global default.
583 // +optional
584 Backend *IngressBackend `json:"backend,omitempty" protobuf:"bytes,1,opt,name=backend"`
585
586 // TLS configuration. Currently the Ingress only supports a single TLS
587 // port, 443. If multiple members of this list specify different hosts, they
588 // will be multiplexed on the same port according to the hostname specified
589 // through the SNI TLS extension, if the ingress controller fulfilling the
590 // ingress supports SNI.
591 // +optional
592 TLS []IngressTLS `json:"tls,omitempty" protobuf:"bytes,2,rep,name=tls"`
593
594 // A list of host rules used to configure the Ingress. If unspecified, or
595 // no rule matches, all traffic is sent to the default backend.
596 // +optional
597 Rules []IngressRule `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"`
598 // TODO: Add the ability to specify load-balancer IP through claims
599}
600
601// IngressTLS describes the transport layer security associated with an Ingress.
602type IngressTLS struct {
603 // Hosts are a list of hosts included in the TLS certificate. The values in
604 // this list must match the name/s used in the tlsSecret. Defaults to the
605 // wildcard host setting for the loadbalancer controller fulfilling this
606 // Ingress, if left unspecified.
607 // +optional
608 Hosts []string `json:"hosts,omitempty" protobuf:"bytes,1,rep,name=hosts"`
609 // SecretName is the name of the secret used to terminate SSL traffic on 443.
610 // Field is left optional to allow SSL routing based on SNI hostname alone.
611 // If the SNI host in a listener conflicts with the "Host" header field used
612 // by an IngressRule, the SNI host is used for termination and value of the
613 // Host header is used for routing.
614 // +optional
615 SecretName string `json:"secretName,omitempty" protobuf:"bytes,2,opt,name=secretName"`
616 // TODO: Consider specifying different modes of termination, protocols etc.
617}
618
619// IngressStatus describe the current state of the Ingress.
620type IngressStatus struct {
621 // LoadBalancer contains the current status of the load-balancer.
622 // +optional
623 LoadBalancer v1.LoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"`
624}
625
626// IngressRule represents the rules mapping the paths under a specified host to
627// the related backend services. Incoming requests are first evaluated for a host
628// match, then routed to the backend associated with the matching IngressRuleValue.
629type IngressRule struct {
630 // Host is the fully qualified domain name of a network host, as defined
631 // by RFC 3986. Note the following deviations from the "host" part of the
632 // URI as defined in the RFC:
633 // 1. IPs are not allowed. Currently an IngressRuleValue can only apply to the
634 // IP in the Spec of the parent Ingress.
635 // 2. The `:` delimiter is not respected because ports are not allowed.
636 // Currently the port of an Ingress is implicitly :80 for http and
637 // :443 for https.
638 // Both these may change in the future.
639 // Incoming requests are matched against the host before the IngressRuleValue.
640 // If the host is unspecified, the Ingress routes all traffic based on the
641 // specified IngressRuleValue.
642 // +optional
643 Host string `json:"host,omitempty" protobuf:"bytes,1,opt,name=host"`
644 // IngressRuleValue represents a rule to route requests for this IngressRule.
645 // If unspecified, the rule defaults to a http catch-all. Whether that sends
646 // just traffic matching the host to the default backend or all traffic to the
647 // default backend, is left to the controller fulfilling the Ingress. Http is
648 // currently the only supported IngressRuleValue.
649 // +optional
650 IngressRuleValue `json:",inline,omitempty" protobuf:"bytes,2,opt,name=ingressRuleValue"`
651}
652
653// IngressRuleValue represents a rule to apply against incoming requests. If the
654// rule is satisfied, the request is routed to the specified backend. Currently
655// mixing different types of rules in a single Ingress is disallowed, so exactly
656// one of the following must be set.
657type IngressRuleValue struct {
658 //TODO:
659 // 1. Consider renaming this resource and the associated rules so they
660 // aren't tied to Ingress. They can be used to route intra-cluster traffic.
661 // 2. Consider adding fields for ingress-type specific global options
662 // usable by a loadbalancer, like http keep-alive.
663
664 // +optional
665 HTTP *HTTPIngressRuleValue `json:"http,omitempty" protobuf:"bytes,1,opt,name=http"`
666}
667
668// HTTPIngressRuleValue is a list of http selectors pointing to backends.
669// In the example: http://<host>/<path>?<searchpart> -> backend where
670// where parts of the url correspond to RFC 3986, this resource will be used
671// to match against everything after the last '/' and before the first '?'
672// or '#'.
673type HTTPIngressRuleValue struct {
674 // A collection of paths that map requests to backends.
675 Paths []HTTPIngressPath `json:"paths" protobuf:"bytes,1,rep,name=paths"`
676 // TODO: Consider adding fields for ingress-type specific global
677 // options usable by a loadbalancer, like http keep-alive.
678}
679
680// HTTPIngressPath associates a path regex with a backend. Incoming urls matching
681// the path are forwarded to the backend.
682type HTTPIngressPath struct {
683 // Path is an extended POSIX regex as defined by IEEE Std 1003.1,
684 // (i.e this follows the egrep/unix syntax, not the perl syntax)
685 // matched against the path of an incoming request. Currently it can
686 // contain characters disallowed from the conventional "path"
687 // part of a URL as defined by RFC 3986. Paths must begin with
688 // a '/'. If unspecified, the path defaults to a catch all sending
689 // traffic to the backend.
690 // +optional
691 Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"`
692
693 // Backend defines the referenced service endpoint to which the traffic
694 // will be forwarded to.
695 Backend IngressBackend `json:"backend" protobuf:"bytes,2,opt,name=backend"`
696}
697
698// IngressBackend describes all endpoints for a given service and port.
699type IngressBackend struct {
700 // Specifies the name of the referenced service.
701 ServiceName string `json:"serviceName" protobuf:"bytes,1,opt,name=serviceName"`
702
703 // Specifies the port of the referenced service.
704 ServicePort intstr.IntOrString `json:"servicePort" protobuf:"bytes,2,opt,name=servicePort"`
705}
706
707// +genclient
708// +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
709// +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
710// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
711
712// DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for
713// more information.
714// ReplicaSet ensures that a specified number of pod replicas are running at any given time.
715type ReplicaSet struct {
716 metav1.TypeMeta `json:",inline"`
717
718 // If the Labels of a ReplicaSet are empty, they are defaulted to
719 // be the same as the Pod(s) that the ReplicaSet manages.
720 // Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
721 // +optional
722 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
723
724 // Spec defines the specification of the desired behavior of the ReplicaSet.
725 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
726 // +optional
727 Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
728
729 // Status is the most recently observed status of the ReplicaSet.
730 // This data may be out of date by some window of time.
731 // Populated by the system.
732 // Read-only.
733 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
734 // +optional
735 Status ReplicaSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
736}
737
738// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
739
740// ReplicaSetList is a collection of ReplicaSets.
741type ReplicaSetList struct {
742 metav1.TypeMeta `json:",inline"`
743 // Standard list metadata.
744 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
745 // +optional
746 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
747
748 // List of ReplicaSets.
749 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
750 Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
751}
752
753// ReplicaSetSpec is the specification of a ReplicaSet.
754type ReplicaSetSpec struct {
755 // Replicas is the number of desired replicas.
756 // This is a pointer to distinguish between explicit zero and unspecified.
757 // Defaults to 1.
758 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
759 // +optional
760 Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
761
762 // Minimum number of seconds for which a newly created pod should be ready
763 // without any of its container crashing, for it to be considered available.
764 // Defaults to 0 (pod will be considered available as soon as it is ready)
765 // +optional
766 MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
767
768 // Selector is a label query over pods that should match the replica count.
769 // If the selector is empty, it is defaulted to the labels present on the pod template.
770 // Label keys and values that must match in order to be controlled by this replica set.
771 // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
772 // +optional
773 Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
774
775 // Template is the object that describes the pod that will be created if
776 // insufficient replicas are detected.
777 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
778 // +optional
779 Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
780}
781
782// ReplicaSetStatus represents the current status of a ReplicaSet.
783type ReplicaSetStatus struct {
784 // Replicas is the most recently oberved number of replicas.
785 // More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
786 Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
787
788 // The number of pods that have labels matching the labels of the pod template of the replicaset.
789 // +optional
790 FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
791
792 // The number of ready replicas for this replica set.
793 // +optional
794 ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
795
796 // The number of available replicas (ready for at least minReadySeconds) for this replica set.
797 // +optional
798 AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
799
800 // ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
801 // +optional
802 ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
803
804 // Represents the latest available observations of a replica set's current state.
805 // +optional
806 // +patchMergeKey=type
807 // +patchStrategy=merge
808 Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
809}
810
811type ReplicaSetConditionType string
812
813// These are valid conditions of a replica set.
814const (
815 // ReplicaSetReplicaFailure is added in a replica set when one of its pods fails to be created
816 // due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted
817 // due to kubelet being down or finalizers are failing.
818 ReplicaSetReplicaFailure ReplicaSetConditionType = "ReplicaFailure"
819)
820
821// ReplicaSetCondition describes the state of a replica set at a certain point.
822type ReplicaSetCondition struct {
823 // Type of replica set condition.
824 Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"`
825 // Status of the condition, one of True, False, Unknown.
826 Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
827 // The last time the condition transitioned from one status to another.
828 // +optional
829 LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
830 // The reason for the condition's last transition.
831 // +optional
832 Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
833 // A human readable message indicating details about the transition.
834 // +optional
835 Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
836}
837
838// +genclient
839// +genclient:nonNamespaced
840// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
841
842// PodSecurityPolicy governs the ability to make requests that affect the Security Context
843// that will be applied to a pod and container.
844// Deprecated: use PodSecurityPolicy from policy API Group instead.
845type PodSecurityPolicy struct {
846 metav1.TypeMeta `json:",inline"`
847 // Standard object's metadata.
848 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
849 // +optional
850 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
851
852 // spec defines the policy enforced.
853 // +optional
854 Spec PodSecurityPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
855}
856
857// PodSecurityPolicySpec defines the policy enforced.
858// Deprecated: use PodSecurityPolicySpec from policy API Group instead.
859type PodSecurityPolicySpec struct {
860 // privileged determines if a pod can request to be run as privileged.
861 // +optional
862 Privileged bool `json:"privileged,omitempty" protobuf:"varint,1,opt,name=privileged"`
863 // defaultAddCapabilities is the default set of capabilities that will be added to the container
864 // unless the pod spec specifically drops the capability. You may not list a capability in both
865 // defaultAddCapabilities and requiredDropCapabilities. Capabilities added here are implicitly
866 // allowed, and need not be included in the allowedCapabilities list.
867 // +optional
868 DefaultAddCapabilities []v1.Capability `json:"defaultAddCapabilities,omitempty" protobuf:"bytes,2,rep,name=defaultAddCapabilities,casttype=k8s.io/api/core/v1.Capability"`
869 // requiredDropCapabilities are the capabilities that will be dropped from the container. These
870 // are required to be dropped and cannot be added.
871 // +optional
872 RequiredDropCapabilities []v1.Capability `json:"requiredDropCapabilities,omitempty" protobuf:"bytes,3,rep,name=requiredDropCapabilities,casttype=k8s.io/api/core/v1.Capability"`
873 // allowedCapabilities is a list of capabilities that can be requested to add to the container.
874 // Capabilities in this field may be added at the pod author's discretion.
875 // You must not list a capability in both allowedCapabilities and requiredDropCapabilities.
876 // +optional
877 AllowedCapabilities []v1.Capability `json:"allowedCapabilities,omitempty" protobuf:"bytes,4,rep,name=allowedCapabilities,casttype=k8s.io/api/core/v1.Capability"`
878 // volumes is a white list of allowed volume plugins. Empty indicates that
879 // no volumes may be used. To allow all volumes you may use '*'.
880 // +optional
881 Volumes []FSType `json:"volumes,omitempty" protobuf:"bytes,5,rep,name=volumes,casttype=FSType"`
882 // hostNetwork determines if the policy allows the use of HostNetwork in the pod spec.
883 // +optional
884 HostNetwork bool `json:"hostNetwork,omitempty" protobuf:"varint,6,opt,name=hostNetwork"`
885 // hostPorts determines which host port ranges are allowed to be exposed.
886 // +optional
887 HostPorts []HostPortRange `json:"hostPorts,omitempty" protobuf:"bytes,7,rep,name=hostPorts"`
888 // hostPID determines if the policy allows the use of HostPID in the pod spec.
889 // +optional
890 HostPID bool `json:"hostPID,omitempty" protobuf:"varint,8,opt,name=hostPID"`
891 // hostIPC determines if the policy allows the use of HostIPC in the pod spec.
892 // +optional
893 HostIPC bool `json:"hostIPC,omitempty" protobuf:"varint,9,opt,name=hostIPC"`
894 // seLinux is the strategy that will dictate the allowable labels that may be set.
895 SELinux SELinuxStrategyOptions `json:"seLinux" protobuf:"bytes,10,opt,name=seLinux"`
896 // runAsUser is the strategy that will dictate the allowable RunAsUser values that may be set.
897 RunAsUser RunAsUserStrategyOptions `json:"runAsUser" protobuf:"bytes,11,opt,name=runAsUser"`
898 // RunAsGroup is the strategy that will dictate the allowable RunAsGroup values that may be set.
899 // If this field is omitted, the pod's RunAsGroup can take any value. This field requires the
900 // RunAsGroup feature gate to be enabled.
901 // +optional
902 RunAsGroup *RunAsGroupStrategyOptions `json:"runAsGroup,omitempty" protobuf:"bytes,22,opt,name=runAsGroup"`
903 // supplementalGroups is the strategy that will dictate what supplemental groups are used by the SecurityContext.
904 SupplementalGroups SupplementalGroupsStrategyOptions `json:"supplementalGroups" protobuf:"bytes,12,opt,name=supplementalGroups"`
905 // fsGroup is the strategy that will dictate what fs group is used by the SecurityContext.
906 FSGroup FSGroupStrategyOptions `json:"fsGroup" protobuf:"bytes,13,opt,name=fsGroup"`
907 // readOnlyRootFilesystem when set to true will force containers to run with a read only root file
908 // system. If the container specifically requests to run with a non-read only root file system
909 // the PSP should deny the pod.
910 // If set to false the container may run with a read only root file system if it wishes but it
911 // will not be forced to.
912 // +optional
913 ReadOnlyRootFilesystem bool `json:"readOnlyRootFilesystem,omitempty" protobuf:"varint,14,opt,name=readOnlyRootFilesystem"`
914 // defaultAllowPrivilegeEscalation controls the default setting for whether a
915 // process can gain more privileges than its parent process.
916 // +optional
917 DefaultAllowPrivilegeEscalation *bool `json:"defaultAllowPrivilegeEscalation,omitempty" protobuf:"varint,15,opt,name=defaultAllowPrivilegeEscalation"`
918 // allowPrivilegeEscalation determines if a pod can request to allow
919 // privilege escalation. If unspecified, defaults to true.
920 // +optional
921 AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty" protobuf:"varint,16,opt,name=allowPrivilegeEscalation"`
922 // allowedHostPaths is a white list of allowed host paths. Empty indicates
923 // that all host paths may be used.
924 // +optional
925 AllowedHostPaths []AllowedHostPath `json:"allowedHostPaths,omitempty" protobuf:"bytes,17,rep,name=allowedHostPaths"`
926 // allowedFlexVolumes is a whitelist of allowed Flexvolumes. Empty or nil indicates that all
927 // Flexvolumes may be used. This parameter is effective only when the usage of the Flexvolumes
928 // is allowed in the "volumes" field.
929 // +optional
930 AllowedFlexVolumes []AllowedFlexVolume `json:"allowedFlexVolumes,omitempty" protobuf:"bytes,18,rep,name=allowedFlexVolumes"`
931 // AllowedCSIDrivers is a whitelist of inline CSI drivers that must be explicitly set to be embedded within a pod spec.
932 // An empty value indicates that any CSI driver can be used for inline ephemeral volumes.
933 // This is an alpha field, and is only honored if the API server enables the CSIInlineVolume feature gate.
934 // +optional
935 AllowedCSIDrivers []AllowedCSIDriver `json:"allowedCSIDrivers,omitempty" protobuf:"bytes,23,rep,name=allowedCSIDrivers"`
936 // allowedUnsafeSysctls is a list of explicitly allowed unsafe sysctls, defaults to none.
937 // Each entry is either a plain sysctl name or ends in "*" in which case it is considered
938 // as a prefix of allowed sysctls. Single * means all unsafe sysctls are allowed.
939 // Kubelet has to whitelist all allowed unsafe sysctls explicitly to avoid rejection.
940 //
941 // Examples:
942 // e.g. "foo/*" allows "foo/bar", "foo/baz", etc.
943 // e.g. "foo.*" allows "foo.bar", "foo.baz", etc.
944 // +optional
945 AllowedUnsafeSysctls []string `json:"allowedUnsafeSysctls,omitempty" protobuf:"bytes,19,rep,name=allowedUnsafeSysctls"`
946 // forbiddenSysctls is a list of explicitly forbidden sysctls, defaults to none.
947 // Each entry is either a plain sysctl name or ends in "*" in which case it is considered
948 // as a prefix of forbidden sysctls. Single * means all sysctls are forbidden.
949 //
950 // Examples:
951 // e.g. "foo/*" forbids "foo/bar", "foo/baz", etc.
952 // e.g. "foo.*" forbids "foo.bar", "foo.baz", etc.
953 // +optional
954 ForbiddenSysctls []string `json:"forbiddenSysctls,omitempty" protobuf:"bytes,20,rep,name=forbiddenSysctls"`
955 // AllowedProcMountTypes is a whitelist of allowed ProcMountTypes.
956 // Empty or nil indicates that only the DefaultProcMountType may be used.
957 // This requires the ProcMountType feature flag to be enabled.
958 // +optional
959 AllowedProcMountTypes []v1.ProcMountType `json:"allowedProcMountTypes,omitempty" protobuf:"bytes,21,opt,name=allowedProcMountTypes"`
960 // runtimeClass is the strategy that will dictate the allowable RuntimeClasses for a pod.
961 // If this field is omitted, the pod's runtimeClassName field is unrestricted.
962 // Enforcement of this field depends on the RuntimeClass feature gate being enabled.
963 // +optional
964 RuntimeClass *RuntimeClassStrategyOptions `json:"runtimeClass,omitempty" protobuf:"bytes,24,opt,name=runtimeClass"`
965}
966
967// AllowedHostPath defines the host volume conditions that will be enabled by a policy
968// for pods to use. It requires the path prefix to be defined.
969// Deprecated: use AllowedHostPath from policy API Group instead.
970type AllowedHostPath struct {
971 // pathPrefix is the path prefix that the host volume must match.
972 // It does not support `*`.
973 // Trailing slashes are trimmed when validating the path prefix with a host path.
974 //
975 // Examples:
976 // `/foo` would allow `/foo`, `/foo/` and `/foo/bar`
977 // `/foo` would not allow `/food` or `/etc/foo`
978 PathPrefix string `json:"pathPrefix,omitempty" protobuf:"bytes,1,rep,name=pathPrefix"`
979
980 // when set to true, will allow host volumes matching the pathPrefix only if all volume mounts are readOnly.
981 // +optional
982 ReadOnly bool `json:"readOnly,omitempty" protobuf:"varint,2,opt,name=readOnly"`
983}
984
985// FSType gives strong typing to different file systems that are used by volumes.
986// Deprecated: use FSType from policy API Group instead.
987type FSType string
988
989var (
990 AzureFile FSType = "azureFile"
991 Flocker FSType = "flocker"
992 FlexVolume FSType = "flexVolume"
993 HostPath FSType = "hostPath"
994 EmptyDir FSType = "emptyDir"
995 GCEPersistentDisk FSType = "gcePersistentDisk"
996 AWSElasticBlockStore FSType = "awsElasticBlockStore"
997 GitRepo FSType = "gitRepo"
998 Secret FSType = "secret"
999 NFS FSType = "nfs"
1000 ISCSI FSType = "iscsi"
1001 Glusterfs FSType = "glusterfs"
1002 PersistentVolumeClaim FSType = "persistentVolumeClaim"
1003 RBD FSType = "rbd"
1004 Cinder FSType = "cinder"
1005 CephFS FSType = "cephFS"
1006 DownwardAPI FSType = "downwardAPI"
1007 FC FSType = "fc"
1008 ConfigMap FSType = "configMap"
1009 Quobyte FSType = "quobyte"
1010 AzureDisk FSType = "azureDisk"
1011 CSI FSType = "csi"
1012 All FSType = "*"
1013)
1014
1015// AllowedFlexVolume represents a single Flexvolume that is allowed to be used.
1016// Deprecated: use AllowedFlexVolume from policy API Group instead.
1017type AllowedFlexVolume struct {
1018 // driver is the name of the Flexvolume driver.
1019 Driver string `json:"driver" protobuf:"bytes,1,opt,name=driver"`
1020}
1021
1022// AllowedCSIDriver represents a single inline CSI Driver that is allowed to be used.
1023type AllowedCSIDriver struct {
1024 // Name is the registered name of the CSI driver
1025 Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
1026}
1027
1028// HostPortRange defines a range of host ports that will be enabled by a policy
1029// for pods to use. It requires both the start and end to be defined.
1030// Deprecated: use HostPortRange from policy API Group instead.
1031type HostPortRange struct {
1032 // min is the start of the range, inclusive.
1033 Min int32 `json:"min" protobuf:"varint,1,opt,name=min"`
1034 // max is the end of the range, inclusive.
1035 Max int32 `json:"max" protobuf:"varint,2,opt,name=max"`
1036}
1037
1038// SELinuxStrategyOptions defines the strategy type and any options used to create the strategy.
1039// Deprecated: use SELinuxStrategyOptions from policy API Group instead.
1040type SELinuxStrategyOptions struct {
1041 // rule is the strategy that will dictate the allowable labels that may be set.
1042 Rule SELinuxStrategy `json:"rule" protobuf:"bytes,1,opt,name=rule,casttype=SELinuxStrategy"`
1043 // seLinuxOptions required to run as; required for MustRunAs
1044 // More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
1045 // +optional
1046 SELinuxOptions *v1.SELinuxOptions `json:"seLinuxOptions,omitempty" protobuf:"bytes,2,opt,name=seLinuxOptions"`
1047}
1048
1049// SELinuxStrategy denotes strategy types for generating SELinux options for a
1050// Security Context.
1051// Deprecated: use SELinuxStrategy from policy API Group instead.
1052type SELinuxStrategy string
1053
1054const (
1055 // SELinuxStrategyMustRunAs means that container must have SELinux labels of X applied.
1056 // Deprecated: use SELinuxStrategyMustRunAs from policy API Group instead.
1057 SELinuxStrategyMustRunAs SELinuxStrategy = "MustRunAs"
1058 // SELinuxStrategyRunAsAny means that container may make requests for any SELinux context labels.
1059 // Deprecated: use SELinuxStrategyRunAsAny from policy API Group instead.
1060 SELinuxStrategyRunAsAny SELinuxStrategy = "RunAsAny"
1061)
1062
1063// RunAsUserStrategyOptions defines the strategy type and any options used to create the strategy.
1064// Deprecated: use RunAsUserStrategyOptions from policy API Group instead.
1065type RunAsUserStrategyOptions struct {
1066 // rule is the strategy that will dictate the allowable RunAsUser values that may be set.
1067 Rule RunAsUserStrategy `json:"rule" protobuf:"bytes,1,opt,name=rule,casttype=RunAsUserStrategy"`
1068 // ranges are the allowed ranges of uids that may be used. If you would like to force a single uid
1069 // then supply a single range with the same start and end. Required for MustRunAs.
1070 // +optional
1071 Ranges []IDRange `json:"ranges,omitempty" protobuf:"bytes,2,rep,name=ranges"`
1072}
1073
1074// RunAsGroupStrategyOptions defines the strategy type and any options used to create the strategy.
1075// Deprecated: use RunAsGroupStrategyOptions from policy API Group instead.
1076type RunAsGroupStrategyOptions struct {
1077 // rule is the strategy that will dictate the allowable RunAsGroup values that may be set.
1078 Rule RunAsGroupStrategy `json:"rule" protobuf:"bytes,1,opt,name=rule,casttype=RunAsGroupStrategy"`
1079 // ranges are the allowed ranges of gids that may be used. If you would like to force a single gid
1080 // then supply a single range with the same start and end. Required for MustRunAs.
1081 // +optional
1082 Ranges []IDRange `json:"ranges,omitempty" protobuf:"bytes,2,rep,name=ranges"`
1083}
1084
1085// IDRange provides a min/max of an allowed range of IDs.
1086// Deprecated: use IDRange from policy API Group instead.
1087type IDRange struct {
1088 // min is the start of the range, inclusive.
1089 Min int64 `json:"min" protobuf:"varint,1,opt,name=min"`
1090 // max is the end of the range, inclusive.
1091 Max int64 `json:"max" protobuf:"varint,2,opt,name=max"`
1092}
1093
1094// RunAsUserStrategy denotes strategy types for generating RunAsUser values for a
1095// Security Context.
1096// Deprecated: use RunAsUserStrategy from policy API Group instead.
1097type RunAsUserStrategy string
1098
1099const (
1100 // RunAsUserStrategyMustRunAs means that container must run as a particular uid.
1101 // Deprecated: use RunAsUserStrategyMustRunAs from policy API Group instead.
1102 RunAsUserStrategyMustRunAs RunAsUserStrategy = "MustRunAs"
1103 // RunAsUserStrategyMustRunAsNonRoot means that container must run as a non-root uid.
1104 // Deprecated: use RunAsUserStrategyMustRunAsNonRoot from policy API Group instead.
1105 RunAsUserStrategyMustRunAsNonRoot RunAsUserStrategy = "MustRunAsNonRoot"
1106 // RunAsUserStrategyRunAsAny means that container may make requests for any uid.
1107 // Deprecated: use RunAsUserStrategyRunAsAny from policy API Group instead.
1108 RunAsUserStrategyRunAsAny RunAsUserStrategy = "RunAsAny"
1109)
1110
1111// RunAsGroupStrategy denotes strategy types for generating RunAsGroup values for a
1112// Security Context.
1113// Deprecated: use RunAsGroupStrategy from policy API Group instead.
1114type RunAsGroupStrategy string
1115
1116const (
1117 // RunAsGroupStrategyMayRunAs means that container does not need to run with a particular gid.
1118 // However, when RunAsGroup are specified, they have to fall in the defined range.
1119 RunAsGroupStrategyMayRunAs RunAsGroupStrategy = "MayRunAs"
1120 // RunAsGroupStrategyMustRunAs means that container must run as a particular gid.
1121 // Deprecated: use RunAsGroupStrategyMustRunAs from policy API Group instead.
1122 RunAsGroupStrategyMustRunAs RunAsGroupStrategy = "MustRunAs"
1123 // RunAsGroupStrategyRunAsAny means that container may make requests for any gid.
1124 // Deprecated: use RunAsGroupStrategyRunAsAny from policy API Group instead.
1125 RunAsGroupStrategyRunAsAny RunAsGroupStrategy = "RunAsAny"
1126)
1127
1128// FSGroupStrategyOptions defines the strategy type and options used to create the strategy.
1129// Deprecated: use FSGroupStrategyOptions from policy API Group instead.
1130type FSGroupStrategyOptions struct {
1131 // rule is the strategy that will dictate what FSGroup is used in the SecurityContext.
1132 // +optional
1133 Rule FSGroupStrategyType `json:"rule,omitempty" protobuf:"bytes,1,opt,name=rule,casttype=FSGroupStrategyType"`
1134 // ranges are the allowed ranges of fs groups. If you would like to force a single
1135 // fs group then supply a single range with the same start and end. Required for MustRunAs.
1136 // +optional
1137 Ranges []IDRange `json:"ranges,omitempty" protobuf:"bytes,2,rep,name=ranges"`
1138}
1139
1140// FSGroupStrategyType denotes strategy types for generating FSGroup values for a
1141// SecurityContext
1142// Deprecated: use FSGroupStrategyType from policy API Group instead.
1143type FSGroupStrategyType string
1144
1145const (
1146 // FSGroupStrategyMustRunAs meant that container must have FSGroup of X applied.
1147 // Deprecated: use FSGroupStrategyMustRunAs from policy API Group instead.
1148 FSGroupStrategyMustRunAs FSGroupStrategyType = "MustRunAs"
1149 // FSGroupStrategyRunAsAny means that container may make requests for any FSGroup labels.
1150 // Deprecated: use FSGroupStrategyRunAsAny from policy API Group instead.
1151 FSGroupStrategyRunAsAny FSGroupStrategyType = "RunAsAny"
1152)
1153
1154// SupplementalGroupsStrategyOptions defines the strategy type and options used to create the strategy.
1155// Deprecated: use SupplementalGroupsStrategyOptions from policy API Group instead.
1156type SupplementalGroupsStrategyOptions struct {
1157 // rule is the strategy that will dictate what supplemental groups is used in the SecurityContext.
1158 // +optional
1159 Rule SupplementalGroupsStrategyType `json:"rule,omitempty" protobuf:"bytes,1,opt,name=rule,casttype=SupplementalGroupsStrategyType"`
1160 // ranges are the allowed ranges of supplemental groups. If you would like to force a single
1161 // supplemental group then supply a single range with the same start and end. Required for MustRunAs.
1162 // +optional
1163 Ranges []IDRange `json:"ranges,omitempty" protobuf:"bytes,2,rep,name=ranges"`
1164}
1165
1166// SupplementalGroupsStrategyType denotes strategy types for determining valid supplemental
1167// groups for a SecurityContext.
1168// Deprecated: use SupplementalGroupsStrategyType from policy API Group instead.
1169type SupplementalGroupsStrategyType string
1170
1171const (
1172 // SupplementalGroupsStrategyMustRunAs means that container must run as a particular gid.
1173 // Deprecated: use SupplementalGroupsStrategyMustRunAs from policy API Group instead.
1174 SupplementalGroupsStrategyMustRunAs SupplementalGroupsStrategyType = "MustRunAs"
1175 // SupplementalGroupsStrategyRunAsAny means that container may make requests for any gid.
1176 // Deprecated: use SupplementalGroupsStrategyRunAsAny from policy API Group instead.
1177 SupplementalGroupsStrategyRunAsAny SupplementalGroupsStrategyType = "RunAsAny"
1178)
1179
1180// RuntimeClassStrategyOptions define the strategy that will dictate the allowable RuntimeClasses
1181// for a pod.
1182type RuntimeClassStrategyOptions struct {
1183 // allowedRuntimeClassNames is a whitelist of RuntimeClass names that may be specified on a pod.
1184 // A value of "*" means that any RuntimeClass name is allowed, and must be the only item in the
1185 // list. An empty list requires the RuntimeClassName field to be unset.
1186 AllowedRuntimeClassNames []string `json:"allowedRuntimeClassNames" protobuf:"bytes,1,rep,name=allowedRuntimeClassNames"`
1187 // defaultRuntimeClassName is the default RuntimeClassName to set on the pod.
1188 // The default MUST be allowed by the allowedRuntimeClassNames list.
1189 // A value of nil does not mutate the Pod.
1190 // +optional
1191 DefaultRuntimeClassName *string `json:"defaultRuntimeClassName,omitempty" protobuf:"bytes,2,opt,name=defaultRuntimeClassName"`
1192}
1193
1194// AllowAllRuntimeClassNames can be used as a value for the
1195// RuntimeClassStrategyOptions.AllowedRuntimeClassNames field and means that any RuntimeClassName is
1196// allowed.
1197const AllowAllRuntimeClassNames = "*"
1198
1199// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1200
1201// PodSecurityPolicyList is a list of PodSecurityPolicy objects.
1202// Deprecated: use PodSecurityPolicyList from policy API Group instead.
1203type PodSecurityPolicyList struct {
1204 metav1.TypeMeta `json:",inline"`
1205 // Standard list metadata.
1206 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
1207 // +optional
1208 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
1209
1210 // items is a list of schema objects.
1211 Items []PodSecurityPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
1212}
1213
1214// +genclient
1215// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1216
1217// DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy.
1218// NetworkPolicy describes what network traffic is allowed for a set of Pods
1219type NetworkPolicy struct {
1220 metav1.TypeMeta `json:",inline"`
1221 // Standard object's metadata.
1222 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
1223 // +optional
1224 metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
1225
1226 // Specification of the desired behavior for this NetworkPolicy.
1227 // +optional
1228 Spec NetworkPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
1229}
1230
1231// DEPRECATED 1.9 - This group version of PolicyType is deprecated by networking/v1/PolicyType.
1232// Policy Type string describes the NetworkPolicy type
1233// This type is beta-level in 1.8
1234type PolicyType string
1235
1236const (
1237 // PolicyTypeIngress is a NetworkPolicy that affects ingress traffic on selected pods
1238 PolicyTypeIngress PolicyType = "Ingress"
1239 // PolicyTypeEgress is a NetworkPolicy that affects egress traffic on selected pods
1240 PolicyTypeEgress PolicyType = "Egress"
1241)
1242
1243// DEPRECATED 1.9 - This group version of NetworkPolicySpec is deprecated by networking/v1/NetworkPolicySpec.
1244type NetworkPolicySpec struct {
1245 // Selects the pods to which this NetworkPolicy object applies. The array of ingress rules
1246 // is applied to any pods selected by this field. Multiple network policies can select the
1247 // same set of pods. In this case, the ingress rules for each are combined additively.
1248 // This field is NOT optional and follows standard label selector semantics.
1249 // An empty podSelector matches all pods in this namespace.
1250 PodSelector metav1.LabelSelector `json:"podSelector" protobuf:"bytes,1,opt,name=podSelector"`
1251
1252 // List of ingress rules to be applied to the selected pods.
1253 // Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod
1254 // OR if the traffic source is the pod's local node,
1255 // OR if the traffic matches at least one ingress rule across all of the NetworkPolicy
1256 // objects whose podSelector matches the pod.
1257 // If this field is empty then this NetworkPolicy does not allow any traffic
1258 // (and serves solely to ensure that the pods it selects are isolated by default).
1259 // +optional
1260 Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"`
1261
1262 // List of egress rules to be applied to the selected pods. Outgoing traffic is
1263 // allowed if there are no NetworkPolicies selecting the pod (and cluster policy
1264 // otherwise allows the traffic), OR if the traffic matches at least one egress rule
1265 // across all of the NetworkPolicy objects whose podSelector matches the pod. If
1266 // this field is empty then this NetworkPolicy limits all outgoing traffic (and serves
1267 // solely to ensure that the pods it selects are isolated by default).
1268 // This field is beta-level in 1.8
1269 // +optional
1270 Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"`
1271
1272 // List of rule types that the NetworkPolicy relates to.
1273 // Valid options are "Ingress", "Egress", or "Ingress,Egress".
1274 // If this field is not specified, it will default based on the existence of Ingress or Egress rules;
1275 // policies that contain an Egress section are assumed to affect Egress, and all policies
1276 // (whether or not they contain an Ingress section) are assumed to affect Ingress.
1277 // If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ].
1278 // Likewise, if you want to write a policy that specifies that no egress is allowed,
1279 // you must specify a policyTypes value that include "Egress" (since such a policy would not include
1280 // an Egress section and would otherwise default to just [ "Ingress" ]).
1281 // This field is beta-level in 1.8
1282 // +optional
1283 PolicyTypes []PolicyType `json:"policyTypes,omitempty" protobuf:"bytes,4,rep,name=policyTypes,casttype=PolicyType"`
1284}
1285
1286// DEPRECATED 1.9 - This group version of NetworkPolicyIngressRule is deprecated by networking/v1/NetworkPolicyIngressRule.
1287// This NetworkPolicyIngressRule matches traffic if and only if the traffic matches both ports AND from.
1288type NetworkPolicyIngressRule struct {
1289 // List of ports which should be made accessible on the pods selected for this rule.
1290 // Each item in this list is combined using a logical OR.
1291 // If this field is empty or missing, this rule matches all ports (traffic not restricted by port).
1292 // If this field is present and contains at least one item, then this rule allows traffic
1293 // only if the traffic matches at least one port in the list.
1294 // +optional
1295 Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"`
1296
1297 // List of sources which should be able to access the pods selected for this rule.
1298 // Items in this list are combined using a logical OR operation.
1299 // If this field is empty or missing, this rule matches all sources (traffic not restricted by source).
1300 // If this field is present and contains at least on item, this rule allows traffic only if the
1301 // traffic matches at least one item in the from list.
1302 // +optional
1303 From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"`
1304}
1305
1306// DEPRECATED 1.9 - This group version of NetworkPolicyEgressRule is deprecated by networking/v1/NetworkPolicyEgressRule.
1307// NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods
1308// matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to.
1309// This type is beta-level in 1.8
1310type NetworkPolicyEgressRule struct {
1311 // List of destination ports for outgoing traffic.
1312 // Each item in this list is combined using a logical OR. If this field is
1313 // empty or missing, this rule matches all ports (traffic not restricted by port).
1314 // If this field is present and contains at least one item, then this rule allows
1315 // traffic only if the traffic matches at least one port in the list.
1316 // +optional
1317 Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"`
1318
1319 // List of destinations for outgoing traffic of pods selected for this rule.
1320 // Items in this list are combined using a logical OR operation. If this field is
1321 // empty or missing, this rule matches all destinations (traffic not restricted by
1322 // destination). If this field is present and contains at least one item, this rule
1323 // allows traffic only if the traffic matches at least one item in the to list.
1324 // +optional
1325 To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"`
1326}
1327
1328// DEPRECATED 1.9 - This group version of NetworkPolicyPort is deprecated by networking/v1/NetworkPolicyPort.
1329type NetworkPolicyPort struct {
1330 // Optional. The protocol (TCP, UDP, or SCTP) which traffic must match.
1331 // If not specified, this field defaults to TCP.
1332 // +optional
1333 Protocol *v1.Protocol `json:"protocol,omitempty" protobuf:"bytes,1,opt,name=protocol,casttype=k8s.io/api/core/v1.Protocol"`
1334
1335 // If specified, the port on the given protocol. This can
1336 // either be a numerical or named port on a pod. If this field is not provided,
1337 // this matches all port names and numbers.
1338 // If present, only traffic on the specified protocol AND port
1339 // will be matched.
1340 // +optional
1341 Port *intstr.IntOrString `json:"port,omitempty" protobuf:"bytes,2,opt,name=port"`
1342}
1343
1344// DEPRECATED 1.9 - This group version of IPBlock is deprecated by networking/v1/IPBlock.
1345// IPBlock describes a particular CIDR (Ex. "192.168.1.1/24") that is allowed to the pods
1346// matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs that should
1347// not be included within this rule.
1348type IPBlock struct {
1349 // CIDR is a string representing the IP Block
1350 // Valid examples are "192.168.1.1/24"
1351 CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"`
1352 // Except is a slice of CIDRs that should not be included within an IP Block
1353 // Valid examples are "192.168.1.1/24"
1354 // Except values will be rejected if they are outside the CIDR range
1355 // +optional
1356 Except []string `json:"except,omitempty" protobuf:"bytes,2,rep,name=except"`
1357}
1358
1359// DEPRECATED 1.9 - This group version of NetworkPolicyPeer is deprecated by networking/v1/NetworkPolicyPeer.
1360type NetworkPolicyPeer struct {
1361 // This is a label selector which selects Pods. This field follows standard label
1362 // selector semantics; if present but empty, it selects all pods.
1363 //
1364 // If NamespaceSelector is also set, then the NetworkPolicyPeer as a whole selects
1365 // the Pods matching PodSelector in the Namespaces selected by NamespaceSelector.
1366 // Otherwise it selects the Pods matching PodSelector in the policy's own Namespace.
1367 // +optional
1368 PodSelector *metav1.LabelSelector `json:"podSelector,omitempty" protobuf:"bytes,1,opt,name=podSelector"`
1369
1370 // Selects Namespaces using cluster-scoped labels. This field follows standard label
1371 // selector semantics; if present but empty, it selects all namespaces.
1372 //
1373 // If PodSelector is also set, then the NetworkPolicyPeer as a whole selects
1374 // the Pods matching PodSelector in the Namespaces selected by NamespaceSelector.
1375 // Otherwise it selects all Pods in the Namespaces selected by NamespaceSelector.
1376 // +optional
1377 NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,2,opt,name=namespaceSelector"`
1378
1379 // IPBlock defines policy on a particular IPBlock. If this field is set then
1380 // neither of the other fields can be.
1381 // +optional
1382 IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"`
1383}
1384
1385// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
1386
1387// DEPRECATED 1.9 - This group version of NetworkPolicyList is deprecated by networking/v1/NetworkPolicyList.
1388// Network Policy List is a list of NetworkPolicy objects.
1389type NetworkPolicyList struct {
1390 metav1.TypeMeta `json:",inline"`
1391 // Standard list metadata.
1392 // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
1393 // +optional
1394 metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
1395
1396 // Items is a list of schema objects.
1397 Items []NetworkPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
1398}