github.com/enmand/kubernetes@v1.2.0-alpha.0/pkg/apis/experimental/v1alpha1/types.go (about)

     1  /*
     2  Copyright 2015 The Kubernetes Authors All rights reserved.
     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 v1alpha1
    18  
    19  import (
    20  	"k8s.io/kubernetes/pkg/api/resource"
    21  	"k8s.io/kubernetes/pkg/api/unversioned"
    22  	"k8s.io/kubernetes/pkg/api/v1"
    23  	"k8s.io/kubernetes/pkg/util"
    24  )
    25  
    26  // ScaleSpec describes the attributes a Scale subresource
    27  type ScaleSpec struct {
    28  	// Replicas is the number of desired replicas. More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller"
    29  	Replicas int `json:"replicas,omitempty"`
    30  }
    31  
    32  // ScaleStatus represents the current status of a Scale subresource.
    33  type ScaleStatus struct {
    34  	// Replicas is the number of actual replicas. More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#what-is-a-replication-controller
    35  	Replicas int `json:"replicas"`
    36  
    37  	// Selector is a label query over pods that should match the replicas count. If it is empty, it is defaulted to labels on Pod template; More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
    38  	Selector map[string]string `json:"selector,omitempty"`
    39  }
    40  
    41  // Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
    42  type Scale struct {
    43  	unversioned.TypeMeta `json:",inline"`
    44  	// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
    45  	v1.ObjectMeta `json:"metadata,omitempty"`
    46  
    47  	// Spec defines the behavior of the scale. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status.
    48  	Spec ScaleSpec `json:"spec,omitempty"`
    49  
    50  	// Status represents the current status of the scale. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status. Read-only.
    51  	Status ScaleStatus `json:"status,omitempty"`
    52  }
    53  
    54  // Dummy definition
    55  type ReplicationControllerDummy struct {
    56  	unversioned.TypeMeta `json:",inline"`
    57  }
    58  
    59  // SubresourceReference contains enough information to let you inspect or modify the referred subresource.
    60  type SubresourceReference struct {
    61  	// Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
    62  	Kind string `json:"kind,omitempty"`
    63  	// Namespace of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md
    64  	Namespace string `json:"namespace,omitempty"`
    65  	// Name of the referent; More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names
    66  	Name string `json:"name,omitempty"`
    67  	// API version of the referent
    68  	APIVersion string `json:"apiVersion,omitempty"`
    69  	// Subresource name of the referent
    70  	Subresource string `json:"subresource,omitempty"`
    71  }
    72  
    73  // ResourceConsumption is an object for specifying average resource consumption of a particular resource.
    74  type ResourceConsumption struct {
    75  	// Resource specifies either the name of the target resource when present in the spec, or the name of the observed resource when present in the status.
    76  	Resource v1.ResourceName `json:"resource,omitempty"`
    77  	// Quantity specifies either the target average consumption of the resource when present in the spec, or the observed average consumption when present in the status.
    78  	Quantity resource.Quantity `json:"quantity,omitempty"`
    79  }
    80  
    81  // HorizontalPodAutoscalerSpec is the specification of a horizontal pod autoscaler.
    82  type HorizontalPodAutoscalerSpec struct {
    83  	// ScaleRef is a reference to Scale subresource. HorizontalPodAutoscaler will learn the current resource consumption from its status,
    84  	// and will set the desired number of pods by modyfying its spec.
    85  	ScaleRef *SubresourceReference `json:"scaleRef"`
    86  	// MinReplicas is the lower limit for the number of pods that can be set by the autoscaler.
    87  	MinReplicas int `json:"minReplicas"`
    88  	// MaxReplicas is the upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas.
    89  	MaxReplicas int `json:"maxReplicas"`
    90  	// Target is the target average consumption of the given resource that the autoscaler will try to maintain by adjusting the desired number of pods.
    91  	// Currently two types of resources are supported: "cpu" and "memory".
    92  	Target ResourceConsumption `json:"target"`
    93  }
    94  
    95  // HorizontalPodAutoscalerStatus contains the current status of a horizontal pod autoscaler
    96  type HorizontalPodAutoscalerStatus struct {
    97  	// CurrentReplicas is the number of replicas of pods managed by this autoscaler.
    98  	CurrentReplicas int `json:"currentReplicas"`
    99  
   100  	// DesiredReplicas is the desired number of replicas of pods managed by this autoscaler.
   101  	DesiredReplicas int `json:"desiredReplicas"`
   102  
   103  	// CurrentConsumption is the current average consumption of the given resource that the autoscaler will
   104  	// try to maintain by adjusting the desired number of pods.
   105  	// Two types of resources are supported: "cpu" and "memory".
   106  	CurrentConsumption *ResourceConsumption `json:"currentConsumption"`
   107  
   108  	// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
   109  	// This is used by the autoscaler to controll how often the number of pods is changed.
   110  	LastScaleTimestamp *unversioned.Time `json:"lastScaleTimestamp,omitempty"`
   111  }
   112  
   113  // HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
   114  type HorizontalPodAutoscaler struct {
   115  	unversioned.TypeMeta `json:",inline"`
   116  	// Standard object metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   117  	v1.ObjectMeta `json:"metadata,omitempty"`
   118  
   119  	// Spec defines the behaviour of autoscaler. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status.
   120  	Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty"`
   121  
   122  	// Status represents the current information about the autoscaler.
   123  	Status *HorizontalPodAutoscalerStatus `json:"status,omitempty"`
   124  }
   125  
   126  // HorizontalPodAutoscalerList is a list of HorizontalPodAutoscalers.
   127  type HorizontalPodAutoscalerList struct {
   128  	unversioned.TypeMeta `json:",inline"`
   129  	// Standard list metadata.
   130  	unversioned.ListMeta `json:"metadata,omitempty"`
   131  
   132  	// Items is the list of HorizontalPodAutoscalers.
   133  	Items []HorizontalPodAutoscaler `json:"items"`
   134  }
   135  
   136  // A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
   137  // types to the API.  It consists of one or more Versions of the api.
   138  type ThirdPartyResource struct {
   139  	unversioned.TypeMeta `json:",inline"`
   140  
   141  	// Standard object metadata
   142  	v1.ObjectMeta `json:"metadata,omitempty"`
   143  
   144  	// Description is the description of this object.
   145  	Description string `json:"description,omitempty"`
   146  
   147  	// Versions are versions for this third party object
   148  	Versions []APIVersion `json:"versions,omitempty"`
   149  }
   150  
   151  // ThirdPartyResourceList is a list of ThirdPartyResources.
   152  type ThirdPartyResourceList struct {
   153  	unversioned.TypeMeta `json:",inline"`
   154  
   155  	// Standard list metadata.
   156  	unversioned.ListMeta `json:"metadata,omitempty"`
   157  
   158  	// Items is the list of ThirdPartyResources.
   159  	Items []ThirdPartyResource `json:"items"`
   160  }
   161  
   162  // An APIVersion represents a single concrete version of an object model.
   163  type APIVersion struct {
   164  	// Name of this version (e.g. 'v1').
   165  	Name string `json:"name,omitempty"`
   166  
   167  	// The API group to add this object into, default 'experimental'.
   168  	APIGroup string `json:"apiGroup,omitempty"`
   169  }
   170  
   171  // An internal object, used for versioned storage in etcd.  Not exposed to the end user.
   172  type ThirdPartyResourceData struct {
   173  	unversioned.TypeMeta `json:",inline"`
   174  	// Standard object metadata.
   175  	v1.ObjectMeta `json:"metadata,omitempty"`
   176  
   177  	// Data is the raw JSON data for this data.
   178  	Data []byte `json:"name,omitempty"`
   179  }
   180  
   181  // Deployment enables declarative updates for Pods and ReplicationControllers.
   182  type Deployment struct {
   183  	unversioned.TypeMeta `json:",inline"`
   184  	// Standard object metadata.
   185  	v1.ObjectMeta `json:"metadata,omitempty"`
   186  
   187  	// Specification of the desired behavior of the Deployment.
   188  	Spec DeploymentSpec `json:"spec,omitempty"`
   189  
   190  	// Most recently observed status of the Deployment.
   191  	Status DeploymentStatus `json:"status,omitempty"`
   192  }
   193  
   194  // DeploymentSpec is the specification of the desired behavior of the Deployment.
   195  type DeploymentSpec struct {
   196  	// Number of desired pods. This is a pointer to distinguish between explicit
   197  	// zero and not specified. Defaults to 1.
   198  	Replicas *int `json:"replicas,omitempty"`
   199  
   200  	// Label selector for pods. Existing ReplicationControllers whose pods are
   201  	// selected by this will be scaled down.
   202  	Selector map[string]string `json:"selector,omitempty"`
   203  
   204  	// Template describes the pods that will be created.
   205  	Template *v1.PodTemplateSpec `json:"template,omitempty"`
   206  
   207  	// The deployment strategy to use to replace existing pods with new ones.
   208  	Strategy DeploymentStrategy `json:"strategy,omitempty"`
   209  
   210  	// Key of the selector that is added to existing RCs (and label key that is
   211  	// added to its pods) to prevent the existing RCs to select new pods (and old
   212  	// pods being selected by new RC).
   213  	// Users can set this to an empty string to indicate that the system should
   214  	// not add any selector and label. If unspecified, system uses
   215  	// "deployment.kubernetes.io/podTemplateHash".
   216  	// Value of this key is hash of DeploymentSpec.PodTemplateSpec.
   217  	// No label is added if this is set to empty string.
   218  	UniqueLabelKey *string `json:"uniqueLabelKey,omitempty"`
   219  }
   220  
   221  // DeploymentStrategy describes how to replace existing pods with new ones.
   222  type DeploymentStrategy struct {
   223  	// Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate.
   224  	Type DeploymentStrategyType `json:"type,omitempty"`
   225  
   226  	// Rolling update config params. Present only if DeploymentStrategyType =
   227  	// RollingUpdate.
   228  	//---
   229  	// TODO: Update this to follow our convention for oneOf, whatever we decide it
   230  	// to be.
   231  	RollingUpdate *RollingUpdateDeployment `json:"rollingUpdate,omitempty"`
   232  }
   233  
   234  type DeploymentStrategyType string
   235  
   236  const (
   237  	// Kill all existing pods before creating new ones.
   238  	RecreateDeploymentStrategyType DeploymentStrategyType = "Recreate"
   239  
   240  	// Replace the old RCs by new one using rolling update i.e gradually scale down the old RCs and scale up the new one.
   241  	RollingUpdateDeploymentStrategyType DeploymentStrategyType = "RollingUpdate"
   242  )
   243  
   244  // Spec to control the desired behavior of rolling update.
   245  type RollingUpdateDeployment struct {
   246  	// The maximum number of pods that can be unavailable during the update.
   247  	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
   248  	// Absolute number is calculated from percentage by rounding up.
   249  	// This can not be 0 if MaxSurge is 0.
   250  	// By default, a fixed value of 1 is used.
   251  	// Example: when this is set to 30%, the old RC can be scaled down to 70% of desired pods
   252  	// immediately when the rolling update starts. Once new pods are ready, old RC
   253  	// can be scaled down further, followed by scaling up the new RC, ensuring
   254  	// that the total number of pods available at all times during the update is at
   255  	// least 70% of desired pods.
   256  	MaxUnavailable *util.IntOrString `json:"maxUnavailable,omitempty"`
   257  
   258  	// The maximum number of pods that can be scheduled above the desired number of
   259  	// pods.
   260  	// Value can be an absolute number (ex: 5) or a percentage of desired pods (ex: 10%).
   261  	// This can not be 0 if MaxUnavailable is 0.
   262  	// Absolute number is calculated from percentage by rounding up.
   263  	// By default, a value of 1 is used.
   264  	// Example: when this is set to 30%, the new RC can be scaled up immediately when
   265  	// the rolling update starts, such that the total number of old and new pods do not exceed
   266  	// 130% of desired pods. Once old pods have been killed,
   267  	// new RC can be scaled up further, ensuring that total number of pods running
   268  	// at any time during the update is atmost 130% of desired pods.
   269  	MaxSurge *util.IntOrString `json:"maxSurge,omitempty"`
   270  
   271  	// Minimum number of seconds for which a newly created pod should be ready
   272  	// without any of its container crashing, for it to be considered available.
   273  	// Defaults to 0 (pod will be considered available as soon as it is ready)
   274  	MinReadySeconds int `json:"minReadySeconds,omitempty"`
   275  }
   276  
   277  // DeploymentStatus is the most recently observed status of the Deployment.
   278  type DeploymentStatus struct {
   279  	// Total number of ready pods targeted by this deployment (this
   280  	// includes both the old and new pods).
   281  	Replicas int `json:"replicas,omitempty"`
   282  
   283  	// Total number of new ready pods with the desired template spec.
   284  	UpdatedReplicas int `json:"updatedReplicas,omitempty"`
   285  }
   286  
   287  // DeploymentList is a list of Deployments.
   288  type DeploymentList struct {
   289  	unversioned.TypeMeta `json:",inline"`
   290  	// Standard list metadata.
   291  	unversioned.ListMeta `json:"metadata,omitempty"`
   292  
   293  	// Items is the list of Deployments.
   294  	Items []Deployment `json:"items"`
   295  }
   296  
   297  // DaemonSetSpec is the specification of a daemon set.
   298  type DaemonSetSpec struct {
   299  	// Selector is a label query over pods that are managed by the daemon set.
   300  	// Must match in order to be controlled.
   301  	// If empty, defaulted to labels on Pod template.
   302  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
   303  	Selector map[string]string `json:"selector,omitempty"`
   304  
   305  	// Template is the object that describes the pod that will be created.
   306  	// The DaemonSet will create exactly one copy of this pod on every node
   307  	// that matches the template's node selector (or on every node if no node
   308  	// selector is specified).
   309  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md#pod-template
   310  	Template *v1.PodTemplateSpec `json:"template,omitempty"`
   311  }
   312  
   313  // DaemonSetStatus represents the current status of a daemon set.
   314  type DaemonSetStatus struct {
   315  	// CurrentNumberScheduled is the number of nodes that are running exactly 1
   316  	// daemon pod and are supposed to run the daemon pod.
   317  	// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
   318  	CurrentNumberScheduled int `json:"currentNumberScheduled"`
   319  
   320  	// NumberMisscheduled is the number of nodes that are running the daemon pod, but are
   321  	// not supposed to run the daemon pod.
   322  	// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
   323  	NumberMisscheduled int `json:"numberMisscheduled"`
   324  
   325  	// DesiredNumberScheduled is the total number of nodes that should be running the daemon
   326  	// pod (including nodes correctly running the daemon pod).
   327  	// More info: http://releases.k8s.io/HEAD/docs/admin/daemon.md
   328  	DesiredNumberScheduled int `json:"desiredNumberScheduled"`
   329  }
   330  
   331  // DaemonSet represents the configuration of a daemon set.
   332  type DaemonSet struct {
   333  	unversioned.TypeMeta `json:",inline"`
   334  	// Standard object's metadata.
   335  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   336  	v1.ObjectMeta `json:"metadata,omitempty"`
   337  
   338  	// Spec defines the desired behavior of this daemon set.
   339  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
   340  	Spec DaemonSetSpec `json:"spec,omitempty"`
   341  
   342  	// Status is the current status of this daemon set. This data may be
   343  	// out of date by some window of time.
   344  	// Populated by the system.
   345  	// Read-only.
   346  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
   347  	Status DaemonSetStatus `json:"status,omitempty"`
   348  }
   349  
   350  // DaemonSetList is a collection of daemon sets.
   351  type DaemonSetList struct {
   352  	unversioned.TypeMeta `json:",inline"`
   353  	// Standard list metadata.
   354  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   355  	unversioned.ListMeta `json:"metadata,omitempty"`
   356  
   357  	// Items is a list of daemon sets.
   358  	Items []DaemonSet `json:"items"`
   359  }
   360  
   361  // ThirdPartyResrouceDataList is a list of ThirdPartyResourceData.
   362  type ThirdPartyResourceDataList struct {
   363  	unversioned.TypeMeta `json:",inline"`
   364  	// Standard list metadata
   365  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   366  	unversioned.ListMeta `json:"metadata,omitempty"`
   367  
   368  	// Items is the list of ThirdpartyResourceData.
   369  	Items []ThirdPartyResourceData `json:"items"`
   370  }
   371  
   372  // Job represents the configuration of a single job.
   373  type Job struct {
   374  	unversioned.TypeMeta `json:",inline"`
   375  	// Standard object's metadata.
   376  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   377  	v1.ObjectMeta `json:"metadata,omitempty"`
   378  
   379  	// Spec is a structure defining the expected behavior of a job.
   380  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
   381  	Spec JobSpec `json:"spec,omitempty"`
   382  
   383  	// Status is a structure describing current status of a job.
   384  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
   385  	Status JobStatus `json:"status,omitempty"`
   386  }
   387  
   388  // JobList is a collection of jobs.
   389  type JobList struct {
   390  	unversioned.TypeMeta `json:",inline"`
   391  	// Standard list metadata
   392  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   393  	unversioned.ListMeta `json:"metadata,omitempty"`
   394  
   395  	// Items is the list of Job.
   396  	Items []Job `json:"items"`
   397  }
   398  
   399  // JobSpec describes how the job execution will look like.
   400  type JobSpec struct {
   401  
   402  	// Parallelism specifies the maximum desired number of pods the job should
   403  	// run at any given time. The actual number of pods running in steady state will
   404  	// be less than this number when ((.spec.completions - .status.successful) < .spec.parallelism),
   405  	// i.e. when the work left to do is less than max parallelism.
   406  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
   407  	Parallelism *int `json:"parallelism,omitempty"`
   408  
   409  	// Completions specifies the desired number of successfully finished pods the
   410  	// job should be run with. Defaults to 1.
   411  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
   412  	Completions *int `json:"completions,omitempty"`
   413  
   414  	// Selector is a label query over pods that should match the pod count.
   415  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/labels.md#label-selectors
   416  	Selector map[string]string `json:"selector,omitempty"`
   417  
   418  	// Template is the object that describes the pod that will be created when
   419  	// executing a job.
   420  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
   421  	Template *v1.PodTemplateSpec `json:"template"`
   422  }
   423  
   424  // JobStatus represents the current state of a Job.
   425  type JobStatus struct {
   426  
   427  	// Conditions represent the latest available observations of an object's current state.
   428  	// More info: http://releases.k8s.io/HEAD/docs/user-guide/jobs.md
   429  	Conditions []JobCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
   430  
   431  	// StartTime represents time when the job was acknowledged by the Job Manager.
   432  	// It is not guaranteed to be set in happens-before order across separate operations.
   433  	// It is represented in RFC3339 form and is in UTC.
   434  	StartTime *unversioned.Time `json:"startTime,omitempty"`
   435  
   436  	// CompletionTime represents time when the job was completed. It is not guaranteed to
   437  	// be set in happens-before order across separate operations.
   438  	// It is represented in RFC3339 form and is in UTC.
   439  	CompletionTime *unversioned.Time `json:"completionTime,omitempty"`
   440  
   441  	// Active is the number of actively running pods.
   442  	Active int `json:"active,omitempty"`
   443  
   444  	// Successful is the number of pods which reached Phase Succeeded.
   445  	Successful int `json:"successful,omitempty"`
   446  
   447  	// Unsuccessful is the number of pods failures, this applies only to jobs
   448  	// created with RestartPolicyNever, otherwise this value will always be 0.
   449  	Unsuccessful int `json:"unsuccessful,omitempty"`
   450  }
   451  
   452  type JobConditionType string
   453  
   454  // These are valid conditions of a job.
   455  const (
   456  	// JobComplete means the job has completed its execution.
   457  	JobComplete JobConditionType = "Complete"
   458  )
   459  
   460  // JobCondition describes current state of a job.
   461  type JobCondition struct {
   462  	// Type of job condition, currently only Complete.
   463  	Type JobConditionType `json:"type"`
   464  	// Status of the condition, one of True, False, Unknown.
   465  	Status v1.ConditionStatus `json:"status"`
   466  	// Last time the condition was checked.
   467  	LastProbeTime unversioned.Time `json:"lastProbeTime,omitempty"`
   468  	// Last time the condition transit from one status to another.
   469  	LastTransitionTime unversioned.Time `json:"lastTransitionTime,omitempty"`
   470  	// (brief) reason for the condition's last transition.
   471  	Reason string `json:"reason,omitempty"`
   472  	// Human readable message indicating details about last transition.
   473  	Message string `json:"message,omitempty"`
   474  }
   475  
   476  // An Ingress is a way to give services externally-reachable urls. Each Ingress is a
   477  // collection of rules that allow inbound connections to reach the endpoints defined by
   478  // a backend.
   479  type Ingress struct {
   480  	unversioned.TypeMeta `json:",inline"`
   481  	// Standard object's metadata.
   482  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   483  	v1.ObjectMeta `json:"metadata,omitempty"`
   484  
   485  	// Spec is the desired state of the Ingress.
   486  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
   487  	Spec IngressSpec `json:"spec,omitempty"`
   488  
   489  	// Status is the current state of the Ingress.
   490  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
   491  	Status IngressStatus `json:"status,omitempty"`
   492  }
   493  
   494  // IngressList is a collection of Ingress.
   495  type IngressList struct {
   496  	unversioned.TypeMeta `json:",inline"`
   497  	// Standard object's metadata.
   498  	// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
   499  	unversioned.ListMeta `json:"metadata,omitempty"`
   500  
   501  	// Items is the list of Ingress.
   502  	Items []Ingress `json:"items"`
   503  }
   504  
   505  // IngressSpec describes the Ingress the user wishes to exist.
   506  type IngressSpec struct {
   507  	// TODO: Add the ability to specify load-balancer IP just like what Service has already done?
   508  	// A list of rules used to configure the Ingress.
   509  	// http://<host>:<port>/<path>?<searchpart> -> IngressBackend
   510  	// Where parts of the url conform to RFC 1738.
   511  	Rules []IngressRule `json:"rules"`
   512  }
   513  
   514  // IngressStatus describe the current state of the Ingress.
   515  type IngressStatus struct {
   516  	// LoadBalancer contains the current status of the load-balancer.
   517  	LoadBalancer v1.LoadBalancerStatus `json:"loadBalancer,omitempty"`
   518  }
   519  
   520  // IngressRule represents the rules mapping the paths under a specified host to the related backend services.
   521  type IngressRule struct {
   522  	// Host is the fully qualified domain name of a network host, or its IP
   523  	// address as a set of four decimal digit groups separated by ".".
   524  	// Conforms to RFC 1738.
   525  	Host string `json:"host,omitempty"`
   526  
   527  	// Paths describe a list of load-balancer rules under the specified host.
   528  	Paths []IngressPath `json:"paths"`
   529  }
   530  
   531  // IngressPath associates a path regex with an IngressBackend.
   532  // Incoming urls matching the Path are forwarded to the Backend.
   533  type IngressPath struct {
   534  	// Path is a regex matched against the url of an incoming request.
   535  	Path string `json:"path,omitempty"`
   536  
   537  	// Define the referenced service endpoint which the traffic will be forwarded to.
   538  	Backend IngressBackend `json:"backend"`
   539  }
   540  
   541  // IngressBackend describes all endpoints for a given Service, port and protocol.
   542  type IngressBackend struct {
   543  	// Specifies the referenced service.
   544  	ServiceRef v1.LocalObjectReference `json:"serviceRef"`
   545  
   546  	// Specifies the port of the referenced service.
   547  	ServicePort util.IntOrString `json:"servicePort,omitempty"`
   548  
   549  	// Specifies the protocol of the referenced service.
   550  	Protocol v1.Protocol `json:"protocol,omitempty"`
   551  }