github.com/cilium/cilium@v1.16.2/pkg/k8s/types/types.go (about)

     1  // SPDX-License-Identifier: Apache-2.0
     2  // Copyright Authors of Cilium
     3  
     4  package types
     5  
     6  import (
     7  	"k8s.io/apimachinery/pkg/runtime/schema"
     8  
     9  	"github.com/cilium/cilium/api/v1/models"
    10  	v2 "github.com/cilium/cilium/pkg/k8s/apis/cilium.io/v2"
    11  	slim_metav1 "github.com/cilium/cilium/pkg/k8s/slim/k8s/apis/meta/v1"
    12  )
    13  
    14  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    15  // +deepequal-gen=true
    16  type SlimCNP struct {
    17  	*v2.CiliumNetworkPolicy
    18  }
    19  
    20  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    21  // +deepequal-gen:private-method=true
    22  type CiliumEndpoint struct {
    23  	// +deepequal-gen=false
    24  	slim_metav1.TypeMeta
    25  	// +deepequal-gen=false
    26  	slim_metav1.ObjectMeta
    27  	Identity   *v2.EndpointIdentity
    28  	Networking *v2.EndpointNetworking
    29  	Encryption *v2.EncryptionSpec
    30  	NamedPorts models.NamedPorts
    31  }
    32  
    33  func (in *CiliumEndpoint) DeepEqual(other *CiliumEndpoint) bool {
    34  	if other == nil {
    35  		return false
    36  	}
    37  
    38  	if in.Name != other.Name {
    39  		return false
    40  	}
    41  	if in.Namespace != other.Namespace {
    42  		return false
    43  	}
    44  
    45  	return in.deepEqual(other)
    46  }
    47  
    48  // +deepequal-gen=true
    49  type IPSlice []string
    50  
    51  // UnserializableObject is a skeleton embeddable k8s object that implements
    52  // GetObjectKind() of runtime.Object. Useful with Resource[T]'s
    53  // WithTransform option when deriving from real objects.
    54  // The struct into which this is embedded will also need to implement
    55  // DeepCopyObject. This can be generated including the deepcopy-gen comment
    56  // below in the parent object and running "make generate-k8s-api".
    57  //
    58  // +k8s:deepcopy-gen=false
    59  type UnserializableObject struct{}
    60  
    61  func (UnserializableObject) GetObjectKind() schema.ObjectKind {
    62  	// Not serializable, so return the empty kind.
    63  	return schema.EmptyObjectKind
    64  }