...

Source file src/sigs.k8s.io/gateway-api/apis/v1/object_reference_types.go

Documentation: sigs.k8s.io/gateway-api/apis/v1

     1  /*
     2  Copyright 2020 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 v1
    18  
    19  // LocalObjectReference identifies an API object within the namespace of the
    20  // referrer.
    21  // The API object must be valid in the cluster; the Group and Kind must
    22  // be registered in the cluster for this reference to be valid.
    23  //
    24  // References to objects with invalid Group and Kind are not valid, and must
    25  // be rejected by the implementation, with appropriate Conditions set
    26  // on the containing object.
    27  type LocalObjectReference struct {
    28  	// Group is the group of the referent. For example, "gateway.networking.k8s.io".
    29  	// When unspecified or empty string, core API group is inferred.
    30  	Group Group `json:"group"`
    31  
    32  	// Kind is kind of the referent. For example "HTTPRoute" or "Service".
    33  	Kind Kind `json:"kind"`
    34  
    35  	// Name is the name of the referent.
    36  	Name ObjectName `json:"name"`
    37  }
    38  
    39  // SecretObjectReference identifies an API object including its namespace,
    40  // defaulting to Secret.
    41  //
    42  // The API object must be valid in the cluster; the Group and Kind must
    43  // be registered in the cluster for this reference to be valid.
    44  //
    45  // References to objects with invalid Group and Kind are not valid, and must
    46  // be rejected by the implementation, with appropriate Conditions set
    47  // on the containing object.
    48  type SecretObjectReference struct {
    49  	// Group is the group of the referent. For example, "gateway.networking.k8s.io".
    50  	// When unspecified or empty string, core API group is inferred.
    51  	//
    52  	// +optional
    53  	// +kubebuilder:default=""
    54  	Group *Group `json:"group"`
    55  
    56  	// Kind is kind of the referent. For example "Secret".
    57  	//
    58  	// +optional
    59  	// +kubebuilder:default=Secret
    60  	Kind *Kind `json:"kind"`
    61  
    62  	// Name is the name of the referent.
    63  	Name ObjectName `json:"name"`
    64  
    65  	// Namespace is the namespace of the referenced object. When unspecified, the local
    66  	// namespace is inferred.
    67  	//
    68  	// Note that when a namespace different than the local namespace is specified,
    69  	// a ReferenceGrant object is required in the referent namespace to allow that
    70  	// namespace's owner to accept the reference. See the ReferenceGrant
    71  	// documentation for details.
    72  	//
    73  	// Support: Core
    74  	//
    75  	// +optional
    76  	Namespace *Namespace `json:"namespace,omitempty"`
    77  }
    78  
    79  // BackendObjectReference defines how an ObjectReference that is
    80  // specific to BackendRef. It includes a few additional fields and features
    81  // than a regular ObjectReference.
    82  //
    83  // Note that when a namespace different than the local namespace is specified, a
    84  // ReferenceGrant object is required in the referent namespace to allow that
    85  // namespace's owner to accept the reference. See the ReferenceGrant
    86  // documentation for details.
    87  //
    88  // The API object must be valid in the cluster; the Group and Kind must
    89  // be registered in the cluster for this reference to be valid.
    90  //
    91  // References to objects with invalid Group and Kind are not valid, and must
    92  // be rejected by the implementation, with appropriate Conditions set
    93  // on the containing object.
    94  //
    95  // +kubebuilder:validation:XValidation:message="Must have port for Service reference",rule="(size(self.group) == 0 && self.kind == 'Service') ? has(self.port) : true"
    96  type BackendObjectReference struct {
    97  	// Group is the group of the referent. For example, "gateway.networking.k8s.io".
    98  	// When unspecified or empty string, core API group is inferred.
    99  	//
   100  	// +optional
   101  	// +kubebuilder:default=""
   102  	Group *Group `json:"group,omitempty"`
   103  
   104  	// Kind is the Kubernetes resource kind of the referent. For example
   105  	// "Service".
   106  	//
   107  	// Defaults to "Service" when not specified.
   108  	//
   109  	// ExternalName services can refer to CNAME DNS records that may live
   110  	// outside of the cluster and as such are difficult to reason about in
   111  	// terms of conformance. They also may not be safe to forward to (see
   112  	// CVE-2021-25740 for more information). Implementations SHOULD NOT
   113  	// support ExternalName Services.
   114  	//
   115  	// Support: Core (Services with a type other than ExternalName)
   116  	//
   117  	// Support: Implementation-specific (Services with type ExternalName)
   118  	//
   119  	// +optional
   120  	// +kubebuilder:default=Service
   121  	Kind *Kind `json:"kind,omitempty"`
   122  
   123  	// Name is the name of the referent.
   124  	Name ObjectName `json:"name"`
   125  
   126  	// Namespace is the namespace of the backend. When unspecified, the local
   127  	// namespace is inferred.
   128  	//
   129  	// Note that when a namespace different than the local namespace is specified,
   130  	// a ReferenceGrant object is required in the referent namespace to allow that
   131  	// namespace's owner to accept the reference. See the ReferenceGrant
   132  	// documentation for details.
   133  	//
   134  	// Support: Core
   135  	//
   136  	// +optional
   137  	Namespace *Namespace `json:"namespace,omitempty"`
   138  
   139  	// Port specifies the destination port number to use for this resource.
   140  	// Port is required when the referent is a Kubernetes Service. In this
   141  	// case, the port number is the service port number, not the target port.
   142  	// For other resources, destination port might be derived from the referent
   143  	// resource or this field.
   144  	//
   145  	// +optional
   146  	Port *PortNumber `json:"port,omitempty"`
   147  }
   148  

View as plain text