...

Source file src/k8s.io/api/extensions/v1beta1/types.go

Documentation: k8s.io/api/extensions/v1beta1

     1  /*
     2  Copyright 2015 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 v1beta1
    18  
    19  import (
    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
    27  type 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.
    34  type 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  	// selector is a label query over pods that should match the replicas count. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
    39  	// +optional
    40  	// +mapType=atomic
    41  	Selector map[string]string `json:"selector,omitempty" protobuf:"bytes,2,rep,name=selector"`
    42  
    43  	// label selector for pods that should match the replicas count. This is a serializated
    44  	// version of both map-based and more expressive set-based selectors. This is done to
    45  	// avoid introspection in the clients. The string will be in the same format as the
    46  	// query-param syntax. If the target type only supports map-based selectors, both this
    47  	// field and map-based selector field are populated.
    48  	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
    49  	// +optional
    50  	TargetSelector string `json:"targetSelector,omitempty" protobuf:"bytes,3,opt,name=targetSelector"`
    51  }
    52  
    53  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    54  // +k8s:prerelease-lifecycle-gen:introduced=1.1
    55  // +k8s:prerelease-lifecycle-gen:deprecated=1.2
    56  // +k8s:prerelease-lifecycle-gen:removed=1.16
    57  
    58  // represents a scaling request for a resource.
    59  type Scale struct {
    60  	metav1.TypeMeta `json:",inline"`
    61  	// Standard object metadata; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata.
    62  	// +optional
    63  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
    64  
    65  	// defines the behavior of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status.
    66  	// +optional
    67  	Spec ScaleSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
    68  
    69  	// current status of the scale. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status. Read-only.
    70  	// +optional
    71  	Status ScaleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
    72  }
    73  
    74  // +genclient
    75  // +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
    76  // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
    77  // +genclient:method=ApplyScale,verb=apply,subresource=scale,input=Scale,result=Scale
    78  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    79  // +k8s:prerelease-lifecycle-gen:introduced=1.1
    80  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
    81  // +k8s:prerelease-lifecycle-gen:removed=1.16
    82  // +k8s:prerelease-lifecycle-gen:replacement=apps,v1,Deployment
    83  
    84  // DEPRECATED - This group version of Deployment is deprecated by apps/v1beta2/Deployment. See the release notes for
    85  // more information.
    86  // Deployment enables declarative updates for Pods and ReplicaSets.
    87  type Deployment struct {
    88  	metav1.TypeMeta `json:",inline"`
    89  	// Standard object metadata.
    90  	// +optional
    91  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
    92  
    93  	// Specification of the desired behavior of the Deployment.
    94  	// +optional
    95  	Spec DeploymentSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
    96  
    97  	// Most recently observed status of the Deployment.
    98  	// +optional
    99  	Status DeploymentStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
   100  }
   101  
   102  // DeploymentSpec is the specification of the desired behavior of the Deployment.
   103  type DeploymentSpec struct {
   104  	// Number of desired pods. This is a pointer to distinguish between explicit
   105  	// zero and not specified. Defaults to 1.
   106  	// +optional
   107  	Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
   108  
   109  	// Label selector for pods. Existing ReplicaSets whose pods are
   110  	// selected by this will be the ones affected by this deployment.
   111  	// +optional
   112  	Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
   113  
   114  	// Template describes the pods that will be created.
   115  	Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
   116  
   117  	// The deployment strategy to use to replace existing pods with new ones.
   118  	// +optional
   119  	// +patchStrategy=retainKeys
   120  	Strategy DeploymentStrategy `json:"strategy,omitempty" patchStrategy:"retainKeys" protobuf:"bytes,4,opt,name=strategy"`
   121  
   122  	// Minimum number of seconds for which a newly created pod should be ready
   123  	// without any of its container crashing, for it to be considered available.
   124  	// Defaults to 0 (pod will be considered available as soon as it is ready)
   125  	// +optional
   126  	MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,5,opt,name=minReadySeconds"`
   127  
   128  	// The number of old ReplicaSets to retain to allow rollback.
   129  	// This is a pointer to distinguish between explicit zero and not specified.
   130  	// This is set to the max value of int32 (i.e. 2147483647) by default, which
   131  	// means "retaining all old ReplicaSets".
   132  	// +optional
   133  	RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
   134  
   135  	// Indicates that the deployment is paused and will not be processed by the
   136  	// deployment controller.
   137  	// +optional
   138  	Paused bool `json:"paused,omitempty" protobuf:"varint,7,opt,name=paused"`
   139  
   140  	// DEPRECATED.
   141  	// The config this deployment is rolling back to. Will be cleared after rollback is done.
   142  	// +optional
   143  	RollbackTo *RollbackConfig `json:"rollbackTo,omitempty" protobuf:"bytes,8,opt,name=rollbackTo"`
   144  
   145  	// The maximum time in seconds for a deployment to make progress before it
   146  	// is considered to be failed. The deployment controller will continue to
   147  	// process failed deployments and a condition with a ProgressDeadlineExceeded
   148  	// reason will be surfaced in the deployment status. Note that progress will
   149  	// not be estimated during the time a deployment is paused. This is set to
   150  	// the max value of int32 (i.e. 2147483647) by default, which means "no deadline".
   151  	// +optional
   152  	ProgressDeadlineSeconds *int32 `json:"progressDeadlineSeconds,omitempty" protobuf:"varint,9,opt,name=progressDeadlineSeconds"`
   153  }
   154  
   155  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   156  // +k8s:prerelease-lifecycle-gen:introduced=1.2
   157  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
   158  // +k8s:prerelease-lifecycle-gen:removed=1.16
   159  
   160  // DEPRECATED.
   161  // DeploymentRollback stores the information required to rollback a deployment.
   162  type DeploymentRollback struct {
   163  	metav1.TypeMeta `json:",inline"`
   164  	// Required: This must match the Name of a deployment.
   165  	Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
   166  	// The annotations to be updated to a deployment
   167  	// +optional
   168  	UpdatedAnnotations map[string]string `json:"updatedAnnotations,omitempty" protobuf:"bytes,2,rep,name=updatedAnnotations"`
   169  	// The config of this deployment rollback.
   170  	RollbackTo RollbackConfig `json:"rollbackTo" protobuf:"bytes,3,opt,name=rollbackTo"`
   171  }
   172  
   173  // DEPRECATED.
   174  type RollbackConfig struct {
   175  	// The revision to rollback to. If set to 0, rollback to the last revision.
   176  	// +optional
   177  	Revision int64 `json:"revision,omitempty" protobuf:"varint,1,opt,name=revision"`
   178  }
   179  
   180  const (
   181  	// DefaultDeploymentUniqueLabelKey is the default key of the selector that is added
   182  	// to existing RCs (and label key that is added to its pods) to prevent the existing RCs
   183  	// to select new pods (and old pods being select by new RC).
   184  	DefaultDeploymentUniqueLabelKey string = "pod-template-hash"
   185  )
   186  
   187  // DeploymentStrategy describes how to replace existing pods with new ones.
   188  type DeploymentStrategy struct {
   189  	// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
   190  	// +optional
   191  	Type DeploymentStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type,casttype=DeploymentStrategyType"`
   192  
   193  	// Rolling update config params. Present only if DeploymentStrategyType =
   194  	// RollingUpdate.
   195  	//---
   196  	// TODO: Update this to follow our convention for oneOf, whatever we decide it
   197  	// to be.
   198  	// +optional
   199  	RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
   200  }
   201  
   202  type DeploymentStrategyType string
   203  
   204  const (
   205  	// Kill all existing pods before creating new ones.
   206  	RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate"
   207  
   208  	// Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one.
   209  	RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate"
   210  )
   211  
   212  // Spec to control the desired behavior of rolling update.
   213  type RollingUpdateDeployment struct {
   214  	// The maximum number of pods that can be unavailable during the update.
   215  	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
   216  	// Absolute number is calculated from percentage by rounding down.
   217  	// This can not be 0 if MaxSurge is 0.
   218  	// By default, a fixed value of 1 is used.
   219  	// Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods
   220  	// immediately when the rolling update starts. Once new pods are ready, old RC
   221  	// can be scaled down further, followed by scaling up the new RC, ensuring
   222  	// that the total number of pods available at all times during the update is at
   223  	// least 70% of desired pods.
   224  	// +optional
   225  	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
   226  
   227  	// The maximum number of pods that can be scheduled above the desired number of
   228  	// pods.
   229  	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
   230  	// This can not be 0 if MaxUnavailable is 0.
   231  	// Absolute number is calculated from percentage by rounding up.
   232  	// By default, a value of 1 is used.
   233  	// Example: when this is set to 30%, the new RC can be scaled up immediately when
   234  	// the rolling update starts, such that the total number of old and new pods do not exceed
   235  	// 130% of desired pods. Once old pods have been killed,
   236  	// new RC can be scaled up further, ensuring that total number of pods running
   237  	// at any time during the update is at most 130% of desired pods.
   238  	// +optional
   239  	MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`
   240  }
   241  
   242  // DeploymentStatus is the most recently observed status of the Deployment.
   243  type DeploymentStatus struct {
   244  	// The generation observed by the deployment controller.
   245  	// +optional
   246  	ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,1,opt,name=observedGeneration"`
   247  
   248  	// Total number of non-terminated pods targeted by this deployment (their labels match the selector).
   249  	// +optional
   250  	Replicas int32 `json:"replicas,omitempty" protobuf:"varint,2,opt,name=replicas"`
   251  
   252  	// Total number of non-terminated pods targeted by this deployment that have the desired template spec.
   253  	// +optional
   254  	UpdatedReplicas int32 `json:"updatedReplicas,omitempty" protobuf:"varint,3,opt,name=updatedReplicas"`
   255  
   256  	// Total number of ready pods targeted by this deployment.
   257  	// +optional
   258  	ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,7,opt,name=readyReplicas"`
   259  
   260  	// Total number of available pods (ready for at least minReadySeconds) targeted by this deployment.
   261  	// +optional
   262  	AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,4,opt,name=availableReplicas"`
   263  
   264  	// Total number of unavailable pods targeted by this deployment. This is the total number of
   265  	// pods that are still required for the deployment to have 100% available capacity. They may
   266  	// either be pods that are running but not yet available or pods that still have not been created.
   267  	// +optional
   268  	UnavailableReplicas int32 `json:"unavailableReplicas,omitempty" protobuf:"varint,5,opt,name=unavailableReplicas"`
   269  
   270  	// Represents the latest available observations of a deployment's current state.
   271  	// +patchMergeKey=type
   272  	// +patchStrategy=merge
   273  	// +listType=map
   274  	// +listMapKey=type
   275  	Conditions []DeploymentCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
   276  
   277  	// Count of hash collisions for the Deployment. The Deployment controller uses this
   278  	// field as a collision avoidance mechanism when it needs to create the name for the
   279  	// newest ReplicaSet.
   280  	// +optional
   281  	CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,8,opt,name=collisionCount"`
   282  }
   283  
   284  type DeploymentConditionType string
   285  
   286  // These are valid conditions of a deployment.
   287  const (
   288  	// Available means the deployment is available, ie. at least the minimum available
   289  	// replicas required are up and running for at least minReadySeconds.
   290  	DeploymentAvailable DeploymentConditionType = "Available"
   291  	// Progressing means the deployment is progressing. Progress for a deployment is
   292  	// considered when a new replica set is created or adopted, and when new pods scale
   293  	// up or old pods scale down. Progress is not estimated for paused deployments or
   294  	// when progressDeadlineSeconds is not specified.
   295  	DeploymentProgressing DeploymentConditionType = "Progressing"
   296  	// ReplicaFailure is added in a deployment when one of its pods fails to be created
   297  	// or deleted.
   298  	DeploymentReplicaFailure DeploymentConditionType = "ReplicaFailure"
   299  )
   300  
   301  // DeploymentCondition describes the state of a deployment at a certain point.
   302  type DeploymentCondition struct {
   303  	// Type of deployment condition.
   304  	Type DeploymentConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DeploymentConditionType"`
   305  	// Status of the condition, one of True, False, Unknown.
   306  	Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
   307  	// The last time this condition was updated.
   308  	LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,6,opt,name=lastUpdateTime"`
   309  	// Last time the condition transitioned from one status to another.
   310  	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,7,opt,name=lastTransitionTime"`
   311  	// The reason for the condition's last transition.
   312  	Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
   313  	// A human readable message indicating details about the transition.
   314  	Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
   315  }
   316  
   317  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   318  // +k8s:prerelease-lifecycle-gen:introduced=1.1
   319  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
   320  // +k8s:prerelease-lifecycle-gen:removed=1.16
   321  // +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DeploymentList
   322  
   323  // DeploymentList is a list of Deployments.
   324  type DeploymentList struct {
   325  	metav1.TypeMeta `json:",inline"`
   326  	// Standard list metadata.
   327  	// +optional
   328  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   329  
   330  	// Items is the list of Deployments.
   331  	Items []Deployment `json:"items" protobuf:"bytes,2,rep,name=items"`
   332  }
   333  
   334  // DaemonSetUpdateStrategy indicates the strategy that the DaemonSet
   335  // controller will use to perform updates. It includes any additional parameters
   336  // necessary to perform the update for the indicated strategy.
   337  type DaemonSetUpdateStrategy struct {
   338  	// Type of daemon set update. Can be "RollingUpdate" or "OnDelete".
   339  	// Default is OnDelete.
   340  	// +optional
   341  	Type DaemonSetUpdateStrategyType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
   342  
   343  	// Rolling update config params. Present only if type = "RollingUpdate".
   344  	//---
   345  	// TODO: Update this to follow our convention for oneOf, whatever we decide it
   346  	// to be. Same as Deployment `strategy.rollingUpdate`.
   347  	// See https://github.com/kubernetes/kubernetes/issues/35345
   348  	// +optional
   349  	RollingUpdate *RollingUpdateDaemonSet `json:"rollingUpdate,omitempty" protobuf:"bytes,2,opt,name=rollingUpdate"`
   350  }
   351  
   352  type DaemonSetUpdateStrategyType string
   353  
   354  const (
   355  	// Replace the old daemons by new ones using rolling update i.e replace them on each node one after the other.
   356  	RollingUpdateDaemonSetStrategyType DaemonSetUpdateStrategyType = "RollingUpdate"
   357  
   358  	// Replace the old daemons only when it's killed
   359  	OnDeleteDaemonSetStrategyType DaemonSetUpdateStrategyType = "OnDelete"
   360  )
   361  
   362  // Spec to control the desired behavior of daemon set rolling update.
   363  type RollingUpdateDaemonSet struct {
   364  	// The maximum number of DaemonSet pods that can be unavailable during the
   365  	// update. Value can be an absolute number (ex: 5) or a percentage of total
   366  	// number of DaemonSet pods at the start of the update (ex: 10%). Absolute
   367  	// number is calculated from percentage by rounding up.
   368  	// This cannot be 0 if MaxSurge is 0
   369  	// Default value is 1.
   370  	// Example: when this is set to 30%, at most 30% of the total number of nodes
   371  	// that should be running the daemon pod (i.e. status.desiredNumberScheduled)
   372  	// can have their pods stopped for an update at any given time. The update
   373  	// starts by stopping at most 30% of those DaemonSet pods and then brings
   374  	// up new DaemonSet pods in their place. Once the new pods are available,
   375  	// it then proceeds onto other DaemonSet pods, thus ensuring that at least
   376  	// 70% of original number of DaemonSet pods are available at all times during
   377  	// the update.
   378  	// +optional
   379  	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,1,opt,name=maxUnavailable"`
   380  
   381  	// The maximum number of nodes with an existing available DaemonSet pod that
   382  	// can have an updated DaemonSet pod during during an update.
   383  	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
   384  	// This can not be 0 if MaxUnavailable is 0.
   385  	// Absolute number is calculated from percentage by rounding up to a minimum of 1.
   386  	// Default value is 0.
   387  	// Example: when this is set to 30%, at most 30% of the total number of nodes
   388  	// that should be running the daemon pod (i.e. status.desiredNumberScheduled)
   389  	// can have their a new pod created before the old pod is marked as deleted.
   390  	// The update starts by launching new pods on 30% of nodes. Once an updated
   391  	// pod is available (Ready for at least minReadySeconds) the old DaemonSet pod
   392  	// on that node is marked deleted. If the old pod becomes unavailable for any
   393  	// reason (Ready transitions to false, is evicted, or is drained) an updated
   394  	// pod is immediatedly created on that node without considering surge limits.
   395  	// Allowing surge implies the possibility that the resources consumed by the
   396  	// daemonset on any given node can double if the readiness check fails, and
   397  	// so resource intensive daemonsets should take into account that they may
   398  	// cause evictions during disruption.
   399  	// This is an alpha field and requires enabling DaemonSetUpdateSurge feature gate.
   400  	// +optional
   401  	MaxSurge *intstr.IntOrString `json:"maxSurge,omitempty" protobuf:"bytes,2,opt,name=maxSurge"`
   402  }
   403  
   404  // DaemonSetSpec is the specification of a daemon set.
   405  type DaemonSetSpec struct {
   406  	// A label query over pods that are managed by the daemon set.
   407  	// Must match in order to be controlled.
   408  	// If empty, defaulted to labels on Pod template.
   409  	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
   410  	// +optional
   411  	Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,1,opt,name=selector"`
   412  
   413  	// An object that describes the pod that will be created.
   414  	// The DaemonSet will create exactly one copy of this pod on every node
   415  	// that matches the template's node selector (or on every node if no node
   416  	// selector is specified).
   417  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
   418  	Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,2,opt,name=template"`
   419  
   420  	// An update strategy to replace existing DaemonSet pods with new pods.
   421  	// +optional
   422  	UpdateStrategy DaemonSetUpdateStrategy `json:"updateStrategy,omitempty" protobuf:"bytes,3,opt,name=updateStrategy"`
   423  
   424  	// The minimum number of seconds for which a newly created DaemonSet pod should
   425  	// be ready without any of its container crashing, for it to be considered
   426  	// available. Defaults to 0 (pod will be considered available as soon as it
   427  	// is ready).
   428  	// +optional
   429  	MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
   430  
   431  	// DEPRECATED.
   432  	// A sequence number representing a specific generation of the template.
   433  	// Populated by the system. It can be set only during the creation.
   434  	// +optional
   435  	TemplateGeneration int64 `json:"templateGeneration,omitempty" protobuf:"varint,5,opt,name=templateGeneration"`
   436  
   437  	// The number of old history to retain to allow rollback.
   438  	// This is a pointer to distinguish between explicit zero and not specified.
   439  	// Defaults to 10.
   440  	// +optional
   441  	RevisionHistoryLimit *int32 `json:"revisionHistoryLimit,omitempty" protobuf:"varint,6,opt,name=revisionHistoryLimit"`
   442  }
   443  
   444  // DaemonSetStatus represents the current status of a daemon set.
   445  type DaemonSetStatus struct {
   446  	// The number of nodes that are running at least 1
   447  	// daemon pod and are supposed to run the daemon pod.
   448  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
   449  	CurrentNumberScheduled int32 `json:"currentNumberScheduled" protobuf:"varint,1,opt,name=currentNumberScheduled"`
   450  
   451  	// The number of nodes that are running the daemon pod, but are
   452  	// not supposed to run the daemon pod.
   453  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
   454  	NumberMisscheduled int32 `json:"numberMisscheduled" protobuf:"varint,2,opt,name=numberMisscheduled"`
   455  
   456  	// The total number of nodes that should be running the daemon
   457  	// pod (including nodes correctly running the daemon pod).
   458  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
   459  	DesiredNumberScheduled int32 `json:"desiredNumberScheduled" protobuf:"varint,3,opt,name=desiredNumberScheduled"`
   460  
   461  	// The number of nodes that should be running the daemon pod and have one
   462  	// or more of the daemon pod running and ready.
   463  	NumberReady int32 `json:"numberReady" protobuf:"varint,4,opt,name=numberReady"`
   464  
   465  	// The most recent generation observed by the daemon set controller.
   466  	// +optional
   467  	ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,5,opt,name=observedGeneration"`
   468  
   469  	// The total number of nodes that are running updated daemon pod
   470  	// +optional
   471  	UpdatedNumberScheduled int32 `json:"updatedNumberScheduled,omitempty" protobuf:"varint,6,opt,name=updatedNumberScheduled"`
   472  
   473  	// The number of nodes that should be running the
   474  	// daemon pod and have one or more of the daemon pod running and
   475  	// available (ready for at least spec.minReadySeconds)
   476  	// +optional
   477  	NumberAvailable int32 `json:"numberAvailable,omitempty" protobuf:"varint,7,opt,name=numberAvailable"`
   478  
   479  	// The number of nodes that should be running the
   480  	// daemon pod and have none of the daemon pod running and available
   481  	// (ready for at least spec.minReadySeconds)
   482  	// +optional
   483  	NumberUnavailable int32 `json:"numberUnavailable,omitempty" protobuf:"varint,8,opt,name=numberUnavailable"`
   484  
   485  	// Count of hash collisions for the DaemonSet. The DaemonSet controller
   486  	// uses this field as a collision avoidance mechanism when it needs to
   487  	// create the name for the newest ControllerRevision.
   488  	// +optional
   489  	CollisionCount *int32 `json:"collisionCount,omitempty" protobuf:"varint,9,opt,name=collisionCount"`
   490  
   491  	// Represents the latest available observations of a DaemonSet's current state.
   492  	// +optional
   493  	// +patchMergeKey=type
   494  	// +patchStrategy=merge
   495  	// +listType=map
   496  	// +listMapKey=type
   497  	Conditions []DaemonSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,10,rep,name=conditions"`
   498  }
   499  
   500  type DaemonSetConditionType string
   501  
   502  // TODO: Add valid condition types of a DaemonSet.
   503  
   504  // DaemonSetCondition describes the state of a DaemonSet at a certain point.
   505  type DaemonSetCondition struct {
   506  	// Type of DaemonSet condition.
   507  	Type DaemonSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=DaemonSetConditionType"`
   508  	// Status of the condition, one of True, False, Unknown.
   509  	Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
   510  	// Last time the condition transitioned from one status to another.
   511  	// +optional
   512  	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
   513  	// The reason for the condition's last transition.
   514  	// +optional
   515  	Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
   516  	// A human readable message indicating details about the transition.
   517  	// +optional
   518  	Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
   519  }
   520  
   521  // +genclient
   522  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   523  // +k8s:prerelease-lifecycle-gen:introduced=1.1
   524  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
   525  // +k8s:prerelease-lifecycle-gen:removed=1.16
   526  // +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DaemonSet
   527  
   528  // DEPRECATED - This group version of DaemonSet is deprecated by apps/v1beta2/DaemonSet. See the release notes for
   529  // more information.
   530  // DaemonSet represents the configuration of a daemon set.
   531  type DaemonSet struct {
   532  	metav1.TypeMeta `json:",inline"`
   533  	// Standard object's metadata.
   534  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   535  	// +optional
   536  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   537  
   538  	// The desired behavior of this daemon set.
   539  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   540  	// +optional
   541  	Spec DaemonSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
   542  
   543  	// The current status of this daemon set. This data may be
   544  	// out of date by some window of time.
   545  	// Populated by the system.
   546  	// Read-only.
   547  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   548  	// +optional
   549  	Status DaemonSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
   550  }
   551  
   552  const (
   553  	// DEPRECATED: DefaultDaemonSetUniqueLabelKey is used instead.
   554  	// DaemonSetTemplateGenerationKey is the key of the labels that is added
   555  	// to daemon set pods to distinguish between old and new pod templates
   556  	// during DaemonSet template update.
   557  	DaemonSetTemplateGenerationKey string = "pod-template-generation"
   558  
   559  	// DefaultDaemonSetUniqueLabelKey is the default label key that is added
   560  	// to existing DaemonSet pods to distinguish between old and new
   561  	// DaemonSet pods during DaemonSet template updates.
   562  	DefaultDaemonSetUniqueLabelKey = appsv1beta1.ControllerRevisionHashLabelKey
   563  )
   564  
   565  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   566  // +k8s:prerelease-lifecycle-gen:introduced=1.1
   567  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
   568  // +k8s:prerelease-lifecycle-gen:removed=1.16
   569  // +k8s:prerelease-lifecycle-gen:replacement=apps,v1,DaemonSetList
   570  
   571  // DaemonSetList is a collection of daemon sets.
   572  type DaemonSetList struct {
   573  	metav1.TypeMeta `json:",inline"`
   574  	// Standard list metadata.
   575  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   576  	// +optional
   577  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   578  
   579  	// A list of daemon sets.
   580  	Items []DaemonSet `json:"items" protobuf:"bytes,2,rep,name=items"`
   581  }
   582  
   583  // +genclient
   584  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   585  // +k8s:prerelease-lifecycle-gen:introduced=1.1
   586  // +k8s:prerelease-lifecycle-gen:deprecated=1.14
   587  // +k8s:prerelease-lifecycle-gen:removed=1.22
   588  // +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1,Ingress
   589  
   590  // Ingress is a collection of rules that allow inbound connections to reach the
   591  // endpoints defined by a backend. An Ingress can be configured to give services
   592  // externally-reachable urls, load balance traffic, terminate SSL, offer name
   593  // based virtual hosting etc.
   594  // DEPRECATED - This group version of Ingress is deprecated by networking.k8s.io/v1beta1 Ingress. See the release notes for more information.
   595  type Ingress struct {
   596  	metav1.TypeMeta `json:",inline"`
   597  	// Standard object's metadata.
   598  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   599  	// +optional
   600  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   601  
   602  	// Spec is the desired state of the Ingress.
   603  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   604  	// +optional
   605  	Spec IngressSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
   606  
   607  	// Status is the current state of the Ingress.
   608  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   609  	// +optional
   610  	Status IngressStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
   611  }
   612  
   613  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   614  // +k8s:prerelease-lifecycle-gen:introduced=1.1
   615  // +k8s:prerelease-lifecycle-gen:deprecated=1.14
   616  // +k8s:prerelease-lifecycle-gen:removed=1.22
   617  // +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1,IngressList
   618  
   619  // IngressList is a collection of Ingress.
   620  type IngressList struct {
   621  	metav1.TypeMeta `json:",inline"`
   622  	// Standard object's metadata.
   623  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   624  	// +optional
   625  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   626  
   627  	// Items is the list of Ingress.
   628  	Items []Ingress `json:"items" protobuf:"bytes,2,rep,name=items"`
   629  }
   630  
   631  // IngressSpec describes the Ingress the user wishes to exist.
   632  type IngressSpec struct {
   633  	// IngressClassName is the name of the IngressClass cluster resource. The
   634  	// associated IngressClass defines which controller will implement the
   635  	// resource. This replaces the deprecated `kubernetes.io/ingress.class`
   636  	// annotation. For backwards compatibility, when that annotation is set, it
   637  	// must be given precedence over this field. The controller may emit a
   638  	// warning if the field and annotation have different values.
   639  	// Implementations of this API should ignore Ingresses without a class
   640  	// specified. An IngressClass resource may be marked as default, which can
   641  	// be used to set a default value for this field. For more information,
   642  	// refer to the IngressClass documentation.
   643  	// +optional
   644  	IngressClassName *string `json:"ingressClassName,omitempty" protobuf:"bytes,4,opt,name=ingressClassName"`
   645  
   646  	// A default backend capable of servicing requests that don't match any
   647  	// rule. At least one of 'backend' or 'rules' must be specified. This field
   648  	// is optional to allow the loadbalancer controller or defaulting logic to
   649  	// specify a global default.
   650  	// +optional
   651  	Backend *IngressBackend `json:"backend,omitempty" protobuf:"bytes,1,opt,name=backend"`
   652  
   653  	// TLS configuration. Currently the Ingress only supports a single TLS
   654  	// port, 443. If multiple members of this list specify different hosts, they
   655  	// will be multiplexed on the same port according to the hostname specified
   656  	// through the SNI TLS extension, if the ingress controller fulfilling the
   657  	// ingress supports SNI.
   658  	// +optional
   659  	// +listType=atomic
   660  	TLS []IngressTLS `json:"tls,omitempty" protobuf:"bytes,2,rep,name=tls"`
   661  
   662  	// A list of host rules used to configure the Ingress. If unspecified, or
   663  	// no rule matches, all traffic is sent to the default backend.
   664  	// +optional
   665  	// +listType=atomic
   666  	Rules []IngressRule `json:"rules,omitempty" protobuf:"bytes,3,rep,name=rules"`
   667  	// TODO: Add the ability to specify load-balancer IP through claims
   668  }
   669  
   670  // IngressTLS describes the transport layer security associated with an Ingress.
   671  type IngressTLS struct {
   672  	// Hosts are a list of hosts included in the TLS certificate. The values in
   673  	// this list must match the name/s used in the tlsSecret. Defaults to the
   674  	// wildcard host setting for the loadbalancer controller fulfilling this
   675  	// Ingress, if left unspecified.
   676  	// +optional
   677  	// +listType=atomic
   678  	Hosts []string `json:"hosts,omitempty" protobuf:"bytes,1,rep,name=hosts"`
   679  	// SecretName is the name of the secret used to terminate SSL traffic on 443.
   680  	// Field is left optional to allow SSL routing based on SNI hostname alone.
   681  	// If the SNI host in a listener conflicts with the "Host" header field used
   682  	// by an IngressRule, the SNI host is used for termination and value of the
   683  	// Host header is used for routing.
   684  	// +optional
   685  	SecretName string `json:"secretName,omitempty" protobuf:"bytes,2,opt,name=secretName"`
   686  	// TODO: Consider specifying different modes of termination, protocols etc.
   687  }
   688  
   689  // IngressStatus describe the current state of the Ingress.
   690  type IngressStatus struct {
   691  	// LoadBalancer contains the current status of the load-balancer.
   692  	// +optional
   693  	LoadBalancer IngressLoadBalancerStatus `json:"loadBalancer,omitempty" protobuf:"bytes,1,opt,name=loadBalancer"`
   694  }
   695  
   696  // LoadBalancerStatus represents the status of a load-balancer.
   697  type IngressLoadBalancerStatus struct {
   698  	// Ingress is a list containing ingress points for the load-balancer.
   699  	// +optional
   700  	// +listType=atomic
   701  	Ingress []IngressLoadBalancerIngress `json:"ingress,omitempty" protobuf:"bytes,1,rep,name=ingress"`
   702  }
   703  
   704  // IngressLoadBalancerIngress represents the status of a load-balancer ingress point.
   705  type IngressLoadBalancerIngress struct {
   706  	// IP is set for load-balancer ingress points that are IP based.
   707  	// +optional
   708  	IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"`
   709  
   710  	// Hostname is set for load-balancer ingress points that are DNS based.
   711  	// +optional
   712  	Hostname string `json:"hostname,omitempty" protobuf:"bytes,2,opt,name=hostname"`
   713  
   714  	// Ports provides information about the ports exposed by this LoadBalancer.
   715  	// +listType=atomic
   716  	// +optional
   717  	Ports []IngressPortStatus `json:"ports,omitempty" protobuf:"bytes,4,rep,name=ports"`
   718  }
   719  
   720  // IngressPortStatus represents the error condition of a service port
   721  type IngressPortStatus struct {
   722  	// Port is the port number of the ingress port.
   723  	Port int32 `json:"port" protobuf:"varint,1,opt,name=port"`
   724  
   725  	// Protocol is the protocol of the ingress port.
   726  	// The supported values are: "TCP", "UDP", "SCTP"
   727  	Protocol v1.Protocol `json:"protocol" protobuf:"bytes,2,opt,name=protocol,casttype=Protocol"`
   728  
   729  	// Error is to record the problem with the service port
   730  	// The format of the error shall comply with the following rules:
   731  	// - built-in error values shall be specified in this file and those shall use
   732  	//   CamelCase names
   733  	// - cloud provider specific error values must have names that comply with the
   734  	//   format foo.example.com/CamelCase.
   735  	// ---
   736  	// The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
   737  	// +optional
   738  	// +kubebuilder:validation:Required
   739  	// +kubebuilder:validation:Pattern=`^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$`
   740  	// +kubebuilder:validation:MaxLength=316
   741  	Error *string `json:"error,omitempty" protobuf:"bytes,3,opt,name=error"`
   742  }
   743  
   744  // IngressRule represents the rules mapping the paths under a specified host to
   745  // the related backend services. Incoming requests are first evaluated for a host
   746  // match, then routed to the backend associated with the matching IngressRuleValue.
   747  type IngressRule struct {
   748  	// Host is the fully qualified domain name of a network host, as defined by RFC 3986.
   749  	// Note the following deviations from the "host" part of the
   750  	// URI as defined in RFC 3986:
   751  	// 1. IPs are not allowed. Currently an IngressRuleValue can only apply to
   752  	//    the IP in the Spec of the parent Ingress.
   753  	// 2. The `:` delimiter is not respected because ports are not allowed.
   754  	//	  Currently the port of an Ingress is implicitly :80 for http and
   755  	//	  :443 for https.
   756  	// Both these may change in the future.
   757  	// Incoming requests are matched against the host before the
   758  	// IngressRuleValue. If the host is unspecified, the Ingress routes all
   759  	// traffic based on the specified IngressRuleValue.
   760  	//
   761  	// Host can be "precise" which is a domain name without the terminating dot of
   762  	// a network host (e.g. "foo.bar.com") or "wildcard", which is a domain name
   763  	// prefixed with a single wildcard label (e.g. "*.foo.com").
   764  	// The wildcard character '*' must appear by itself as the first DNS label and
   765  	// matches only a single label. You cannot have a wildcard label by itself (e.g. Host == "*").
   766  	// Requests will be matched against the Host field in the following way:
   767  	// 1. If Host is precise, the request matches this rule if the http host header is equal to Host.
   768  	// 2. If Host is a wildcard, then the request matches this rule if the http host header
   769  	// is to equal to the suffix (removing the first label) of the wildcard rule.
   770  	// +optional
   771  	Host string `json:"host,omitempty" protobuf:"bytes,1,opt,name=host"`
   772  	// IngressRuleValue represents a rule to route requests for this IngressRule.
   773  	// If unspecified, the rule defaults to a http catch-all. Whether that sends
   774  	// just traffic matching the host to the default backend or all traffic to the
   775  	// default backend, is left to the controller fulfilling the Ingress. Http is
   776  	// currently the only supported IngressRuleValue.
   777  	// +optional
   778  	IngressRuleValue `json:",inline,omitempty" protobuf:"bytes,2,opt,name=ingressRuleValue"`
   779  }
   780  
   781  // IngressRuleValue represents a rule to apply against incoming requests. If the
   782  // rule is satisfied, the request is routed to the specified backend. Currently
   783  // mixing different types of rules in a single Ingress is disallowed, so exactly
   784  // one of the following must be set.
   785  type IngressRuleValue struct {
   786  	//TODO:
   787  	// 1. Consider renaming this resource and the associated rules so they
   788  	// aren't tied to Ingress. They can be used to route intra-cluster traffic.
   789  	// 2. Consider adding fields for ingress-type specific global options
   790  	// usable by a loadbalancer, like http keep-alive.
   791  
   792  	// http is a list of http selectors pointing to backends.
   793  	// A path is matched against the path of an incoming request. Currently it can
   794  	// contain characters disallowed from the conventional "path" part of a URL
   795  	// as defined by RFC 3986. Paths must begin with a '/'.
   796  	// A backend defines the referenced service endpoint to which the traffic
   797  	// will be forwarded to.
   798  	HTTP *HTTPIngressRuleValue `json:"http,omitempty" protobuf:"bytes,1,opt,name=http"`
   799  }
   800  
   801  // HTTPIngressRuleValue is a list of http selectors pointing to backends.
   802  // In the example: http://<host>/<path>?<searchpart> -> backend where
   803  // where parts of the url correspond to RFC 3986, this resource will be used
   804  // to match against everything after the last '/' and before the first '?'
   805  // or '#'.
   806  type HTTPIngressRuleValue struct {
   807  	// A collection of paths that map requests to backends.
   808  	// +listType=atomic
   809  	Paths []HTTPIngressPath `json:"paths" protobuf:"bytes,1,rep,name=paths"`
   810  	// TODO: Consider adding fields for ingress-type specific global
   811  	// options usable by a loadbalancer, like http keep-alive.
   812  }
   813  
   814  // PathType represents the type of path referred to by a HTTPIngressPath.
   815  type PathType string
   816  
   817  const (
   818  	// PathTypeExact matches the URL path exactly and with case sensitivity.
   819  	PathTypeExact = PathType("Exact")
   820  
   821  	// PathTypePrefix matches based on a URL path prefix split by '/'. Matching
   822  	// is case sensitive and done on a path element by element basis. A path
   823  	// element refers to the list of labels in the path split by the '/'
   824  	// separator. A request is a match for path p if every p is an element-wise
   825  	// prefix of p of the request path. Note that if the last element of the
   826  	// path is a substring of the last element in request path, it is not a
   827  	// match (e.g. /foo/bar matches /foo/bar/baz, but does not match
   828  	// /foo/barbaz). If multiple matching paths exist in an Ingress spec, the
   829  	// longest matching path is given priority.
   830  	// Examples:
   831  	// - /foo/bar does not match requests to /foo/barbaz
   832  	// - /foo/bar matches request to /foo/bar and /foo/bar/baz
   833  	// - /foo and /foo/ both match requests to /foo and /foo/. If both paths are
   834  	//   present in an Ingress spec, the longest matching path (/foo/) is given
   835  	//   priority.
   836  	PathTypePrefix = PathType("Prefix")
   837  
   838  	// PathTypeImplementationSpecific matching is up to the IngressClass.
   839  	// Implementations can treat this as a separate PathType or treat it
   840  	// identically to Prefix or Exact path types.
   841  	PathTypeImplementationSpecific = PathType("ImplementationSpecific")
   842  )
   843  
   844  // HTTPIngressPath associates a path with a backend. Incoming urls matching the
   845  // path are forwarded to the backend.
   846  type HTTPIngressPath struct {
   847  	// Path is matched against the path of an incoming request. Currently it can
   848  	// contain characters disallowed from the conventional "path" part of a URL
   849  	// as defined by RFC 3986. Paths must begin with a '/'. When unspecified,
   850  	// all paths from incoming requests are matched.
   851  	// +optional
   852  	Path string `json:"path,omitempty" protobuf:"bytes,1,opt,name=path"`
   853  
   854  	// PathType determines the interpretation of the Path matching. PathType can
   855  	// be one of the following values:
   856  	// * Exact: Matches the URL path exactly.
   857  	// * Prefix: Matches based on a URL path prefix split by '/'. Matching is
   858  	//   done on a path element by element basis. A path element refers is the
   859  	//   list of labels in the path split by the '/' separator. A request is a
   860  	//   match for path p if every p is an element-wise prefix of p of the
   861  	//   request path. Note that if the last element of the path is a substring
   862  	//   of the last element in request path, it is not a match (e.g. /foo/bar
   863  	//   matches /foo/bar/baz, but does not match /foo/barbaz).
   864  	// * ImplementationSpecific: Interpretation of the Path matching is up to
   865  	//   the IngressClass. Implementations can treat this as a separate PathType
   866  	//   or treat it identically to Prefix or Exact path types.
   867  	// Implementations are required to support all path types.
   868  	// Defaults to ImplementationSpecific.
   869  	PathType *PathType `json:"pathType,omitempty" protobuf:"bytes,3,opt,name=pathType"`
   870  
   871  	// Backend defines the referenced service endpoint to which the traffic
   872  	// will be forwarded to.
   873  	Backend IngressBackend `json:"backend" protobuf:"bytes,2,opt,name=backend"`
   874  }
   875  
   876  // IngressBackend describes all endpoints for a given service and port.
   877  type IngressBackend struct {
   878  	// Specifies the name of the referenced service.
   879  	// +optional
   880  	ServiceName string `json:"serviceName,omitempty" protobuf:"bytes,1,opt,name=serviceName"`
   881  
   882  	// Specifies the port of the referenced service.
   883  	// +optional
   884  	ServicePort intstr.IntOrString `json:"servicePort,omitempty" protobuf:"bytes,2,opt,name=servicePort"`
   885  
   886  	// Resource is an ObjectRef to another Kubernetes resource in the namespace
   887  	// of the Ingress object. If resource is specified, serviceName and servicePort
   888  	// must not be specified.
   889  	// +optional
   890  	Resource *v1.TypedLocalObjectReference `json:"resource,omitempty" protobuf:"bytes,3,opt,name=resource"`
   891  }
   892  
   893  // +genclient
   894  // +genclient:method=GetScale,verb=get,subresource=scale,result=Scale
   895  // +genclient:method=UpdateScale,verb=update,subresource=scale,input=Scale,result=Scale
   896  // +genclient:method=ApplyScale,verb=apply,subresource=scale,input=Scale,result=Scale
   897  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   898  // +k8s:prerelease-lifecycle-gen:introduced=1.2
   899  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
   900  // +k8s:prerelease-lifecycle-gen:removed=1.16
   901  // +k8s:prerelease-lifecycle-gen:replacement=apps,v1,ReplicaSet
   902  
   903  // DEPRECATED - This group version of ReplicaSet is deprecated by apps/v1beta2/ReplicaSet. See the release notes for
   904  // more information.
   905  // ReplicaSet ensures that a specified number of pod replicas are running at any given time.
   906  type ReplicaSet struct {
   907  	metav1.TypeMeta `json:",inline"`
   908  
   909  	// If the Labels of a ReplicaSet are empty, they are defaulted to
   910  	// be the same as the Pod(s) that the ReplicaSet manages.
   911  	// Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
   912  	// +optional
   913  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   914  
   915  	// Spec defines the specification of the desired behavior of the ReplicaSet.
   916  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   917  	// +optional
   918  	Spec ReplicaSetSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
   919  
   920  	// Status is the most recently observed status of the ReplicaSet.
   921  	// This data may be out of date by some window of time.
   922  	// Populated by the system.
   923  	// Read-only.
   924  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
   925  	// +optional
   926  	Status ReplicaSetStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
   927  }
   928  
   929  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
   930  // +k8s:prerelease-lifecycle-gen:introduced=1.2
   931  // +k8s:prerelease-lifecycle-gen:deprecated=1.8
   932  // +k8s:prerelease-lifecycle-gen:removed=1.16
   933  // +k8s:prerelease-lifecycle-gen:replacement=apps,v1,ReplicaSetList
   934  
   935  // ReplicaSetList is a collection of ReplicaSets.
   936  type ReplicaSetList struct {
   937  	metav1.TypeMeta `json:",inline"`
   938  	// Standard list metadata.
   939  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
   940  	// +optional
   941  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
   942  
   943  	// List of ReplicaSets.
   944  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller
   945  	Items []ReplicaSet `json:"items" protobuf:"bytes,2,rep,name=items"`
   946  }
   947  
   948  // ReplicaSetSpec is the specification of a ReplicaSet.
   949  type ReplicaSetSpec struct {
   950  	// Replicas is the number of desired replicas.
   951  	// This is a pointer to distinguish between explicit zero and unspecified.
   952  	// Defaults to 1.
   953  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
   954  	// +optional
   955  	Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
   956  
   957  	// Minimum number of seconds for which a newly created pod should be ready
   958  	// without any of its container crashing, for it to be considered available.
   959  	// Defaults to 0 (pod will be considered available as soon as it is ready)
   960  	// +optional
   961  	MinReadySeconds int32 `json:"minReadySeconds,omitempty" protobuf:"varint,4,opt,name=minReadySeconds"`
   962  
   963  	// Selector is a label query over pods that should match the replica count.
   964  	// If the selector is empty, it is defaulted to the labels present on the pod template.
   965  	// Label keys and values that must match in order to be controlled by this replica set.
   966  	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
   967  	// +optional
   968  	Selector *metav1.LabelSelector `json:"selector,omitempty" protobuf:"bytes,2,opt,name=selector"`
   969  
   970  	// Template is the object that describes the pod that will be created if
   971  	// insufficient replicas are detected.
   972  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
   973  	// +optional
   974  	Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,3,opt,name=template"`
   975  }
   976  
   977  // ReplicaSetStatus represents the current status of a ReplicaSet.
   978  type ReplicaSetStatus struct {
   979  	// Replicas is the most recently observed number of replicas.
   980  	// More info: https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
   981  	Replicas int32 `json:"replicas" protobuf:"varint,1,opt,name=replicas"`
   982  
   983  	// The number of pods that have labels matching the labels of the pod template of the replicaset.
   984  	// +optional
   985  	FullyLabeledReplicas int32 `json:"fullyLabeledReplicas,omitempty" protobuf:"varint,2,opt,name=fullyLabeledReplicas"`
   986  
   987  	// The number of ready replicas for this replica set.
   988  	// +optional
   989  	ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,4,opt,name=readyReplicas"`
   990  
   991  	// The number of available replicas (ready for at least minReadySeconds) for this replica set.
   992  	// +optional
   993  	AvailableReplicas int32 `json:"availableReplicas,omitempty" protobuf:"varint,5,opt,name=availableReplicas"`
   994  
   995  	// ObservedGeneration reflects the generation of the most recently observed ReplicaSet.
   996  	// +optional
   997  	ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,3,opt,name=observedGeneration"`
   998  
   999  	// Represents the latest available observations of a replica set's current state.
  1000  	// +optional
  1001  	// +patchMergeKey=type
  1002  	// +patchStrategy=merge
  1003  	// +listType=map
  1004  	// +listMapKey=type
  1005  	Conditions []ReplicaSetCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,6,rep,name=conditions"`
  1006  }
  1007  
  1008  type ReplicaSetConditionType string
  1009  
  1010  // These are valid conditions of a replica set.
  1011  const (
  1012  	// ReplicaSetReplicaFailure is added in a replica set when one of its pods fails to be created
  1013  	// due to insufficient quota, limit ranges, pod security policy, node selectors, etc. or deleted
  1014  	// due to kubelet being down or finalizers are failing.
  1015  	ReplicaSetReplicaFailure ReplicaSetConditionType = "ReplicaFailure"
  1016  )
  1017  
  1018  // ReplicaSetCondition describes the state of a replica set at a certain point.
  1019  type ReplicaSetCondition struct {
  1020  	// Type of replica set condition.
  1021  	Type ReplicaSetConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ReplicaSetConditionType"`
  1022  	// Status of the condition, one of True, False, Unknown.
  1023  	Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
  1024  	// The last time the condition transitioned from one status to another.
  1025  	// +optional
  1026  	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
  1027  	// The reason for the condition's last transition.
  1028  	// +optional
  1029  	Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
  1030  	// A human readable message indicating details about the transition.
  1031  	// +optional
  1032  	Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
  1033  }
  1034  
  1035  // +genclient
  1036  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  1037  // +k8s:prerelease-lifecycle-gen:introduced=1.3
  1038  // +k8s:prerelease-lifecycle-gen:deprecated=1.9
  1039  // +k8s:prerelease-lifecycle-gen:removed=1.16
  1040  // +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1,NetworkPolicy
  1041  
  1042  // DEPRECATED 1.9 - This group version of NetworkPolicy is deprecated by networking/v1/NetworkPolicy.
  1043  // NetworkPolicy describes what network traffic is allowed for a set of Pods
  1044  type NetworkPolicy struct {
  1045  	metav1.TypeMeta `json:",inline"`
  1046  	// Standard object's metadata.
  1047  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  1048  	// +optional
  1049  	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
  1050  
  1051  	// Specification of the desired behavior for this NetworkPolicy.
  1052  	// +optional
  1053  	Spec NetworkPolicySpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
  1054  
  1055  	// Status is tombstoned to show why 3 is a reserved protobuf tag.
  1056  	// This commented field should remain, so in the future if we decide to reimplement
  1057  	// NetworkPolicyStatus a different protobuf name and tag SHOULD be used!
  1058  	// Status NetworkPolicyStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
  1059  }
  1060  
  1061  // DEPRECATED 1.9 - This group version of PolicyType is deprecated by networking/v1/PolicyType.
  1062  // Policy Type string describes the NetworkPolicy type
  1063  // This type is beta-level in 1.8
  1064  type PolicyType string
  1065  
  1066  const (
  1067  	// PolicyTypeIngress is a NetworkPolicy that affects ingress traffic on selected pods
  1068  	PolicyTypeIngress PolicyType = "Ingress"
  1069  	// PolicyTypeEgress is a NetworkPolicy that affects egress traffic on selected pods
  1070  	PolicyTypeEgress PolicyType = "Egress"
  1071  )
  1072  
  1073  // DEPRECATED 1.9 - This group version of NetworkPolicySpec is deprecated by networking/v1/NetworkPolicySpec.
  1074  type NetworkPolicySpec struct {
  1075  	// Selects the pods to which this NetworkPolicy object applies.  The array of ingress rules
  1076  	// is applied to any pods selected by this field. Multiple network policies can select the
  1077  	// same set of pods.  In this case, the ingress rules for each are combined additively.
  1078  	// This field is NOT optional and follows standard label selector semantics.
  1079  	// An empty podSelector matches all pods in this namespace.
  1080  	PodSelector metav1.LabelSelector `json:"podSelector" protobuf:"bytes,1,opt,name=podSelector"`
  1081  
  1082  	// List of ingress rules to be applied to the selected pods.
  1083  	// Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod
  1084  	// OR if the traffic source is the pod's local node,
  1085  	// OR if the traffic matches at least one ingress rule across all of the NetworkPolicy
  1086  	// objects whose podSelector matches the pod.
  1087  	// If this field is empty then this NetworkPolicy does not allow any traffic
  1088  	// (and serves solely to ensure that the pods it selects are isolated by default).
  1089  	// +optional
  1090  	// +listType=atomic
  1091  	Ingress []NetworkPolicyIngressRule `json:"ingress,omitempty" protobuf:"bytes,2,rep,name=ingress"`
  1092  
  1093  	// List of egress rules to be applied to the selected pods. Outgoing traffic is
  1094  	// allowed if there are no NetworkPolicies selecting the pod (and cluster policy
  1095  	// otherwise allows the traffic), OR if the traffic matches at least one egress rule
  1096  	// across all of the NetworkPolicy objects whose podSelector matches the pod. If
  1097  	// this field is empty then this NetworkPolicy limits all outgoing traffic (and serves
  1098  	// solely to ensure that the pods it selects are isolated by default).
  1099  	// This field is beta-level in 1.8
  1100  	// +optional
  1101  	// +listType=atomic
  1102  	Egress []NetworkPolicyEgressRule `json:"egress,omitempty" protobuf:"bytes,3,rep,name=egress"`
  1103  
  1104  	// List of rule types that the NetworkPolicy relates to.
  1105  	// Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"].
  1106  	// If this field is not specified, it will default based on the existence of Ingress or Egress rules;
  1107  	// policies that contain an Egress section are assumed to affect Egress, and all policies
  1108  	// (whether or not they contain an Ingress section) are assumed to affect Ingress.
  1109  	// If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ].
  1110  	// Likewise, if you want to write a policy that specifies that no egress is allowed,
  1111  	// you must specify a policyTypes value that include "Egress" (since such a policy would not include
  1112  	// an Egress section and would otherwise default to just [ "Ingress" ]).
  1113  	// This field is beta-level in 1.8
  1114  	// +optional
  1115  	// +listType=atomic
  1116  	PolicyTypes []PolicyType `json:"policyTypes,omitempty" protobuf:"bytes,4,rep,name=policyTypes,casttype=PolicyType"`
  1117  }
  1118  
  1119  // DEPRECATED 1.9 - This group version of NetworkPolicyIngressRule is deprecated by networking/v1/NetworkPolicyIngressRule.
  1120  // This NetworkPolicyIngressRule matches traffic if and only if the traffic matches both ports AND from.
  1121  type NetworkPolicyIngressRule struct {
  1122  	// List of ports which should be made accessible on the pods selected for this rule.
  1123  	// Each item in this list is combined using a logical OR.
  1124  	// If this field is empty or missing, this rule matches all ports (traffic not restricted by port).
  1125  	// If this field is present and contains at least one item, then this rule allows traffic
  1126  	// only if the traffic matches at least one port in the list.
  1127  	// +optional
  1128  	// +listType=atomic
  1129  	Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"`
  1130  
  1131  	// List of sources which should be able to access the pods selected for this rule.
  1132  	// Items in this list are combined using a logical OR operation.
  1133  	// If this field is empty or missing, this rule matches all sources (traffic not restricted by source).
  1134  	// If this field is present and contains at least one item, this rule allows traffic only if the
  1135  	// traffic matches at least one item in the from list.
  1136  	// +optional
  1137  	// +listType=atomic
  1138  	From []NetworkPolicyPeer `json:"from,omitempty" protobuf:"bytes,2,rep,name=from"`
  1139  }
  1140  
  1141  // DEPRECATED 1.9 - This group version of NetworkPolicyEgressRule is deprecated by networking/v1/NetworkPolicyEgressRule.
  1142  // NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods
  1143  // matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to.
  1144  // This type is beta-level in 1.8
  1145  type NetworkPolicyEgressRule struct {
  1146  	// List of destination ports for outgoing traffic.
  1147  	// Each item in this list is combined using a logical OR. If this field is
  1148  	// empty or missing, this rule matches all ports (traffic not restricted by port).
  1149  	// If this field is present and contains at least one item, then this rule allows
  1150  	// traffic only if the traffic matches at least one port in the list.
  1151  	// +optional
  1152  	// +listType=atomic
  1153  	Ports []NetworkPolicyPort `json:"ports,omitempty" protobuf:"bytes,1,rep,name=ports"`
  1154  
  1155  	// List of destinations for outgoing traffic of pods selected for this rule.
  1156  	// Items in this list are combined using a logical OR operation. If this field is
  1157  	// empty or missing, this rule matches all destinations (traffic not restricted by
  1158  	// destination). If this field is present and contains at least one item, this rule
  1159  	// allows traffic only if the traffic matches at least one item in the to list.
  1160  	// +optional
  1161  	// +listType=atomic
  1162  	To []NetworkPolicyPeer `json:"to,omitempty" protobuf:"bytes,2,rep,name=to"`
  1163  }
  1164  
  1165  // DEPRECATED 1.9 - This group version of NetworkPolicyPort is deprecated by networking/v1/NetworkPolicyPort.
  1166  type NetworkPolicyPort struct {
  1167  	// Optional.  The protocol (TCP, UDP, or SCTP) which traffic must match.
  1168  	// If not specified, this field defaults to TCP.
  1169  	// +optional
  1170  	Protocol *v1.Protocol `json:"protocol,omitempty" protobuf:"bytes,1,opt,name=protocol,casttype=k8s.io/api/core/v1.Protocol"`
  1171  
  1172  	// The port on the given protocol. This can either be a numerical or named
  1173  	// port on a pod. If this field is not provided, this matches all port names and
  1174  	// numbers.
  1175  	// If present, only traffic on the specified protocol AND port will be matched.
  1176  	// +optional
  1177  	Port *intstr.IntOrString `json:"port,omitempty" protobuf:"bytes,2,opt,name=port"`
  1178  
  1179  	// If set, indicates that the range of ports from port to endPort, inclusive,
  1180  	// should be allowed by the policy. This field cannot be defined if the port field
  1181  	// is not defined or if the port field is defined as a named (string) port.
  1182  	// The endPort must be equal or greater than port.
  1183  	// +optional
  1184  	EndPort *int32 `json:"endPort,omitempty" protobuf:"bytes,3,opt,name=endPort"`
  1185  }
  1186  
  1187  // DEPRECATED 1.9 - This group version of IPBlock is deprecated by networking/v1/IPBlock.
  1188  // IPBlock describes a particular CIDR (Ex. "192.168.1.0/24","2001:db8::/64") that is allowed
  1189  // to the pods matched by a NetworkPolicySpec's podSelector. The except entry describes CIDRs
  1190  // that should not be included within this rule.
  1191  type IPBlock struct {
  1192  	// CIDR is a string representing the IP Block
  1193  	// Valid examples are "192.168.1.0/24" or "2001:db8::/64"
  1194  	CIDR string `json:"cidr" protobuf:"bytes,1,name=cidr"`
  1195  	// Except is a slice of CIDRs that should not be included within an IP Block
  1196  	// Valid examples are "192.168.1.0/24" or "2001:db8::/64"
  1197  	// Except values will be rejected if they are outside the CIDR range
  1198  	// +optional
  1199  	// +listType=atomic
  1200  	Except []string `json:"except,omitempty" protobuf:"bytes,2,rep,name=except"`
  1201  }
  1202  
  1203  // DEPRECATED 1.9 - This group version of NetworkPolicyPeer is deprecated by networking/v1/NetworkPolicyPeer.
  1204  type NetworkPolicyPeer struct {
  1205  	// This is a label selector which selects Pods. This field follows standard label
  1206  	// selector semantics; if present but empty, it selects all pods.
  1207  	//
  1208  	// If NamespaceSelector is also set, then the NetworkPolicyPeer as a whole selects
  1209  	// the Pods matching PodSelector in the Namespaces selected by NamespaceSelector.
  1210  	// Otherwise it selects the Pods matching PodSelector in the policy's own Namespace.
  1211  	// +optional
  1212  	PodSelector *metav1.LabelSelector `json:"podSelector,omitempty" protobuf:"bytes,1,opt,name=podSelector"`
  1213  
  1214  	// Selects Namespaces using cluster-scoped labels. This field follows standard label
  1215  	// selector semantics; if present but empty, it selects all namespaces.
  1216  	//
  1217  	// If PodSelector is also set, then the NetworkPolicyPeer as a whole selects
  1218  	// the Pods matching PodSelector in the Namespaces selected by NamespaceSelector.
  1219  	// Otherwise it selects all Pods in the Namespaces selected by NamespaceSelector.
  1220  	// +optional
  1221  	NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty" protobuf:"bytes,2,opt,name=namespaceSelector"`
  1222  
  1223  	// IPBlock defines policy on a particular IPBlock. If this field is set then
  1224  	// neither of the other fields can be.
  1225  	// +optional
  1226  	IPBlock *IPBlock `json:"ipBlock,omitempty" protobuf:"bytes,3,rep,name=ipBlock"`
  1227  }
  1228  
  1229  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
  1230  // +k8s:prerelease-lifecycle-gen:introduced=1.3
  1231  // +k8s:prerelease-lifecycle-gen:deprecated=1.9
  1232  // +k8s:prerelease-lifecycle-gen:removed=1.16
  1233  // +k8s:prerelease-lifecycle-gen:replacement=networking.k8s.io,v1,NetworkPolicyList
  1234  
  1235  // DEPRECATED 1.9 - This group version of NetworkPolicyList is deprecated by networking/v1/NetworkPolicyList.
  1236  // Network Policy List is a list of NetworkPolicy objects.
  1237  type NetworkPolicyList struct {
  1238  	metav1.TypeMeta `json:",inline"`
  1239  	// Standard list metadata.
  1240  	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
  1241  	// +optional
  1242  	metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
  1243  
  1244  	// Items is a list of schema objects.
  1245  	Items []NetworkPolicy `json:"items" protobuf:"bytes,2,rep,name=items"`
  1246  }
  1247  

View as plain text