github.com/tigera/api@v0.0.0-20240320170621-278e89a8c5fb/pkg/apis/projectcalico/v3/register.go (about) 1 // Copyright (c) 2019-2023 Tigera, Inc. All rights reserved. 2 3 package v3 4 5 import ( 6 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 7 "k8s.io/apimachinery/pkg/runtime" 8 "k8s.io/apimachinery/pkg/runtime/schema" 9 ) 10 11 // GroupName is the group name use in this package 12 const GroupName = "projectcalico.org" 13 14 // SchemeGroupVersion is group version used to register these objects 15 var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v3"} 16 var SchemeGroupVersionInternal = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} 17 18 var ( 19 SchemeBuilder runtime.SchemeBuilder 20 localSchemeBuilder = &SchemeBuilder 21 AddToScheme = localSchemeBuilder.AddToScheme 22 AllKnownTypes = []runtime.Object{ 23 &NetworkPolicy{}, 24 &NetworkPolicyList{}, 25 &GlobalNetworkPolicy{}, 26 &GlobalNetworkPolicyList{}, 27 &GlobalNetworkSet{}, 28 &GlobalNetworkSetList{}, 29 &HostEndpoint{}, 30 &HostEndpointList{}, 31 &IPPool{}, 32 &IPPoolList{}, 33 &IPReservation{}, 34 &IPReservationList{}, 35 &BGPConfiguration{}, 36 &BGPConfigurationList{}, 37 &BGPFilter{}, 38 &BGPFilterList{}, 39 &BGPPeer{}, 40 &BGPPeerList{}, 41 &Profile{}, 42 &ProfileList{}, 43 &FelixConfiguration{}, 44 &FelixConfigurationList{}, 45 &KubeControllersConfiguration{}, 46 &KubeControllersConfigurationList{}, 47 &ClusterInformation{}, 48 &ClusterInformationList{}, 49 &NetworkSet{}, 50 &NetworkSetList{}, 51 &CalicoNodeStatus{}, 52 &CalicoNodeStatusList{}, 53 &IPAMConfiguration{}, 54 &IPAMConfigurationList{}, 55 &BlockAffinity{}, 56 &BlockAffinityList{}, 57 58 // Enterprise-only types. 59 &AlertException{}, 60 &AlertExceptionList{}, 61 &AuthenticationReview{}, 62 &AuthenticationReviewList{}, 63 &AuthorizationReview{}, 64 &AuthorizationReviewList{}, 65 &DeepPacketInspection{}, 66 &DeepPacketInspectionList{}, 67 &EgressGatewayPolicy{}, 68 &EgressGatewayPolicyList{}, 69 &GlobalAlert{}, 70 &GlobalAlertList{}, 71 &GlobalAlertTemplate{}, 72 &GlobalAlertTemplateList{}, 73 &GlobalReport{}, 74 &GlobalReportList{}, 75 &GlobalReportType{}, 76 &GlobalReportTypeList{}, 77 &GlobalThreatFeed{}, 78 &GlobalThreatFeedList{}, 79 &LicenseKey{}, 80 &LicenseKeyList{}, 81 &ManagedCluster{}, 82 &ManagedClusterList{}, 83 &PacketCapture{}, 84 &PacketCaptureList{}, 85 &PolicyRecommendationScope{}, 86 &PolicyRecommendationScopeList{}, 87 &RemoteClusterConfiguration{}, 88 &RemoteClusterConfigurationList{}, 89 &StagedGlobalNetworkPolicy{}, 90 &StagedGlobalNetworkPolicyList{}, 91 &StagedKubernetesNetworkPolicy{}, 92 &StagedKubernetesNetworkPolicyList{}, 93 &StagedNetworkPolicy{}, 94 &StagedNetworkPolicyList{}, 95 &Tier{}, 96 &TierList{}, 97 &UISettingsGroup{}, 98 &UISettingsGroupList{}, 99 &UISettings{}, 100 &UISettingsList{}, 101 &ExternalNetwork{}, 102 &ExternalNetworkList{}, 103 &SecurityEventWebhook{}, 104 &SecurityEventWebhookList{}, 105 } 106 ) 107 108 func init() { 109 // We only register manually written functions here. The registration of the 110 // generated functions takes place in the generated files. The separation 111 // makes the code compile even when the generated files are missing. 112 localSchemeBuilder.Register(addKnownTypes, addConversionFuncs) 113 } 114 115 // Adds the list of known types to api.Scheme. 116 func addKnownTypes(scheme *runtime.Scheme) error { 117 scheme.AddKnownTypes(SchemeGroupVersion, AllKnownTypes...) 118 metav1.AddToGroupVersion(scheme, SchemeGroupVersion) 119 return nil 120 } 121 122 // Resource takes an unqualified resource and returns a Group qualified GroupResource 123 func Resource(resource string) schema.GroupResource { 124 return SchemeGroupVersion.WithResource(resource).GroupResource() 125 }