From ef2bb8f7582a8587f2a6fed7a697d8146c3865d8 Mon Sep 17 00:00:00 2001 From: inho Date: Wed, 3 Jul 2024 17:46:38 +0900 Subject: [PATCH 1/4] Added BGP Policy --- cmd/loxilb-agent/agent.go | 34 ++ manifest/crds/bgp-policy-apply-service.yaml | 44 +++ manifest/crds/bgp-policy-apply.yaml | 10 + .../crds/bgp-policy-defined-sets-service.yaml | 53 +++ manifest/crds/bgp-policy-defined-sets.yaml | 10 + .../crds/bgp-policy-definition-service.yaml | 158 ++++++++ manifest/crds/bgp-policy-definition.yaml | 17 + manifest/ext-cluster/kube-loxilb.yaml | 34 ++ manifest/ext-peer-cluster/kube-loxilb.yaml | 34 ++ manifest/gateway-api/kube-loxilb.yaml | 34 ++ manifest/in-cluster/kube-loxilb.yaml | 34 ++ manifest/service-proxy/kube-loxilb.yml | 34 ++ manifest/zones/kube-loxilb-north.yml | 34 ++ manifest/zones/kube-loxilb-south.yml | 34 ++ .../manager/bgppolicyapply/bgppolicyapply.go | 249 +++++++++++++ .../bgppolicydefinedsets.go | 253 +++++++++++++ .../bgppolicydefinition.go | 235 ++++++++++++ pkg/api/bgppolicyapply.go | 46 +++ pkg/api/bgppolicydefinedsets.go | 53 +++ pkg/api/bgppolicydefinition.go | 39 ++ pkg/api/client.go | 12 + .../bgppolicyapply/v1/bgppolicyapplymodel.go | 68 ++++ .../v1/bgppolicyapplyservice.go | 219 +++++++++++ .../v1/bgppolicydefinedsetsmodel.go | 74 ++++ .../v1/bgppolicydefinedsetsservice.go | 219 +++++++++++ .../bgppolicydefinition/v1/actions.go | 48 +++ .../bgppolicydefinition/v1/bgpactions.go | 93 +++++ .../bgppolicydefinition/v1/bgpaspathlength.go | 48 +++ .../bgppolicydefinition/v1/bgpaspathset.go | 48 +++ .../bgppolicydefinition/v1/bgpcommunityset.go | 48 +++ .../bgppolicydefinition/v1/bgpconditions.go | 115 ++++++ .../v1/bgppolicydefinition.go | 53 +++ .../v1/bgppolicydefinitionservice.go | 219 +++++++++++ .../bgppolicydefinition/v1/conditions.go | 57 +++ .../v1/matchneighborset.go | 48 +++ .../bgppolicydefinition/v1/matchprefixset.go | 48 +++ .../v1/setaspathprepend.go | 48 +++ .../bgppolicydefinition/v1/setcommunity.go | 50 +++ .../bgppolicydefinition/v1/statement.go | 57 +++ pkg/client/applyconfiguration/utils.go | 48 +++ pkg/client/clientset/versioned/clientset.go | 41 +- .../versioned/fake/clientset_generated.go | 21 ++ .../clientset/versioned/fake/register.go | 6 + .../clientset/versioned/scheme/register.go | 6 + .../v1/bgppolicyapply_client.go | 107 ++++++ .../v1/bgppolicyapplyservice.go | 243 ++++++++++++ .../versioned/typed/bgppolicyapply/v1/doc.go | 20 + .../typed/bgppolicyapply/v1/fake/doc.go | 20 + .../v1/fake/fake_bgppolicyapply_client.go | 40 ++ .../v1/fake/fake_bgppolicyapplyservice.go | 178 +++++++++ .../bgppolicyapply/v1/generated_expansion.go | 21 ++ .../v1/bgppolicydefinedsets_client.go | 107 ++++++ .../v1/bgppolicydefinedsetsservice.go | 243 ++++++++++++ .../typed/bgppolicydefinedsets/v1/doc.go | 20 + .../typed/bgppolicydefinedsets/v1/fake/doc.go | 20 + .../fake/fake_bgppolicydefinedsets_client.go | 40 ++ .../fake/fake_bgppolicydefinedsetsservice.go | 178 +++++++++ .../v1/generated_expansion.go | 21 ++ .../v1/bgppolicydefinition_client.go | 107 ++++++ .../v1/bgppolicydefinitionservice.go | 243 ++++++++++++ .../typed/bgppolicydefinition/v1/doc.go | 20 + .../typed/bgppolicydefinition/v1/fake/doc.go | 20 + .../fake/fake_bgppolicydefinition_client.go | 40 ++ .../fake/fake_bgppolicydefinitionservice.go | 178 +++++++++ .../v1/generated_expansion.go | 21 ++ .../bgppolicyapply/interface.go | 46 +++ .../v1/bgppolicyapplyservice.go | 89 +++++ .../bgppolicyapply/v1/interface.go | 45 +++ .../bgppolicydefinedsets/interface.go | 46 +++ .../v1/bgppolicydefinedsetsservice.go | 89 +++++ .../bgppolicydefinedsets/v1/interface.go | 45 +++ .../bgppolicydefinition/interface.go | 46 +++ .../v1/bgppolicydefinitionservice.go | 89 +++++ .../bgppolicydefinition/v1/interface.go | 45 +++ .../informers/externalversions/factory.go | 18 + .../informers/externalversions/generic.go | 15 + .../v1/bgppolicyapplyservice.go | 68 ++++ .../bgppolicyapply/v1/expansion_generated.go | 23 ++ .../v1/bgppolicydefinedsetsservice.go | 68 ++++ .../v1/expansion_generated.go | 23 ++ .../v1/bgppolicydefinitionservice.go | 68 ++++ .../v1/expansion_generated.go | 23 ++ pkg/crds/bgppolicyapply/v1/doc.go | 4 + pkg/crds/bgppolicyapply/v1/register.go | 31 ++ pkg/crds/bgppolicyapply/v1/types.go | 60 +++ .../v1/zz_generated.deepcopy.go | 145 ++++++++ pkg/crds/bgppolicydefinedsets/v1/doc.go | 4 + pkg/crds/bgppolicydefinedsets/v1/register.go | 31 ++ pkg/crds/bgppolicydefinedsets/v1/types.go | 60 +++ .../v1/zz_generated.deepcopy.go | 151 ++++++++ pkg/crds/bgppolicydefinition/v1/doc.go | 4 + pkg/crds/bgppolicydefinition/v1/register.go | 31 ++ pkg/crds/bgppolicydefinition/v1/types.go | 130 +++++++ .../v1/zz_generated.deepcopy.go | 352 ++++++++++++++++++ 94 files changed, 6868 insertions(+), 1 deletion(-) create mode 100644 manifest/crds/bgp-policy-apply-service.yaml create mode 100644 manifest/crds/bgp-policy-apply.yaml create mode 100644 manifest/crds/bgp-policy-defined-sets-service.yaml create mode 100644 manifest/crds/bgp-policy-defined-sets.yaml create mode 100644 manifest/crds/bgp-policy-definition-service.yaml create mode 100644 manifest/crds/bgp-policy-definition.yaml create mode 100644 pkg/agent/manager/bgppolicyapply/bgppolicyapply.go create mode 100644 pkg/agent/manager/bgppolicydefinedsets/bgppolicydefinedsets.go create mode 100644 pkg/agent/manager/bgppolicydefinition/bgppolicydefinition.go create mode 100644 pkg/api/bgppolicyapply.go create mode 100644 pkg/api/bgppolicydefinedsets.go create mode 100644 pkg/api/bgppolicydefinition.go create mode 100644 pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplymodel.go create mode 100644 pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplyservice.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsmodel.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/actions.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpactions.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathlength.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathset.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpcommunityset.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpconditions.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinition.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinitionservice.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/conditions.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/matchneighborset.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/matchprefixset.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/setaspathprepend.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/setcommunity.go create mode 100644 pkg/client/applyconfiguration/bgppolicydefinition/v1/statement.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapply_client.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapplyservice.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapply_client.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapplyservice.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicyapply/v1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsets_client.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsets_client.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsetsservice.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/generated_expansion.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinition_client.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinitionservice.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/doc.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/doc.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinition_client.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinitionservice.go create mode 100644 pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/generated_expansion.go create mode 100644 pkg/client/informers/externalversions/bgppolicyapply/interface.go create mode 100644 pkg/client/informers/externalversions/bgppolicyapply/v1/bgppolicyapplyservice.go create mode 100644 pkg/client/informers/externalversions/bgppolicyapply/v1/interface.go create mode 100644 pkg/client/informers/externalversions/bgppolicydefinedsets/interface.go create mode 100644 pkg/client/informers/externalversions/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go create mode 100644 pkg/client/informers/externalversions/bgppolicydefinedsets/v1/interface.go create mode 100644 pkg/client/informers/externalversions/bgppolicydefinition/interface.go create mode 100644 pkg/client/informers/externalversions/bgppolicydefinition/v1/bgppolicydefinitionservice.go create mode 100644 pkg/client/informers/externalversions/bgppolicydefinition/v1/interface.go create mode 100644 pkg/client/listers/bgppolicyapply/v1/bgppolicyapplyservice.go create mode 100644 pkg/client/listers/bgppolicyapply/v1/expansion_generated.go create mode 100644 pkg/client/listers/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go create mode 100644 pkg/client/listers/bgppolicydefinedsets/v1/expansion_generated.go create mode 100644 pkg/client/listers/bgppolicydefinition/v1/bgppolicydefinitionservice.go create mode 100644 pkg/client/listers/bgppolicydefinition/v1/expansion_generated.go create mode 100644 pkg/crds/bgppolicyapply/v1/doc.go create mode 100644 pkg/crds/bgppolicyapply/v1/register.go create mode 100644 pkg/crds/bgppolicyapply/v1/types.go create mode 100644 pkg/crds/bgppolicyapply/v1/zz_generated.deepcopy.go create mode 100644 pkg/crds/bgppolicydefinedsets/v1/doc.go create mode 100644 pkg/crds/bgppolicydefinedsets/v1/register.go create mode 100644 pkg/crds/bgppolicydefinedsets/v1/types.go create mode 100644 pkg/crds/bgppolicydefinedsets/v1/zz_generated.deepcopy.go create mode 100644 pkg/crds/bgppolicydefinition/v1/doc.go create mode 100644 pkg/crds/bgppolicydefinition/v1/register.go create mode 100644 pkg/crds/bgppolicydefinition/v1/types.go create mode 100644 pkg/crds/bgppolicydefinition/v1/zz_generated.deepcopy.go diff --git a/cmd/loxilb-agent/agent.go b/cmd/loxilb-agent/agent.go index f07be0e..fb9f25d 100644 --- a/cmd/loxilb-agent/agent.go +++ b/cmd/loxilb-agent/agent.go @@ -25,6 +25,9 @@ import ( "github.com/loxilb-io/kube-loxilb/pkg/agent/config" "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/bgppeer" + "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/bgppolicyapply" + "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/bgppolicydefinedsets" + "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/bgppolicydefinition" "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/gatewayapi" "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/loadbalancer" "github.com/loxilb-io/kube-loxilb/pkg/api" @@ -66,6 +69,9 @@ func run(o *Options) error { informerFactory := informers.NewSharedInformerFactory(k8sClient, informerDefaultResync) crdInformerFactory := crdinformers.NewSharedInformerFactory(crdClient, informerDefaultResync) BGPPeerInformer := crdInformerFactory.Bgppeer().V1().BGPPeerServices() + BGPPolicyDefinedSetInformer := crdInformerFactory.Bgppolicydefinedsets().V1().BGPPolicyDefinedSetsServices() + BGPPolicyDefinitionInformer := crdInformerFactory.Bgppolicydefinition().V1().BGPPolicyDefinitionServices() + BGPPolicyApplyInformer := crdInformerFactory.Bgppolicyapply().V1().BGPPolicyApplyServices() sigsInformerFactory := sigsInformer.NewSharedInformerFactory(sigsClient, informerDefaultResync) // networkReadyCh is used to notify that the Node's network is ready. @@ -200,6 +206,30 @@ func run(o *Options) error { BGPPeerInformer, lbManager, ) + + BGPPolicyDefinedSetsManager := bgppolicydefinedsets.NewBGPPolicyDefinedSetsManager( + k8sClient, + crdClient, + networkConfig, + BGPPolicyDefinedSetInformer, + lbManager, + ) + + BGPPolicyDefinitionManager := bgppolicydefinition.NewBGPPolicyDefinitionManager( + k8sClient, + crdClient, + networkConfig, + BGPPolicyDefinitionInformer, + lbManager, + ) + BGPPolicyApplyManager := bgppolicyapply.NewBGPPolicyApplyManager( + k8sClient, + crdClient, + networkConfig, + BGPPolicyApplyInformer, + lbManager, + ) + go func() { for { select { @@ -224,9 +254,13 @@ func run(o *Options) error { }() log.StartLogFileNumberMonitor(stopCh) informerFactory.Start(stopCh) + crdInformerFactory.Start(stopCh) go lbManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) go BgpPeerManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + go BGPPolicyDefinedSetsManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + go BGPPolicyDefinitionManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + go BGPPolicyApplyManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) // Run gateway API managers if o.config.EnableGatewayAPI { diff --git a/manifest/crds/bgp-policy-apply-service.yaml b/manifest/crds/bgp-policy-apply-service.yaml new file mode 100644 index 0000000..69aae74 --- /dev/null +++ b/manifest/crds/bgp-policy-apply-service.yaml @@ -0,0 +1,44 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: bgppolicyapplyservices.bgppolicyapply.loxilb.io +spec: + group: bgppolicyapply.loxilb.io + names: + kind: BGPPolicyApplyService + listKind: BGPPolicyApplyServiceList + plural: bgppolicyapplyservices + singular: bgppolicyapplyservice + scope: Cluster + versions: + - name: v1 + served: true + storage: true + additionalPrinterColumns: + - name: Name + type: string + priority: 0 + jsonPath: .spec.ipAddress + description: Applied policy IP address + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + ipAddress: + type: string + policyType: + type: string + policies: + type: array + items: + type: string + routeAction: + type: string + status: + type: object + x-kubernetes-preserve-unknown-fields: true \ No newline at end of file diff --git a/manifest/crds/bgp-policy-apply.yaml b/manifest/crds/bgp-policy-apply.yaml new file mode 100644 index 0000000..e2b132c --- /dev/null +++ b/manifest/crds/bgp-policy-apply.yaml @@ -0,0 +1,10 @@ +apiVersion: bgppolicyapply.loxilb.io/v1 +kind: BGPPolicyApplyService +metadata: + name: policy-apply +spec: + ipAddress: "10.10.10.254" + policyType: "import" + policies: + - "poltest6" + routeAction: "accept" diff --git a/manifest/crds/bgp-policy-defined-sets-service.yaml b/manifest/crds/bgp-policy-defined-sets-service.yaml new file mode 100644 index 0000000..93b8a17 --- /dev/null +++ b/manifest/crds/bgp-policy-defined-sets-service.yaml @@ -0,0 +1,53 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: bgppolicydefinedsetsservices.bgppolicydefinedsets.loxilb.io +spec: + group: bgppolicydefinedsets.loxilb.io + names: + kind: BGPPolicyDefinedSetsService + listKind: BGPPolicyDefinedSetsServiceList + plural: bgppolicydefinedsetsservices + singular: bgppolicydefinedsetsservice + scope: Cluster + versions: + - name: v1 + served: true + storage: true + additionalPrinterColumns: + - name: Name + type: string + priority: 0 + jsonPath: .spec.name + description: Defined Set Name + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + name: + type: string + definedType: + type: string + List: + type: array + items: + type: string + prefixList: + type: array + items: + type: object + properties: + ipPrefix: + type: string + masklengthRange: + type: string + required: + - name + status: + type: object + x-kubernetes-preserve-unknown-fields: true \ No newline at end of file diff --git a/manifest/crds/bgp-policy-defined-sets.yaml b/manifest/crds/bgp-policy-defined-sets.yaml new file mode 100644 index 0000000..4fa5be4 --- /dev/null +++ b/manifest/crds/bgp-policy-defined-sets.yaml @@ -0,0 +1,10 @@ +apiVersion: bgppolicydefinedsets.loxilb.io/v1 +kind: BGPPolicyDefinedSetsService +metadata: + name: policy-prefix +spec: + name: "ps2" + definedType: "prefix" + prefixList: + - ipPrefix: "192.168.0.0/16" + masklengthRange: "16..24" \ No newline at end of file diff --git a/manifest/crds/bgp-policy-definition-service.yaml b/manifest/crds/bgp-policy-definition-service.yaml new file mode 100644 index 0000000..290bced --- /dev/null +++ b/manifest/crds/bgp-policy-definition-service.yaml @@ -0,0 +1,158 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.13.0 + name: bgppolicydefinitionservices.bgppolicydefinition.loxilb.io +spec: + group: bgppolicydefinition.loxilb.io + names: + kind: BGPPolicyDefinitionService + listKind: BGPPolicyDefinitionServiceList + plural: bgppolicydefinitionservices + singular: bgppolicydefinitionservice + scope: Cluster + versions: + - name: v1 + served: true + storage: true + additionalPrinterColumns: + - name: Name + type: string + priority: 0 + jsonPath: .spec.name + description: Defined Set Name + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + name: + type: string + statements: + type: array + items: + type: object + properties: + name: + type: string + conditions: + type: object + properties: + bgpConditions: + type: object + properties: + afiSafiIn: + type: array + items: + type: string + asPathLength: + type: object + properties: + operator: + type: string + value: + type: integer + matchAsPathSet: + type: object + properties: + asPathSet: + type: string + matchSetOptions: + type: string + matchCommunitySet: + type: object + properties: + communitySet: + type: string + matchSetOptions: + type: string + matchExtCommunitySet: + type: object + properties: + communitySet: + type: string + matchSetOptions: + type: string + matchLargeCommunitySet: + type: object + properties: + communitySet: + type: string + matchSetOptions: + type: string + nextHopInList: + type: array + items: + type: string + rpki: + type: string + routeType: + type: string + matchNeighborSet: + type: object + properties: + matchSetOption: + type: string + neighborSet: + type: string + matchPrefixSet: + type: object + properties: + matchSetOption: + type: string + prefixSet: + type: string + actions: + type: object + properties: + routeDisposition: + type: string + bgpActions: + type: object + properties: + setMed: + type: string + setNextHop: + type: string + setLocalPref: + type: integer + setCommunity: + type: object + properties: + options: + type: string + setCommunityMethod: + type: array + items: + type: string + setExtCommunity: + type: object + properties: + options: + type: string + setCommunityMethod: + type: array + items: + type: string + setLargeCommunity: + type: object + properties: + options: + type: string + setCommunityMethod: + type: array + items: + type: string + setAsPathPrepend: + type: object + properties: + as: + type: string + repeatN: + type: integer + status: + type: object + x-kubernetes-preserve-unknown-fields: true \ No newline at end of file diff --git a/manifest/crds/bgp-policy-definition.yaml b/manifest/crds/bgp-policy-definition.yaml new file mode 100644 index 0000000..169bdbd --- /dev/null +++ b/manifest/crds/bgp-policy-definition.yaml @@ -0,0 +1,17 @@ +apiVersion: bgppolicydefinition.loxilb.io/v1 +kind: BGPPolicyDefinitionService +metadata: + name: my-custom-resource +spec: + name: poltest + statements: + - name: statement + conditions: + matchPrefixSet: + matchSetOption: any + prefixSet: ps1 + matchNeighborSet: + matchSetOption: any + neighborSet: ns2 + actions: + routeDisposition: accept-route \ No newline at end of file diff --git a/manifest/ext-cluster/kube-loxilb.yaml b/manifest/ext-cluster/kube-loxilb.yaml index ec51501..25b9ea5 100644 --- a/manifest/ext-cluster/kube-loxilb.yaml +++ b/manifest/ext-cluster/kube-loxilb.yaml @@ -81,6 +81,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding diff --git a/manifest/ext-peer-cluster/kube-loxilb.yaml b/manifest/ext-peer-cluster/kube-loxilb.yaml index 2764aaa..3ce7bc7 100644 --- a/manifest/ext-peer-cluster/kube-loxilb.yaml +++ b/manifest/ext-peer-cluster/kube-loxilb.yaml @@ -81,6 +81,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 diff --git a/manifest/gateway-api/kube-loxilb.yaml b/manifest/gateway-api/kube-loxilb.yaml index c81198d..2dee4d8 100644 --- a/manifest/gateway-api/kube-loxilb.yaml +++ b/manifest/gateway-api/kube-loxilb.yaml @@ -83,6 +83,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 diff --git a/manifest/in-cluster/kube-loxilb.yaml b/manifest/in-cluster/kube-loxilb.yaml index 781d847..69542d8 100644 --- a/manifest/in-cluster/kube-loxilb.yaml +++ b/manifest/in-cluster/kube-loxilb.yaml @@ -81,6 +81,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 diff --git a/manifest/service-proxy/kube-loxilb.yml b/manifest/service-proxy/kube-loxilb.yml index 9a5aad6..e25845c 100644 --- a/manifest/service-proxy/kube-loxilb.yml +++ b/manifest/service-proxy/kube-loxilb.yml @@ -81,6 +81,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 diff --git a/manifest/zones/kube-loxilb-north.yml b/manifest/zones/kube-loxilb-north.yml index ae816ed..2487112 100644 --- a/manifest/zones/kube-loxilb-north.yml +++ b/manifest/zones/kube-loxilb-north.yml @@ -81,6 +81,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 diff --git a/manifest/zones/kube-loxilb-south.yml b/manifest/zones/kube-loxilb-south.yml index 6081ea5..d3e0859 100644 --- a/manifest/zones/kube-loxilb-south.yml +++ b/manifest/zones/kube-loxilb-south.yml @@ -81,6 +81,40 @@ rules: - create - update - delete + - apiGroups: + - bgppolicydefinedsets.loxilb.io + resources: + - bgppolicydefinedsetsservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicydefinition.loxilb.io + resources: + - bgppolicydefinitionservices + verbs: + - get + - watch + - list + - create + - update + - delete + - apiGroups: + - bgppolicyapply.loxilb.io + resources: + - bgppolicyapplyservices + verbs: + - get + - watch + - list + - create + - update + - delete + --- kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 diff --git a/pkg/agent/manager/bgppolicyapply/bgppolicyapply.go b/pkg/agent/manager/bgppolicyapply/bgppolicyapply.go new file mode 100644 index 0000000..04a0e75 --- /dev/null +++ b/pkg/agent/manager/bgppolicyapply/bgppolicyapply.go @@ -0,0 +1,249 @@ +/* + * Copyright (c) 2024 NetLOX Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package bgppolicyapply + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/loxilb-io/kube-loxilb/pkg/agent/config" + "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/loadbalancer" + "github.com/loxilb-io/kube-loxilb/pkg/api" + "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" + crdInformer "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicyapply/v1" + crdLister "github.com/loxilb-io/kube-loxilb/pkg/client/listers/bgppolicyapply/v1" + crdv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + + //v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + "k8s.io/klog/v2" +) + +const ( + mgrName = "BGPPolicyApplyService" + defaultWorkers = 4 + minRetryDelay = 2 * time.Second + maxRetryDelay = 120 * time.Second +) + +type Manager struct { + kubeClient kubernetes.Interface + crdClient versioned.Interface + BGPPolicyApplyInformer crdInformer.BGPPolicyApplyServiceInformer + BGPPolicyApplyLister crdLister.BGPPolicyApplyServiceLister + BGPPolicyApplyListerSynced cache.InformerSynced + queue workqueue.RateLimitingInterface + lbManager *loadbalancer.Manager +} + +// Create and Init Manager. +// Manager is called by kube-loxilb when k8s service is created & updated. +func NewBGPPolicyApplyManager( + kubeClient kubernetes.Interface, + crdClient versioned.Interface, + networkConfig *config.NetworkConfig, + BGPPolicyApplyInformer crdInformer.BGPPolicyApplyServiceInformer, + lbManager *loadbalancer.Manager, +) *Manager { + + manager := &Manager{ + + kubeClient: kubeClient, + crdClient: crdClient, + BGPPolicyApplyInformer: BGPPolicyApplyInformer, + BGPPolicyApplyLister: BGPPolicyApplyInformer.Lister(), + BGPPolicyApplyListerSynced: BGPPolicyApplyInformer.Informer().HasSynced, + lbManager: lbManager, + + queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "BGPPolicyApply"), + } + BGPPolicyApplyInformer.Informer().AddEventHandler( + cache.ResourceEventHandlerFuncs{ + AddFunc: func(cur interface{}) { + manager.enqueueService(cur) + }, + UpdateFunc: func(old, cur interface{}) { + manager.enqueueService(cur) + }, + DeleteFunc: func(old interface{}) { + manager.enqueueService(old) + }, + }, + ) + + return manager +} + +func (m *Manager) enqueueService(obj interface{}) { + lb, ok := obj.(*crdv1.BGPPolicyApplyService) + if !ok { + deletedState, ok := obj.(cache.DeletedFinalStateUnknown) + if !ok { + klog.Errorf("Received unexpected object: %v", obj) + return + } + lb, ok = deletedState.Obj.(*crdv1.BGPPolicyApplyService) + if !ok { + klog.Errorf("DeletedFinalStateUnknown contains non-BGPPolicyApplyService object: %v", deletedState.Obj) + } + } + + m.queue.Add(lb) +} + +func (m *Manager) Run(stopCh <-chan struct{}, loxiLBLiveCh chan *api.LoxiClient, loxiLBPurgeCh chan *api.LoxiClient, masterEventCh <-chan bool) { + defer m.queue.ShutDown() + + klog.Infof("Starting %s", mgrName) + defer klog.Infof("Shutting down %s", mgrName) + + if !cache.WaitForNamedCacheSync( + mgrName, + stopCh, + m.BGPPolicyApplyListerSynced) { + return + } + for i := 0; i < defaultWorkers; i++ { + go wait.Until(m.worker, time.Second, stopCh) + } + <-stopCh +} + +func (m *Manager) worker() { + for m.processNextWorkItem() { + } +} + +func (m *Manager) processNextWorkItem() bool { + obj, quit := m.queue.Get() + if quit { + return false + } + defer m.queue.Done(obj) + if bgpdf, ok := obj.(*crdv1.BGPPolicyApplyService); !ok { + m.queue.Forget(obj) + klog.Errorf("Expected string in work queue but got %#v", obj) + return true + } else if err := m.syncBGPPolicyApplyService(bgpdf); err == nil { + m.queue.Forget(obj) + } else { + m.queue.AddRateLimited(obj) + klog.Errorf("Error syncing CRD BGPPolicyApplyService %s, requeuing. Error: %v", bgpdf.Name, err) + } + + // fmt.Printf("obj: %v\n", obj) + // fmt.Printf("m.queue: %v\n", m.queue) + return true +} + +func (m *Manager) syncBGPPolicyApplyService(bgpdf *crdv1.BGPPolicyApplyService) error { + startTime := time.Now() + defer func() { + klog.V(4).Infof("Finished syncing BGPPolicyApplyService %s. (%v)", bgpdf.Name, time.Since(startTime)) + }() + _, err := m.BGPPolicyApplyLister.Get(bgpdf.Name) + if err != nil { + return m.deleteBGPPolicyApplyService(bgpdf) + } + return m.addBGPPolicyApplyService(bgpdf) +} + +func (m *Manager) addBGPPolicyApplyService(bgpdf *crdv1.BGPPolicyApplyService) error { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + klog.Infof("bgpdf.Spec.NeighIPAddress: %v\n", bgpdf.Spec.NeighIPAddress) + klog.Infof("bgpdf.Spec.Policies: %v\n", bgpdf.Spec.Policies) + klog.Infof("bgpdf.Spec.PolicyType: %v\n", bgpdf.Spec.PolicyType) + klog.Infof("bgpdf.Spec.RouteAction: %v\n", bgpdf.Spec.RouteAction) + + var errChList []chan error + for _, client := range m.lbManager.LoxiClients { + ch := make(chan error) + go func(c *api.LoxiClient, h chan error) { + var err error + if err = c.BGPPolicyApply().CreateBGPPolicyApply(ctx, &bgpdf.Spec); err != nil { + if !strings.Contains(err.Error(), "exist") { + klog.Errorf("failed to create BGPPolicyApply(%s) :%v", c.Url, err) + } else { + err = nil + } + } + h <- err + }(client, ch) + + errChList = append(errChList, ch) + } + + isError := true + for _, errCh := range errChList { + err := <-errCh + if err == nil { + isError = false + } + } + if isError { + klog.Errorf("failed to add BGPPolicyApply") + return fmt.Errorf("failed to add loxiLB BGPPolicyApply") + } + + return nil +} + +func (m *Manager) deleteBGPPolicyApplyService(bgpdf *crdv1.BGPPolicyApplyService) error { + + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + klog.Infof("bgpdf.Spec.NeighIPAddress: %v\n", bgpdf.Spec.NeighIPAddress) + var errChList []chan error + for _, client := range m.lbManager.LoxiClients { + ch := make(chan error) + go func(c *api.LoxiClient, h chan error) { + var err error + if err = c.BGPPolicyApply().DeleteBGPPolicyApply(ctx, &bgpdf.Spec); err != nil { + if !strings.Contains(err.Error(), "exist") { + klog.Errorf("failed to delete BGPPolicyApply(%s) :%v", c.Url, err) + } else { + err = nil + } + } + h <- err + }(client, ch) + + errChList = append(errChList, ch) + } + + isError := true + errStr := "" + for _, errCh := range errChList { + err := <-errCh + if err == nil { + isError = false + break + } else { + errStr = err.Error() + } + } + if isError { + return fmt.Errorf("failed to delete loxiLB LoadBalancer. Error: %v", errStr) + } + return nil +} diff --git a/pkg/agent/manager/bgppolicydefinedsets/bgppolicydefinedsets.go b/pkg/agent/manager/bgppolicydefinedsets/bgppolicydefinedsets.go new file mode 100644 index 0000000..7b7bd81 --- /dev/null +++ b/pkg/agent/manager/bgppolicydefinedsets/bgppolicydefinedsets.go @@ -0,0 +1,253 @@ +/* + * Copyright (c) 2024 NetLOX Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package bgppolicydefinedsets + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/loxilb-io/kube-loxilb/pkg/agent/config" + "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/loadbalancer" + "github.com/loxilb-io/kube-loxilb/pkg/api" + "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" + crdInformer "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicydefinedsets/v1" + crdLister "github.com/loxilb-io/kube-loxilb/pkg/client/listers/bgppolicydefinedsets/v1" + crdv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + + //v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + "k8s.io/klog/v2" +) + +const ( + mgrName = "BGPPolicyDefinedSetsService" + defaultWorkers = 4 + resyncPeriod = 60 * time.Second + minRetryDelay = 2 * time.Second + maxRetryDelay = 120 * time.Second +) + +type Manager struct { + kubeClient kubernetes.Interface + crdClient versioned.Interface + BGPPolicyDefinedSetsInformer crdInformer.BGPPolicyDefinedSetsServiceInformer + BGPPolicyDefinedSetsLister crdLister.BGPPolicyDefinedSetsServiceLister + BGPPolicyDefinedSetsListerSynced cache.InformerSynced + queue workqueue.RateLimitingInterface + lbManager *loadbalancer.Manager +} + +// Create and Init Manager. +// Manager is called by kube-loxilb when k8s service is created & updated. +func NewBGPPolicyDefinedSetsManager( + kubeClient kubernetes.Interface, + crdClient versioned.Interface, + networkConfig *config.NetworkConfig, + BGPPolicyDefinedSetsInformer crdInformer.BGPPolicyDefinedSetsServiceInformer, + lbManager *loadbalancer.Manager, +) *Manager { + + manager := &Manager{ + + kubeClient: kubeClient, + crdClient: crdClient, + BGPPolicyDefinedSetsInformer: BGPPolicyDefinedSetsInformer, + BGPPolicyDefinedSetsLister: BGPPolicyDefinedSetsInformer.Lister(), + BGPPolicyDefinedSetsListerSynced: BGPPolicyDefinedSetsInformer.Informer().HasSynced, + lbManager: lbManager, + + queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "bgppolicydefinedsets"), + } + BGPPolicyDefinedSetsInformer.Informer().AddEventHandler( + cache.ResourceEventHandlerFuncs{ + AddFunc: func(cur interface{}) { + manager.enqueueService(cur) + }, + UpdateFunc: func(old, cur interface{}) { + manager.enqueueService(cur) + }, + DeleteFunc: func(old interface{}) { + manager.enqueueService(old) + }, + }, + ) + + // BGPPolicyDefinedSetsInformer.Informer().AddEventHandlerWithResyncPeriod( + // cache.ResourceEventHandlerFuncs{ + // AddFunc: func(cur interface{}) { + // manager.enqueueService(cur) + // }, + // UpdateFunc: func(old, cur interface{}) { + // manager.enqueueService(cur) + // }, + // DeleteFunc: func(old interface{}) { + // manager.enqueueService(old) + // }, + // }, + // resyncPeriod, + // ) + + return manager +} + +func (m *Manager) enqueueService(obj interface{}) { + lb, ok := obj.(*crdv1.BGPPolicyDefinedSetsService) + if !ok { + deletedState, ok := obj.(cache.DeletedFinalStateUnknown) + if !ok { + klog.Errorf("Received unexpected object: %v", obj) + return + } + lb, ok = deletedState.Obj.(*crdv1.BGPPolicyDefinedSetsService) + if !ok { + klog.Errorf("DeletedFinalStateUnknown contains non-BGPPolicyDefinedSetsService object: %v", deletedState.Obj) + } + } + + m.queue.Add(lb) +} + +func (m *Manager) Run(stopCh <-chan struct{}, loxiLBLiveCh chan *api.LoxiClient, loxiLBPurgeCh chan *api.LoxiClient, masterEventCh <-chan bool) { + defer m.queue.ShutDown() + + klog.Infof("Starting %s", mgrName) + defer klog.Infof("Shutting down %s", mgrName) + + if !cache.WaitForNamedCacheSync( + mgrName, + stopCh, + m.BGPPolicyDefinedSetsListerSynced) { + return + } + for i := 0; i < defaultWorkers; i++ { + go wait.Until(m.worker, time.Second, stopCh) + } + <-stopCh +} + +func (m *Manager) worker() { + for m.processNextWorkItem() { + } +} + +func (m *Manager) processNextWorkItem() bool { + obj, quit := m.queue.Get() + if quit { + return false + } + defer m.queue.Done(obj) + if bgpdf, ok := obj.(*crdv1.BGPPolicyDefinedSetsService); !ok { + m.queue.Forget(obj) + klog.Errorf("Expected string in work queue but got %#v", obj) + return true + } else if err := m.syncBGPPolicyDefinedSetsService(bgpdf); err == nil { + m.queue.Forget(obj) + } else { + m.queue.AddRateLimited(obj) + klog.Errorf("Error syncing CRD BGPPolicyDefinedSetsService %s, requeuing. Error: %v", bgpdf.Name, err) + } + + return true +} + +func (m *Manager) syncBGPPolicyDefinedSetsService(bgpdf *crdv1.BGPPolicyDefinedSetsService) error { + startTime := time.Now() + defer func() { + klog.V(4).Infof("Finished syncing BGPPolicyDefinedSetsService %s. (%v)", bgpdf.Name, time.Since(startTime)) + }() + _, err := m.BGPPolicyDefinedSetsLister.Get(bgpdf.Name) + if err != nil { + return m.deleteBGPPolicyDefinedSetsService(bgpdf) + } + + return m.addBGPPolicyDefinedSetsService(bgpdf) +} + +func (m *Manager) addBGPPolicyDefinedSetsService(bgpdf *crdv1.BGPPolicyDefinedSetsService) error { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + klog.Infof("bgpdf.Spec.Name: %v\n", bgpdf.Spec.Name) + klog.Infof("bgpdf.Spec.List: %v\n", bgpdf.Spec.List) + klog.Infof("bgpdf.Spec.PrefixList: %v\n", bgpdf.Spec.PrefixList) + klog.Infof("bgpdf.Spec.DefinedType: %v\n", bgpdf.Spec.DefinedType) + + var errChList []chan error + for _, client := range m.lbManager.LoxiClients { + ch := make(chan error) + go func(c *api.LoxiClient, h chan error) { + var err error + if err = c.BGPPolicyDefinedSetsAPI().CreateBGPPolicyDefinedSets(ctx, bgpdf.Spec.DefinedType, &bgpdf.Spec); err != nil { + if !strings.Contains(err.Error(), "exist") { + klog.Errorf("failed to create BGPPolicyDefinedSets(%s) :%v", c.Url, err) + } else { + err = nil + } + } + h <- err + }(client, ch) + + errChList = append(errChList, ch) + } + + isError := true + for _, errCh := range errChList { + err := <-errCh + if err == nil { + isError = false + } + } + if isError { + klog.Errorf("failed to add BGPPolicyDefinedSets") + return fmt.Errorf("failed to add loxiLB BGPPolicyDefinedSets") + } + + return nil +} + +func (m *Manager) deleteBGPPolicyDefinedSetsService(bgpdf *crdv1.BGPPolicyDefinedSetsService) error { + var errChList []chan error + for _, loxiClient := range m.lbManager.LoxiClients { + ch := make(chan error) + errChList = append(errChList, ch) + + go func(client *api.LoxiClient, ch chan error) { + klog.Infof("called loxilb API: delete bgpdf rule %v", bgpdf.Spec) + ch <- client.BGPPolicyDefinedSetsAPI().DeleteBGPPolicyDefinedSets(context.Background(), bgpdf.Spec.DefinedType, bgpdf.Spec.Name) + }(loxiClient, ch) + } + + isError := true + errStr := "" + for _, errCh := range errChList { + err := <-errCh + if err == nil { + isError = false + break + } else { + errStr = err.Error() + } + } + if isError { + return fmt.Errorf("failed to delete loxiLB LoadBalancer. Error: %v", errStr) + } + return nil +} diff --git a/pkg/agent/manager/bgppolicydefinition/bgppolicydefinition.go b/pkg/agent/manager/bgppolicydefinition/bgppolicydefinition.go new file mode 100644 index 0000000..46f6c98 --- /dev/null +++ b/pkg/agent/manager/bgppolicydefinition/bgppolicydefinition.go @@ -0,0 +1,235 @@ +/* + * Copyright (c) 2024 NetLOX Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package bgppolicydefinition + +import ( + "context" + "fmt" + "strings" + "time" + + "github.com/loxilb-io/kube-loxilb/pkg/agent/config" + "github.com/loxilb-io/kube-loxilb/pkg/agent/manager/loadbalancer" + "github.com/loxilb-io/kube-loxilb/pkg/api" + "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" + crdInformer "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicydefinition/v1" + crdLister "github.com/loxilb-io/kube-loxilb/pkg/client/listers/bgppolicydefinition/v1" + crdv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + + //v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/cache" + "k8s.io/client-go/util/workqueue" + "k8s.io/klog/v2" +) + +const ( + mgrName = "BGPPolicyDefinitionService" + defaultWorkers = 4 + minRetryDelay = 2 * time.Second + maxRetryDelay = 120 * time.Second +) + +type Manager struct { + kubeClient kubernetes.Interface + crdClient versioned.Interface + BGPPolicyDefinitionInformer crdInformer.BGPPolicyDefinitionServiceInformer + BGPPolicyDefinitionLister crdLister.BGPPolicyDefinitionServiceLister + BGPPolicyDefinitionListerSynced cache.InformerSynced + queue workqueue.RateLimitingInterface + lbManager *loadbalancer.Manager +} + +// Create and Init Manager. +// Manager is called by kube-loxilb when k8s service is created & updated. +func NewBGPPolicyDefinitionManager( + kubeClient kubernetes.Interface, + crdClient versioned.Interface, + networkConfig *config.NetworkConfig, + BGPPolicyDefinitionInformer crdInformer.BGPPolicyDefinitionServiceInformer, + lbManager *loadbalancer.Manager, +) *Manager { + + manager := &Manager{ + + kubeClient: kubeClient, + crdClient: crdClient, + BGPPolicyDefinitionInformer: BGPPolicyDefinitionInformer, + BGPPolicyDefinitionLister: BGPPolicyDefinitionInformer.Lister(), + BGPPolicyDefinitionListerSynced: BGPPolicyDefinitionInformer.Informer().HasSynced, + lbManager: lbManager, + + queue: workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(minRetryDelay, maxRetryDelay), "BGPPolicyDefinition"), + } + BGPPolicyDefinitionInformer.Informer().AddEventHandler( + cache.ResourceEventHandlerFuncs{ + AddFunc: func(cur interface{}) { + manager.enqueueService(cur) + }, + UpdateFunc: func(old, cur interface{}) { + manager.enqueueService(cur) + }, + DeleteFunc: func(old interface{}) { + manager.enqueueService(old) + }, + }, + ) + + return manager +} + +func (m *Manager) enqueueService(obj interface{}) { + lb, ok := obj.(*crdv1.BGPPolicyDefinitionService) + if !ok { + deletedState, ok := obj.(cache.DeletedFinalStateUnknown) + if !ok { + klog.Errorf("Received unexpected object: %v", obj) + return + } + lb, ok = deletedState.Obj.(*crdv1.BGPPolicyDefinitionService) + if !ok { + klog.Errorf("DeletedFinalStateUnknown contains non-BGPPolicyDefinitionService object: %v", deletedState.Obj) + } + } + + m.queue.Add(lb) +} + +func (m *Manager) Run(stopCh <-chan struct{}, loxiLBLiveCh chan *api.LoxiClient, loxiLBPurgeCh chan *api.LoxiClient, masterEventCh <-chan bool) { + defer m.queue.ShutDown() + + klog.Infof("Starting %s", mgrName) + defer klog.Infof("Shutting down %s", mgrName) + + if !cache.WaitForNamedCacheSync( + mgrName, + stopCh, + m.BGPPolicyDefinitionListerSynced) { + return + } + for i := 0; i < defaultWorkers; i++ { + go wait.Until(m.worker, time.Second, stopCh) + } + <-stopCh +} + +func (m *Manager) worker() { + for m.processNextWorkItem() { + } +} + +func (m *Manager) processNextWorkItem() bool { + obj, quit := m.queue.Get() + if quit { + return false + } + defer m.queue.Done(obj) + if bgpdf, ok := obj.(*crdv1.BGPPolicyDefinitionService); !ok { + m.queue.Forget(obj) + klog.Errorf("Expected string in work queue but got %#v", obj) + return true + } else if err := m.syncBGPPolicyDefinitionService(bgpdf); err == nil { + m.queue.Forget(obj) + } else { + m.queue.AddRateLimited(obj) + klog.Errorf("Error syncing CRD BGPPolicyDefinitionService %s, requeuing. Error: %v", bgpdf.Name, err) + } + + // fmt.Printf("obj: %v\n", obj) + // fmt.Printf("m.queue: %v\n", m.queue) + return true +} + +func (m *Manager) syncBGPPolicyDefinitionService(bgpdf *crdv1.BGPPolicyDefinitionService) error { + startTime := time.Now() + defer func() { + klog.V(4).Infof("Finished syncing BGPPolicyDefinitionService %s. (%v)", bgpdf.Name, time.Since(startTime)) + }() + _, err := m.BGPPolicyDefinitionLister.Get(bgpdf.Name) + if err != nil { + return m.deleteBGPPolicyDefinitionService(bgpdf) + } + return m.addBGPPolicyDefinitionService(bgpdf) +} + +func (m *Manager) addBGPPolicyDefinitionService(bgpdf *crdv1.BGPPolicyDefinitionService) error { + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + klog.Infof("bgpdf.Spec.Name: %v\n", bgpdf.Spec.Name) + fmt.Printf("bgpdf.Spec: %v\n", bgpdf.Spec) + var errChList []chan error + for _, client := range m.lbManager.LoxiClients { + ch := make(chan error) + go func(c *api.LoxiClient, h chan error) { + var err error + if err = c.BGPPolicyDefinition().CreateBGPPolicyDefinition(ctx, &bgpdf.Spec); err != nil { + if !strings.Contains(err.Error(), "exist") { + klog.Errorf("failed to create BGPPolicyDefinition(%s) :%v", c.Url, err) + } else { + err = nil + } + } + h <- err + }(client, ch) + + errChList = append(errChList, ch) + } + + isError := true + for _, errCh := range errChList { + err := <-errCh + if err == nil { + isError = false + } + } + if isError { + klog.Errorf("failed to add BGPPolicyDefinition") + return fmt.Errorf("failed to add loxiLB BGPPolicyDefinition") + } + + return nil +} + +func (m *Manager) deleteBGPPolicyDefinitionService(bgpdf *crdv1.BGPPolicyDefinitionService) error { + var errChList []chan error + for _, loxiClient := range m.lbManager.LoxiClients { + ch := make(chan error) + errChList = append(errChList, ch) + + go func(client *api.LoxiClient, ch chan error) { + klog.Infof("called loxilb API: delete bgpdf rule %v", bgpdf.Spec) + ch <- client.BGPPolicyDefinition().DeleteBGPPolicyDefinition(context.Background(), bgpdf.Spec.Name) + }(loxiClient, ch) + } + + isError := true + errStr := "" + for _, errCh := range errChList { + err := <-errCh + if err == nil { + isError = false + break + } else { + errStr = err.Error() + } + } + if isError { + return fmt.Errorf("failed to delete loxiLB LoadBalancer. Error: %v", errStr) + } + return nil +} diff --git a/pkg/api/bgppolicyapply.go b/pkg/api/bgppolicyapply.go new file mode 100644 index 0000000..c8d529c --- /dev/null +++ b/pkg/api/bgppolicyapply.go @@ -0,0 +1,46 @@ +package api + +import ( + "context" +) + +// BGPPolicyApply - Info related to a end-point config entry +type BGPPolicyApply struct { + NeighIPAddress string `json:"ipAddress,omitempty"` + PolicyType string `json:"policyType,omitempty"` + Policies []string `json:"policies,omitempty"` + RouteAction string `json:"routeAction,omitempty"` +} + +type BGPPolicyApplyAPI struct { + resource string + provider string + version string + client *RESTClient + APICommonFunc +} + +func newBGPPolicyApplyAPI(r *RESTClient) *BGPPolicyApplyAPI { + return &BGPPolicyApplyAPI{ + resource: "config/bgp/policy/apply", + provider: r.provider, + version: r.version, + client: r, + } +} + +func (b *BGPPolicyApplyAPI) CreateBGPPolicyApply(ctx context.Context, Model LoxiModel) error { + resp := b.client.POST(b.resource).Body(Model).Do(ctx) + if resp.err != nil { + return resp.err + } + return nil +} + +func (b *BGPPolicyApplyAPI) DeleteBGPPolicyApply(ctx context.Context, Model LoxiModel) error { + resp := b.client.DELETE(b.resource).Body(Model).Do(ctx) + if resp.err != nil { + return resp.err + } + return nil +} diff --git a/pkg/api/bgppolicydefinedsets.go b/pkg/api/bgppolicydefinedsets.go new file mode 100644 index 0000000..2122690 --- /dev/null +++ b/pkg/api/bgppolicydefinedsets.go @@ -0,0 +1,53 @@ +package api + +import ( + "context" +) + +// BGPPolicyDefinedSets - Info related to a end-point config entry +type BGPPolicyDefinedSets struct { + Name string `json:"name"` + DefinedType string `json:"definedType"` + List []string `json:"List,omitempty"` + PrefixList []Prefix `json:"prefixList,omitempty"` +} + +// Prefix - Info related to goBGP Policy Prefix +type Prefix struct { + IpPrefix string `json:"ipPrefix"` + MasklengthRange string `json:"masklengthRange"` +} + +type BGPPolicyDefinedSetsAPI struct { + resource string + provider string + version string + client *RESTClient + APICommonFunc +} + +func newBGPPolicyDefinedSetsAPI(r *RESTClient) *BGPPolicyDefinedSetsAPI { + return &BGPPolicyDefinedSetsAPI{ + resource: "config/bgp/policy/definedsets", + provider: r.provider, + version: r.version, + client: r, + } +} + +func (b *BGPPolicyDefinedSetsAPI) CreateBGPPolicyDefinedSets(ctx context.Context, DefinedType string, Model LoxiModel) error { + resp := b.client.POST(b.resource + "/" + DefinedType).Body(Model).Do(ctx) + if resp.err != nil { + return resp.err + } + return nil +} + +func (b *BGPPolicyDefinedSetsAPI) DeleteBGPPolicyDefinedSets(ctx context.Context, DefinedType, DefinedName string) error { + resp := b.client.DELETE(b.resource + "/" + DefinedType + "/" + DefinedName).Do(ctx) + if resp.err != nil { + return resp.err + } + + return nil +} diff --git a/pkg/api/bgppolicydefinition.go b/pkg/api/bgppolicydefinition.go new file mode 100644 index 0000000..eee4069 --- /dev/null +++ b/pkg/api/bgppolicydefinition.go @@ -0,0 +1,39 @@ +package api + +import ( + "context" +) + +type BGPPolicyDefinitionAPI struct { + resource string + provider string + version string + client *RESTClient + APICommonFunc +} + +func newBGPPolicyDefinition(r *RESTClient) *BGPPolicyDefinitionAPI { + return &BGPPolicyDefinitionAPI{ + resource: "config/bgp/policy/definitions", + provider: r.provider, + version: r.version, + client: r, + } +} + +func (b *BGPPolicyDefinitionAPI) CreateBGPPolicyDefinition(ctx context.Context, Model LoxiModel) error { + resp := b.client.POST(b.resource).Body(Model).Do(ctx) + if resp.err != nil { + return resp.err + } + return nil +} + +func (b *BGPPolicyDefinitionAPI) DeleteBGPPolicyDefinition(ctx context.Context, DefinedName string) error { + resp := b.client.DELETE(b.resource + "/" + DefinedName).Do(ctx) + if resp.err != nil { + return resp.err + } + + return nil +} diff --git a/pkg/api/client.go b/pkg/api/client.go index 487e75a..28dfdce 100644 --- a/pkg/api/client.go +++ b/pkg/api/client.go @@ -116,6 +116,18 @@ func (l *LoxiClient) HealthCheck() *HealthCheckAPI { return newHealthCheckAPI(l.GetRESTClient()) } +func (l *LoxiClient) BGPPolicyDefinedSetsAPI() *BGPPolicyDefinedSetsAPI { + return newBGPPolicyDefinedSetsAPI(l.GetRESTClient()) +} + +func (l *LoxiClient) BGPPolicyDefinition() *BGPPolicyDefinitionAPI { + return newBGPPolicyDefinition(l.GetRESTClient()) +} + +func (l *LoxiClient) BGPPolicyApply() *BGPPolicyApplyAPI { + return newBGPPolicyApplyAPI(l.GetRESTClient()) +} + func (l *LoxiClient) GetRESTClient() *RESTClient { if l == nil { return nil diff --git a/pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplymodel.go b/pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplymodel.go new file mode 100644 index 0000000..d5af143 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplymodel.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPPolicyApplyModelApplyConfiguration represents an declarative configuration of the BGPPolicyApplyModel type for use +// with apply. +type BGPPolicyApplyModelApplyConfiguration struct { + NeighIPAddress *string `json:"ipAddress,omitempty"` + PolicyType *string `json:"policyType,omitempty"` + Policies []string `json:"policies,omitempty"` + RouteAction *string `json:"routeAction,omitempty"` +} + +// BGPPolicyApplyModelApplyConfiguration constructs an declarative configuration of the BGPPolicyApplyModel type for use with +// apply. +func BGPPolicyApplyModel() *BGPPolicyApplyModelApplyConfiguration { + return &BGPPolicyApplyModelApplyConfiguration{} +} + +// WithNeighIPAddress sets the NeighIPAddress field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NeighIPAddress field is set to the value of the last call. +func (b *BGPPolicyApplyModelApplyConfiguration) WithNeighIPAddress(value string) *BGPPolicyApplyModelApplyConfiguration { + b.NeighIPAddress = &value + return b +} + +// WithPolicyType sets the PolicyType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PolicyType field is set to the value of the last call. +func (b *BGPPolicyApplyModelApplyConfiguration) WithPolicyType(value string) *BGPPolicyApplyModelApplyConfiguration { + b.PolicyType = &value + return b +} + +// WithPolicies adds the given value to the Policies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Policies field. +func (b *BGPPolicyApplyModelApplyConfiguration) WithPolicies(values ...string) *BGPPolicyApplyModelApplyConfiguration { + for i := range values { + b.Policies = append(b.Policies, values[i]) + } + return b +} + +// WithRouteAction sets the RouteAction field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RouteAction field is set to the value of the last call. +func (b *BGPPolicyApplyModelApplyConfiguration) WithRouteAction(value string) *BGPPolicyApplyModelApplyConfiguration { + b.RouteAction = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplyservice.go b/pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplyservice.go new file mode 100644 index 0000000..9e37d0c --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicyapply/v1/bgppolicyapplyservice.go @@ -0,0 +1,219 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + crdsbgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// BGPPolicyApplyServiceApplyConfiguration represents an declarative configuration of the BGPPolicyApplyService type for use +// with apply. +type BGPPolicyApplyServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *BGPPolicyApplyModelApplyConfiguration `json:"spec,omitempty"` + Status *crdsbgppolicyapplyv1.BGPPolicyApplyServiceStatus `json:"status,omitempty"` +} + +// BGPPolicyApplyService constructs an declarative configuration of the BGPPolicyApplyService type for use with +// apply. +func BGPPolicyApplyService(name string) *BGPPolicyApplyServiceApplyConfiguration { + b := &BGPPolicyApplyServiceApplyConfiguration{} + b.WithName(name) + b.WithKind("BGPPolicyApplyService") + b.WithAPIVersion("bgppolicyapply.loxilb.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithKind(value string) *BGPPolicyApplyServiceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithAPIVersion(value string) *BGPPolicyApplyServiceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithName(value string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithGenerateName(value string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithNamespace(value string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithUID(value types.UID) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithResourceVersion(value string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithGeneration(value int64) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithLabels(entries map[string]string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithAnnotations(entries map[string]string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithFinalizers(values ...string) *BGPPolicyApplyServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *BGPPolicyApplyServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithSpec(value *BGPPolicyApplyModelApplyConfiguration) *BGPPolicyApplyServiceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *BGPPolicyApplyServiceApplyConfiguration) WithStatus(value crdsbgppolicyapplyv1.BGPPolicyApplyServiceStatus) *BGPPolicyApplyServiceApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsmodel.go b/pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsmodel.go new file mode 100644 index 0000000..8b72cc1 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsmodel.go @@ -0,0 +1,74 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + api "github.com/loxilb-io/kube-loxilb/pkg/api" +) + +// BGPPolicyDefinedSetsModelApplyConfiguration represents an declarative configuration of the BGPPolicyDefinedSetsModel type for use +// with apply. +type BGPPolicyDefinedSetsModelApplyConfiguration struct { + Name *string `json:"name,omitempty"` + DefinedType *string `json:"definedType,omitempty"` + List []string `json:"List,omitempty"` + PrefixList []api.Prefix `json:"prefixList,omitempty"` +} + +// BGPPolicyDefinedSetsModelApplyConfiguration constructs an declarative configuration of the BGPPolicyDefinedSetsModel type for use with +// apply. +func BGPPolicyDefinedSetsModel() *BGPPolicyDefinedSetsModelApplyConfiguration { + return &BGPPolicyDefinedSetsModelApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsModelApplyConfiguration) WithName(value string) *BGPPolicyDefinedSetsModelApplyConfiguration { + b.Name = &value + return b +} + +// WithDefinedType sets the DefinedType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DefinedType field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsModelApplyConfiguration) WithDefinedType(value string) *BGPPolicyDefinedSetsModelApplyConfiguration { + b.DefinedType = &value + return b +} + +// WithList adds the given value to the List field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the List field. +func (b *BGPPolicyDefinedSetsModelApplyConfiguration) WithList(values ...string) *BGPPolicyDefinedSetsModelApplyConfiguration { + for i := range values { + b.List = append(b.List, values[i]) + } + return b +} + +// WithPrefixList adds the given value to the PrefixList field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the PrefixList field. +func (b *BGPPolicyDefinedSetsModelApplyConfiguration) WithPrefixList(values ...api.Prefix) *BGPPolicyDefinedSetsModelApplyConfiguration { + for i := range values { + b.PrefixList = append(b.PrefixList, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go b/pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go new file mode 100644 index 0000000..80062e2 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go @@ -0,0 +1,219 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + crdsbgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// BGPPolicyDefinedSetsServiceApplyConfiguration represents an declarative configuration of the BGPPolicyDefinedSetsService type for use +// with apply. +type BGPPolicyDefinedSetsServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *BGPPolicyDefinedSetsModelApplyConfiguration `json:"spec,omitempty"` + Status *crdsbgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceStatus `json:"status,omitempty"` +} + +// BGPPolicyDefinedSetsService constructs an declarative configuration of the BGPPolicyDefinedSetsService type for use with +// apply. +func BGPPolicyDefinedSetsService(name string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b := &BGPPolicyDefinedSetsServiceApplyConfiguration{} + b.WithName(name) + b.WithKind("BGPPolicyDefinedSetsService") + b.WithAPIVersion("bgppolicydefinedsets.loxilb.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithKind(value string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithAPIVersion(value string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithName(value string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithGenerateName(value string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithNamespace(value string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithUID(value types.UID) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithResourceVersion(value string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithGeneration(value int64) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithLabels(entries map[string]string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithAnnotations(entries map[string]string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithFinalizers(values ...string) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithSpec(value *BGPPolicyDefinedSetsModelApplyConfiguration) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *BGPPolicyDefinedSetsServiceApplyConfiguration) WithStatus(value crdsbgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceStatus) *BGPPolicyDefinedSetsServiceApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/actions.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/actions.go new file mode 100644 index 0000000..2f5c44e --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/actions.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ActionsApplyConfiguration represents an declarative configuration of the Actions type for use +// with apply. +type ActionsApplyConfiguration struct { + RouteDisposition *string `json:"routeDisposition,omitempty"` + BGPActions *BGPActionsApplyConfiguration `json:"bgpActions,omitempty"` +} + +// ActionsApplyConfiguration constructs an declarative configuration of the Actions type for use with +// apply. +func Actions() *ActionsApplyConfiguration { + return &ActionsApplyConfiguration{} +} + +// WithRouteDisposition sets the RouteDisposition field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RouteDisposition field is set to the value of the last call. +func (b *ActionsApplyConfiguration) WithRouteDisposition(value string) *ActionsApplyConfiguration { + b.RouteDisposition = &value + return b +} + +// WithBGPActions sets the BGPActions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BGPActions field is set to the value of the last call. +func (b *ActionsApplyConfiguration) WithBGPActions(value *BGPActionsApplyConfiguration) *ActionsApplyConfiguration { + b.BGPActions = value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpactions.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpactions.go new file mode 100644 index 0000000..036445a --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpactions.go @@ -0,0 +1,93 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPActionsApplyConfiguration represents an declarative configuration of the BGPActions type for use +// with apply. +type BGPActionsApplyConfiguration struct { + SetMed *string `json:"setMed,omitempty"` + SetCommunity *SetCommunityApplyConfiguration `json:"setCommunity,omitempty"` + SetExtCommunity *SetCommunityApplyConfiguration `json:"setExtCommunity,omitempty"` + SetLargeCommunity *SetCommunityApplyConfiguration `json:"setLargeCommunity,omitempty"` + SetNextHop *string `json:"setNextHop,omitempty"` + SetLocalPerf *int `json:"setLocalPerf,omitempty"` + SetAsPathPrepend *SetAsPathPrependApplyConfiguration `json:"setAsPathPrepend,omitempty"` +} + +// BGPActionsApplyConfiguration constructs an declarative configuration of the BGPActions type for use with +// apply. +func BGPActions() *BGPActionsApplyConfiguration { + return &BGPActionsApplyConfiguration{} +} + +// WithSetMed sets the SetMed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetMed field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetMed(value string) *BGPActionsApplyConfiguration { + b.SetMed = &value + return b +} + +// WithSetCommunity sets the SetCommunity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetCommunity field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetCommunity(value *SetCommunityApplyConfiguration) *BGPActionsApplyConfiguration { + b.SetCommunity = value + return b +} + +// WithSetExtCommunity sets the SetExtCommunity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetExtCommunity field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetExtCommunity(value *SetCommunityApplyConfiguration) *BGPActionsApplyConfiguration { + b.SetExtCommunity = value + return b +} + +// WithSetLargeCommunity sets the SetLargeCommunity field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetLargeCommunity field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetLargeCommunity(value *SetCommunityApplyConfiguration) *BGPActionsApplyConfiguration { + b.SetLargeCommunity = value + return b +} + +// WithSetNextHop sets the SetNextHop field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetNextHop field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetNextHop(value string) *BGPActionsApplyConfiguration { + b.SetNextHop = &value + return b +} + +// WithSetLocalPerf sets the SetLocalPerf field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetLocalPerf field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetLocalPerf(value int) *BGPActionsApplyConfiguration { + b.SetLocalPerf = &value + return b +} + +// WithSetAsPathPrepend sets the SetAsPathPrepend field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SetAsPathPrepend field is set to the value of the last call. +func (b *BGPActionsApplyConfiguration) WithSetAsPathPrepend(value *SetAsPathPrependApplyConfiguration) *BGPActionsApplyConfiguration { + b.SetAsPathPrepend = value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathlength.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathlength.go new file mode 100644 index 0000000..0704cba --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathlength.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPAsPathLengthApplyConfiguration represents an declarative configuration of the BGPAsPathLength type for use +// with apply. +type BGPAsPathLengthApplyConfiguration struct { + Operator *string `json:"operator,omitempty"` + Value *int `json:"value,omitempty"` +} + +// BGPAsPathLengthApplyConfiguration constructs an declarative configuration of the BGPAsPathLength type for use with +// apply. +func BGPAsPathLength() *BGPAsPathLengthApplyConfiguration { + return &BGPAsPathLengthApplyConfiguration{} +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *BGPAsPathLengthApplyConfiguration) WithOperator(value string) *BGPAsPathLengthApplyConfiguration { + b.Operator = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *BGPAsPathLengthApplyConfiguration) WithValue(value int) *BGPAsPathLengthApplyConfiguration { + b.Value = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathset.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathset.go new file mode 100644 index 0000000..da19ae3 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpaspathset.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPAsPathSetApplyConfiguration represents an declarative configuration of the BGPAsPathSet type for use +// with apply. +type BGPAsPathSetApplyConfiguration struct { + AsPathSet *string `json:"asPathSet,omitempty"` + MatchSetOptions *string `json:"matchSetOptions,omitempty"` +} + +// BGPAsPathSetApplyConfiguration constructs an declarative configuration of the BGPAsPathSet type for use with +// apply. +func BGPAsPathSet() *BGPAsPathSetApplyConfiguration { + return &BGPAsPathSetApplyConfiguration{} +} + +// WithAsPathSet sets the AsPathSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AsPathSet field is set to the value of the last call. +func (b *BGPAsPathSetApplyConfiguration) WithAsPathSet(value string) *BGPAsPathSetApplyConfiguration { + b.AsPathSet = &value + return b +} + +// WithMatchSetOptions sets the MatchSetOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchSetOptions field is set to the value of the last call. +func (b *BGPAsPathSetApplyConfiguration) WithMatchSetOptions(value string) *BGPAsPathSetApplyConfiguration { + b.MatchSetOptions = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpcommunityset.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpcommunityset.go new file mode 100644 index 0000000..5897ce4 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpcommunityset.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPCommunitySetApplyConfiguration represents an declarative configuration of the BGPCommunitySet type for use +// with apply. +type BGPCommunitySetApplyConfiguration struct { + CommunitySet *string `json:"communitySet,omitempty"` + MatchSetOptions *string `json:"matchSetOptions,omitempty"` +} + +// BGPCommunitySetApplyConfiguration constructs an declarative configuration of the BGPCommunitySet type for use with +// apply. +func BGPCommunitySet() *BGPCommunitySetApplyConfiguration { + return &BGPCommunitySetApplyConfiguration{} +} + +// WithCommunitySet sets the CommunitySet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CommunitySet field is set to the value of the last call. +func (b *BGPCommunitySetApplyConfiguration) WithCommunitySet(value string) *BGPCommunitySetApplyConfiguration { + b.CommunitySet = &value + return b +} + +// WithMatchSetOptions sets the MatchSetOptions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchSetOptions field is set to the value of the last call. +func (b *BGPCommunitySetApplyConfiguration) WithMatchSetOptions(value string) *BGPCommunitySetApplyConfiguration { + b.MatchSetOptions = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpconditions.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpconditions.go new file mode 100644 index 0000000..6b0c32b --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgpconditions.go @@ -0,0 +1,115 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPConditionsApplyConfiguration represents an declarative configuration of the BGPConditions type for use +// with apply. +type BGPConditionsApplyConfiguration struct { + AfiSafiIn []string `json:"afiSafiIn,omitempty"` + AsPathSet *BGPAsPathSetApplyConfiguration `json:"matchAsPathSet,omitempty"` + AsPathLength *BGPAsPathLengthApplyConfiguration `json:"asPathLength,omitempty"` + CommunitySet *BGPCommunitySetApplyConfiguration `json:"matchCommunitySet,omitempty"` + ExtCommunitySet *BGPCommunitySetApplyConfiguration `json:"matchExtCommunitySet,omitempty"` + LargeCommunitySet *BGPCommunitySetApplyConfiguration `json:"largeCommunitySet,omitempty"` + RouteType *string `json:"routeType,omitempty"` + NextHopInList []string `json:"nextHopInList,omitempty"` + Rpki *string `json:"rpki,omitempty"` +} + +// BGPConditionsApplyConfiguration constructs an declarative configuration of the BGPConditions type for use with +// apply. +func BGPConditions() *BGPConditionsApplyConfiguration { + return &BGPConditionsApplyConfiguration{} +} + +// WithAfiSafiIn adds the given value to the AfiSafiIn field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AfiSafiIn field. +func (b *BGPConditionsApplyConfiguration) WithAfiSafiIn(values ...string) *BGPConditionsApplyConfiguration { + for i := range values { + b.AfiSafiIn = append(b.AfiSafiIn, values[i]) + } + return b +} + +// WithAsPathSet sets the AsPathSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AsPathSet field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithAsPathSet(value *BGPAsPathSetApplyConfiguration) *BGPConditionsApplyConfiguration { + b.AsPathSet = value + return b +} + +// WithAsPathLength sets the AsPathLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the AsPathLength field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithAsPathLength(value *BGPAsPathLengthApplyConfiguration) *BGPConditionsApplyConfiguration { + b.AsPathLength = value + return b +} + +// WithCommunitySet sets the CommunitySet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CommunitySet field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithCommunitySet(value *BGPCommunitySetApplyConfiguration) *BGPConditionsApplyConfiguration { + b.CommunitySet = value + return b +} + +// WithExtCommunitySet sets the ExtCommunitySet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ExtCommunitySet field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithExtCommunitySet(value *BGPCommunitySetApplyConfiguration) *BGPConditionsApplyConfiguration { + b.ExtCommunitySet = value + return b +} + +// WithLargeCommunitySet sets the LargeCommunitySet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LargeCommunitySet field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithLargeCommunitySet(value *BGPCommunitySetApplyConfiguration) *BGPConditionsApplyConfiguration { + b.LargeCommunitySet = value + return b +} + +// WithRouteType sets the RouteType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RouteType field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithRouteType(value string) *BGPConditionsApplyConfiguration { + b.RouteType = &value + return b +} + +// WithNextHopInList adds the given value to the NextHopInList field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NextHopInList field. +func (b *BGPConditionsApplyConfiguration) WithNextHopInList(values ...string) *BGPConditionsApplyConfiguration { + for i := range values { + b.NextHopInList = append(b.NextHopInList, values[i]) + } + return b +} + +// WithRpki sets the Rpki field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Rpki field is set to the value of the last call. +func (b *BGPConditionsApplyConfiguration) WithRpki(value string) *BGPConditionsApplyConfiguration { + b.Rpki = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinition.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinition.go new file mode 100644 index 0000000..6b2a491 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinition.go @@ -0,0 +1,53 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// BGPPolicyDefinitionApplyConfiguration represents an declarative configuration of the BGPPolicyDefinition type for use +// with apply. +type BGPPolicyDefinitionApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Statement []StatementApplyConfiguration `json:"statements,omitempty"` +} + +// BGPPolicyDefinitionApplyConfiguration constructs an declarative configuration of the BGPPolicyDefinition type for use with +// apply. +func BGPPolicyDefinition() *BGPPolicyDefinitionApplyConfiguration { + return &BGPPolicyDefinitionApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BGPPolicyDefinitionApplyConfiguration) WithName(value string) *BGPPolicyDefinitionApplyConfiguration { + b.Name = &value + return b +} + +// WithStatement adds the given value to the Statement field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Statement field. +func (b *BGPPolicyDefinitionApplyConfiguration) WithStatement(values ...*StatementApplyConfiguration) *BGPPolicyDefinitionApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithStatement") + } + b.Statement = append(b.Statement, *values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinitionservice.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinitionservice.go new file mode 100644 index 0000000..b1e7b85 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/bgppolicydefinitionservice.go @@ -0,0 +1,219 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + crdsbgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + v1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// BGPPolicyDefinitionServiceApplyConfiguration represents an declarative configuration of the BGPPolicyDefinitionService type for use +// with apply. +type BGPPolicyDefinitionServiceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *BGPPolicyDefinitionApplyConfiguration `json:"spec,omitempty"` + Status *crdsbgppolicydefinitionv1.BGPPolicyDefinitionServiceStatus `json:"status,omitempty"` +} + +// BGPPolicyDefinitionService constructs an declarative configuration of the BGPPolicyDefinitionService type for use with +// apply. +func BGPPolicyDefinitionService(name string) *BGPPolicyDefinitionServiceApplyConfiguration { + b := &BGPPolicyDefinitionServiceApplyConfiguration{} + b.WithName(name) + b.WithKind("BGPPolicyDefinitionService") + b.WithAPIVersion("bgppolicydefinition.loxilb.io/v1") + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithKind(value string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithAPIVersion(value string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithName(value string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithGenerateName(value string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithNamespace(value string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithUID(value types.UID) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithResourceVersion(value string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithGeneration(value int64) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithLabels(entries map[string]string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithAnnotations(entries map[string]string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithFinalizers(values ...string) *BGPPolicyDefinitionServiceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *BGPPolicyDefinitionServiceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithSpec(value *BGPPolicyDefinitionApplyConfiguration) *BGPPolicyDefinitionServiceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *BGPPolicyDefinitionServiceApplyConfiguration) WithStatus(value crdsbgppolicydefinitionv1.BGPPolicyDefinitionServiceStatus) *BGPPolicyDefinitionServiceApplyConfiguration { + b.Status = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/conditions.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/conditions.go new file mode 100644 index 0000000..f8ba1f1 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/conditions.go @@ -0,0 +1,57 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// ConditionsApplyConfiguration represents an declarative configuration of the Conditions type for use +// with apply. +type ConditionsApplyConfiguration struct { + PrefixSet *MatchPrefixSetApplyConfiguration `json:"matchPrefixSet,omitempty"` + NeighborSet *MatchNeighborSetApplyConfiguration `json:"matchNeighborSet,omitempty"` + BGPConditions *BGPConditionsApplyConfiguration `json:"bgpConditions,omitempty"` +} + +// ConditionsApplyConfiguration constructs an declarative configuration of the Conditions type for use with +// apply. +func Conditions() *ConditionsApplyConfiguration { + return &ConditionsApplyConfiguration{} +} + +// WithPrefixSet sets the PrefixSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixSet field is set to the value of the last call. +func (b *ConditionsApplyConfiguration) WithPrefixSet(value *MatchPrefixSetApplyConfiguration) *ConditionsApplyConfiguration { + b.PrefixSet = value + return b +} + +// WithNeighborSet sets the NeighborSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NeighborSet field is set to the value of the last call. +func (b *ConditionsApplyConfiguration) WithNeighborSet(value *MatchNeighborSetApplyConfiguration) *ConditionsApplyConfiguration { + b.NeighborSet = value + return b +} + +// WithBGPConditions sets the BGPConditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BGPConditions field is set to the value of the last call. +func (b *ConditionsApplyConfiguration) WithBGPConditions(value *BGPConditionsApplyConfiguration) *ConditionsApplyConfiguration { + b.BGPConditions = value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/matchneighborset.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/matchneighborset.go new file mode 100644 index 0000000..415e188 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/matchneighborset.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// MatchNeighborSetApplyConfiguration represents an declarative configuration of the MatchNeighborSet type for use +// with apply. +type MatchNeighborSetApplyConfiguration struct { + MatchSetOption *string `json:"matchSetOption,omitempty"` + NeighborSet *string `json:"neighborSet,omitempty"` +} + +// MatchNeighborSetApplyConfiguration constructs an declarative configuration of the MatchNeighborSet type for use with +// apply. +func MatchNeighborSet() *MatchNeighborSetApplyConfiguration { + return &MatchNeighborSetApplyConfiguration{} +} + +// WithMatchSetOption sets the MatchSetOption field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchSetOption field is set to the value of the last call. +func (b *MatchNeighborSetApplyConfiguration) WithMatchSetOption(value string) *MatchNeighborSetApplyConfiguration { + b.MatchSetOption = &value + return b +} + +// WithNeighborSet sets the NeighborSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NeighborSet field is set to the value of the last call. +func (b *MatchNeighborSetApplyConfiguration) WithNeighborSet(value string) *MatchNeighborSetApplyConfiguration { + b.NeighborSet = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/matchprefixset.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/matchprefixset.go new file mode 100644 index 0000000..b905ea8 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/matchprefixset.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// MatchPrefixSetApplyConfiguration represents an declarative configuration of the MatchPrefixSet type for use +// with apply. +type MatchPrefixSetApplyConfiguration struct { + MatchSetOption *string `json:"matchSetOption,omitempty"` + PrefixSet *string `json:"prefixSet,omitempty"` +} + +// MatchPrefixSetApplyConfiguration constructs an declarative configuration of the MatchPrefixSet type for use with +// apply. +func MatchPrefixSet() *MatchPrefixSetApplyConfiguration { + return &MatchPrefixSetApplyConfiguration{} +} + +// WithMatchSetOption sets the MatchSetOption field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MatchSetOption field is set to the value of the last call. +func (b *MatchPrefixSetApplyConfiguration) WithMatchSetOption(value string) *MatchPrefixSetApplyConfiguration { + b.MatchSetOption = &value + return b +} + +// WithPrefixSet sets the PrefixSet field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixSet field is set to the value of the last call. +func (b *MatchPrefixSetApplyConfiguration) WithPrefixSet(value string) *MatchPrefixSetApplyConfiguration { + b.PrefixSet = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/setaspathprepend.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/setaspathprepend.go new file mode 100644 index 0000000..1158efe --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/setaspathprepend.go @@ -0,0 +1,48 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// SetAsPathPrependApplyConfiguration represents an declarative configuration of the SetAsPathPrepend type for use +// with apply. +type SetAsPathPrependApplyConfiguration struct { + ASN *string `json:"as,omitempty"` + RepeatN *int `json:"repeatN,omitempty"` +} + +// SetAsPathPrependApplyConfiguration constructs an declarative configuration of the SetAsPathPrepend type for use with +// apply. +func SetAsPathPrepend() *SetAsPathPrependApplyConfiguration { + return &SetAsPathPrependApplyConfiguration{} +} + +// WithASN sets the ASN field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ASN field is set to the value of the last call. +func (b *SetAsPathPrependApplyConfiguration) WithASN(value string) *SetAsPathPrependApplyConfiguration { + b.ASN = &value + return b +} + +// WithRepeatN sets the RepeatN field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the RepeatN field is set to the value of the last call. +func (b *SetAsPathPrependApplyConfiguration) WithRepeatN(value int) *SetAsPathPrependApplyConfiguration { + b.RepeatN = &value + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/setcommunity.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/setcommunity.go new file mode 100644 index 0000000..a64ad98 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/setcommunity.go @@ -0,0 +1,50 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// SetCommunityApplyConfiguration represents an declarative configuration of the SetCommunity type for use +// with apply. +type SetCommunityApplyConfiguration struct { + Options *string `json:"options,omitempty"` + SetCommunityMethod []string `json:"setCommunityMethod,omitempty"` +} + +// SetCommunityApplyConfiguration constructs an declarative configuration of the SetCommunity type for use with +// apply. +func SetCommunity() *SetCommunityApplyConfiguration { + return &SetCommunityApplyConfiguration{} +} + +// WithOptions sets the Options field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Options field is set to the value of the last call. +func (b *SetCommunityApplyConfiguration) WithOptions(value string) *SetCommunityApplyConfiguration { + b.Options = &value + return b +} + +// WithSetCommunityMethod adds the given value to the SetCommunityMethod field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the SetCommunityMethod field. +func (b *SetCommunityApplyConfiguration) WithSetCommunityMethod(values ...string) *SetCommunityApplyConfiguration { + for i := range values { + b.SetCommunityMethod = append(b.SetCommunityMethod, values[i]) + } + return b +} diff --git a/pkg/client/applyconfiguration/bgppolicydefinition/v1/statement.go b/pkg/client/applyconfiguration/bgppolicydefinition/v1/statement.go new file mode 100644 index 0000000..532fa47 --- /dev/null +++ b/pkg/client/applyconfiguration/bgppolicydefinition/v1/statement.go @@ -0,0 +1,57 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// StatementApplyConfiguration represents an declarative configuration of the Statement type for use +// with apply. +type StatementApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Conditions *ConditionsApplyConfiguration `json:"conditions,omitempty"` + Actions *ActionsApplyConfiguration `json:"actions,omitempty"` +} + +// StatementApplyConfiguration constructs an declarative configuration of the Statement type for use with +// apply. +func Statement() *StatementApplyConfiguration { + return &StatementApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *StatementApplyConfiguration) WithName(value string) *StatementApplyConfiguration { + b.Name = &value + return b +} + +// WithConditions sets the Conditions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Conditions field is set to the value of the last call. +func (b *StatementApplyConfiguration) WithConditions(value *ConditionsApplyConfiguration) *StatementApplyConfiguration { + b.Conditions = value + return b +} + +// WithActions sets the Actions field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Actions field is set to the value of the last call. +func (b *StatementApplyConfiguration) WithActions(value *ActionsApplyConfiguration) *StatementApplyConfiguration { + b.Actions = value + return b +} diff --git a/pkg/client/applyconfiguration/utils.go b/pkg/client/applyconfiguration/utils.go index 73c1c08..4bb06ea 100644 --- a/pkg/client/applyconfiguration/utils.go +++ b/pkg/client/applyconfiguration/utils.go @@ -20,7 +20,13 @@ package applyconfiguration import ( bgppeerv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppeer/v1" + applyconfigurationbgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicyapply/v1" + applyconfigurationbgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicydefinedsets/v1" + applyconfigurationbgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicydefinition/v1" v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppeer/v1" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" ) @@ -34,6 +40,48 @@ func ForKind(kind schema.GroupVersionKind) interface{} { case v1.SchemeGroupVersion.WithKind("BGPPeerService"): return &bgppeerv1.BGPPeerServiceApplyConfiguration{} + // Group=bgppolicyapply.loxilb.io, Version=v1 + case bgppolicyapplyv1.SchemeGroupVersion.WithKind("BGPPolicyApplyModel"): + return &applyconfigurationbgppolicyapplyv1.BGPPolicyApplyModelApplyConfiguration{} + case bgppolicyapplyv1.SchemeGroupVersion.WithKind("BGPPolicyApplyService"): + return &applyconfigurationbgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration{} + + // Group=bgppolicydefinedsets.loxilb.io, Version=v1 + case bgppolicydefinedsetsv1.SchemeGroupVersion.WithKind("BGPPolicyDefinedSetsModel"): + return &applyconfigurationbgppolicydefinedsetsv1.BGPPolicyDefinedSetsModelApplyConfiguration{} + case bgppolicydefinedsetsv1.SchemeGroupVersion.WithKind("BGPPolicyDefinedSetsService"): + return &applyconfigurationbgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration{} + + // Group=bgppolicydefinition.loxilb.io, Version=v1 + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("Actions"): + return &applyconfigurationbgppolicydefinitionv1.ActionsApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPActions"): + return &applyconfigurationbgppolicydefinitionv1.BGPActionsApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPAsPathLength"): + return &applyconfigurationbgppolicydefinitionv1.BGPAsPathLengthApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPAsPathSet"): + return &applyconfigurationbgppolicydefinitionv1.BGPAsPathSetApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPCommunitySet"): + return &applyconfigurationbgppolicydefinitionv1.BGPCommunitySetApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPConditions"): + return &applyconfigurationbgppolicydefinitionv1.BGPConditionsApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPPolicyDefinition"): + return &applyconfigurationbgppolicydefinitionv1.BGPPolicyDefinitionApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("BGPPolicyDefinitionService"): + return &applyconfigurationbgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("Conditions"): + return &applyconfigurationbgppolicydefinitionv1.ConditionsApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("MatchNeighborSet"): + return &applyconfigurationbgppolicydefinitionv1.MatchNeighborSetApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("MatchPrefixSet"): + return &applyconfigurationbgppolicydefinitionv1.MatchPrefixSetApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("SetAsPathPrepend"): + return &applyconfigurationbgppolicydefinitionv1.SetAsPathPrependApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("SetCommunity"): + return &applyconfigurationbgppolicydefinitionv1.SetCommunityApplyConfiguration{} + case bgppolicydefinitionv1.SchemeGroupVersion.WithKind("Statement"): + return &applyconfigurationbgppolicydefinitionv1.StatementApplyConfiguration{} + } return nil } diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 1ed5515..202f375 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -23,6 +23,9 @@ import ( "net/http" bgppeerv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppeer/v1" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicyapply/v1" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1" discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" @@ -31,12 +34,18 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface BgppeerV1() bgppeerv1.BgppeerV1Interface + BgppolicyapplyV1() bgppolicyapplyv1.BgppolicyapplyV1Interface + BgppolicydefinedsetsV1() bgppolicydefinedsetsv1.BgppolicydefinedsetsV1Interface + BgppolicydefinitionV1() bgppolicydefinitionv1.BgppolicydefinitionV1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient - bgppeerV1 *bgppeerv1.BgppeerV1Client + bgppeerV1 *bgppeerv1.BgppeerV1Client + bgppolicyapplyV1 *bgppolicyapplyv1.BgppolicyapplyV1Client + bgppolicydefinedsetsV1 *bgppolicydefinedsetsv1.BgppolicydefinedsetsV1Client + bgppolicydefinitionV1 *bgppolicydefinitionv1.BgppolicydefinitionV1Client } // BgppeerV1 retrieves the BgppeerV1Client @@ -44,6 +53,21 @@ func (c *Clientset) BgppeerV1() bgppeerv1.BgppeerV1Interface { return c.bgppeerV1 } +// BgppolicyapplyV1 retrieves the BgppolicyapplyV1Client +func (c *Clientset) BgppolicyapplyV1() bgppolicyapplyv1.BgppolicyapplyV1Interface { + return c.bgppolicyapplyV1 +} + +// BgppolicydefinedsetsV1 retrieves the BgppolicydefinedsetsV1Client +func (c *Clientset) BgppolicydefinedsetsV1() bgppolicydefinedsetsv1.BgppolicydefinedsetsV1Interface { + return c.bgppolicydefinedsetsV1 +} + +// BgppolicydefinitionV1 retrieves the BgppolicydefinitionV1Client +func (c *Clientset) BgppolicydefinitionV1() bgppolicydefinitionv1.BgppolicydefinitionV1Interface { + return c.bgppolicydefinitionV1 +} + // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -92,6 +116,18 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, if err != nil { return nil, err } + cs.bgppolicyapplyV1, err = bgppolicyapplyv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.bgppolicydefinedsetsV1, err = bgppolicydefinedsetsv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } + cs.bgppolicydefinitionV1, err = bgppolicydefinitionv1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfigAndClient(&configShallowCopy, httpClient) if err != nil { @@ -114,6 +150,9 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { func New(c rest.Interface) *Clientset { var cs Clientset cs.bgppeerV1 = bgppeerv1.New(c) + cs.bgppolicyapplyV1 = bgppolicyapplyv1.New(c) + cs.bgppolicydefinedsetsV1 = bgppolicydefinedsetsv1.New(c) + cs.bgppolicydefinitionV1 = bgppolicydefinitionv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 4b80a1c..b94e569 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -22,6 +22,12 @@ import ( clientset "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" bgppeerv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppeer/v1" fakebgppeerv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppeer/v1/fake" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicyapply/v1" + fakebgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1" + fakebgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1" + fakebgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" "k8s.io/client-go/discovery" @@ -83,3 +89,18 @@ var ( func (c *Clientset) BgppeerV1() bgppeerv1.BgppeerV1Interface { return &fakebgppeerv1.FakeBgppeerV1{Fake: &c.Fake} } + +// BgppolicyapplyV1 retrieves the BgppolicyapplyV1Client +func (c *Clientset) BgppolicyapplyV1() bgppolicyapplyv1.BgppolicyapplyV1Interface { + return &fakebgppolicyapplyv1.FakeBgppolicyapplyV1{Fake: &c.Fake} +} + +// BgppolicydefinedsetsV1 retrieves the BgppolicydefinedsetsV1Client +func (c *Clientset) BgppolicydefinedsetsV1() bgppolicydefinedsetsv1.BgppolicydefinedsetsV1Interface { + return &fakebgppolicydefinedsetsv1.FakeBgppolicydefinedsetsV1{Fake: &c.Fake} +} + +// BgppolicydefinitionV1 retrieves the BgppolicydefinitionV1Client +func (c *Clientset) BgppolicydefinitionV1() bgppolicydefinitionv1.BgppolicydefinitionV1Interface { + return &fakebgppolicydefinitionv1.FakeBgppolicydefinitionV1{Fake: &c.Fake} +} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index e4c1f69..06b5019 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -20,6 +20,9 @@ package fake import ( bgppeerv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppeer/v1" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +35,9 @@ var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ bgppeerv1.AddToScheme, + bgppolicyapplyv1.AddToScheme, + bgppolicydefinedsetsv1.AddToScheme, + bgppolicydefinitionv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index 04106b2..acf920f 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -20,6 +20,9 @@ package scheme import ( bgppeerv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppeer/v1" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,6 +35,9 @@ var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ bgppeerv1.AddToScheme, + bgppolicyapplyv1.AddToScheme, + bgppolicydefinedsetsv1.AddToScheme, + bgppolicydefinitionv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapply_client.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapply_client.go new file mode 100644 index 0000000..dd1ea38 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapply_client.go @@ -0,0 +1,107 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/scheme" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + rest "k8s.io/client-go/rest" +) + +type BgppolicyapplyV1Interface interface { + RESTClient() rest.Interface + BGPPolicyApplyServicesGetter +} + +// BgppolicyapplyV1Client is used to interact with features provided by the bgppolicyapply.loxilb.io group. +type BgppolicyapplyV1Client struct { + restClient rest.Interface +} + +func (c *BgppolicyapplyV1Client) BGPPolicyApplyServices() BGPPolicyApplyServiceInterface { + return newBGPPolicyApplyServices(c) +} + +// NewForConfig creates a new BgppolicyapplyV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BgppolicyapplyV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BgppolicyapplyV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BgppolicyapplyV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BgppolicyapplyV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BgppolicyapplyV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BgppolicyapplyV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BgppolicyapplyV1Client for the given RESTClient. +func New(c rest.Interface) *BgppolicyapplyV1Client { + return &BgppolicyapplyV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BgppolicyapplyV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapplyservice.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapplyservice.go new file mode 100644 index 0000000..8c8d8c9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/bgppolicyapplyservice.go @@ -0,0 +1,243 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicyapply/v1" + scheme "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/scheme" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BGPPolicyApplyServicesGetter has a method to return a BGPPolicyApplyServiceInterface. +// A group's client should implement this interface. +type BGPPolicyApplyServicesGetter interface { + BGPPolicyApplyServices() BGPPolicyApplyServiceInterface +} + +// BGPPolicyApplyServiceInterface has methods to work with BGPPolicyApplyService resources. +type BGPPolicyApplyServiceInterface interface { + Create(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.CreateOptions) (*v1.BGPPolicyApplyService, error) + Update(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.UpdateOptions) (*v1.BGPPolicyApplyService, error) + UpdateStatus(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.UpdateOptions) (*v1.BGPPolicyApplyService, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.BGPPolicyApplyService, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.BGPPolicyApplyServiceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyApplyService, err error) + Apply(ctx context.Context, bGPPolicyApplyService *bgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyApplyService, err error) + ApplyStatus(ctx context.Context, bGPPolicyApplyService *bgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyApplyService, err error) + BGPPolicyApplyServiceExpansion +} + +// bGPPolicyApplyServices implements BGPPolicyApplyServiceInterface +type bGPPolicyApplyServices struct { + client rest.Interface +} + +// newBGPPolicyApplyServices returns a BGPPolicyApplyServices +func newBGPPolicyApplyServices(c *BgppolicyapplyV1Client) *bGPPolicyApplyServices { + return &bGPPolicyApplyServices{ + client: c.RESTClient(), + } +} + +// Get takes name of the bGPPolicyApplyService, and returns the corresponding bGPPolicyApplyService object, and an error if there is any. +func (c *bGPPolicyApplyServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BGPPolicyApplyService, err error) { + result = &v1.BGPPolicyApplyService{} + err = c.client.Get(). + Resource("bgppolicyapplyservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BGPPolicyApplyServices that match those selectors. +func (c *bGPPolicyApplyServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BGPPolicyApplyServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.BGPPolicyApplyServiceList{} + err = c.client.Get(). + Resource("bgppolicyapplyservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested bGPPolicyApplyServices. +func (c *bGPPolicyApplyServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("bgppolicyapplyservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a bGPPolicyApplyService and creates it. Returns the server's representation of the bGPPolicyApplyService, and an error, if there is any. +func (c *bGPPolicyApplyServices) Create(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.CreateOptions) (result *v1.BGPPolicyApplyService, err error) { + result = &v1.BGPPolicyApplyService{} + err = c.client.Post(). + Resource("bgppolicyapplyservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyApplyService). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a bGPPolicyApplyService and updates it. Returns the server's representation of the bGPPolicyApplyService, and an error, if there is any. +func (c *bGPPolicyApplyServices) Update(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.UpdateOptions) (result *v1.BGPPolicyApplyService, err error) { + result = &v1.BGPPolicyApplyService{} + err = c.client.Put(). + Resource("bgppolicyapplyservices"). + Name(bGPPolicyApplyService.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyApplyService). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *bGPPolicyApplyServices) UpdateStatus(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.UpdateOptions) (result *v1.BGPPolicyApplyService, err error) { + result = &v1.BGPPolicyApplyService{} + err = c.client.Put(). + Resource("bgppolicyapplyservices"). + Name(bGPPolicyApplyService.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyApplyService). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the bGPPolicyApplyService and deletes it. Returns an error if one occurs. +func (c *bGPPolicyApplyServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("bgppolicyapplyservices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *bGPPolicyApplyServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("bgppolicyapplyservices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched bGPPolicyApplyService. +func (c *bGPPolicyApplyServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyApplyService, err error) { + result = &v1.BGPPolicyApplyService{} + err = c.client.Patch(pt). + Resource("bgppolicyapplyservices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied bGPPolicyApplyService. +func (c *bGPPolicyApplyServices) Apply(ctx context.Context, bGPPolicyApplyService *bgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyApplyService, err error) { + if bGPPolicyApplyService == nil { + return nil, fmt.Errorf("bGPPolicyApplyService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(bGPPolicyApplyService) + if err != nil { + return nil, err + } + name := bGPPolicyApplyService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyApplyService.Name must be provided to Apply") + } + result = &v1.BGPPolicyApplyService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("bgppolicyapplyservices"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *bGPPolicyApplyServices) ApplyStatus(ctx context.Context, bGPPolicyApplyService *bgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyApplyService, err error) { + if bGPPolicyApplyService == nil { + return nil, fmt.Errorf("bGPPolicyApplyService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(bGPPolicyApplyService) + if err != nil { + return nil, err + } + + name := bGPPolicyApplyService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyApplyService.Name must be provided to Apply") + } + + result = &v1.BGPPolicyApplyService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("bgppolicyapplyservices"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/doc.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/doc.go new file mode 100644 index 0000000..3af5d05 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/doc.go new file mode 100644 index 0000000..16f4439 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapply_client.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapply_client.go new file mode 100644 index 0000000..1abc94e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapply_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicyapply/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeBgppolicyapplyV1 struct { + *testing.Fake +} + +func (c *FakeBgppolicyapplyV1) BGPPolicyApplyServices() v1.BGPPolicyApplyServiceInterface { + return &FakeBGPPolicyApplyServices{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBgppolicyapplyV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapplyservice.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapplyservice.go new file mode 100644 index 0000000..0d2865a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/fake/fake_bgppolicyapplyservice.go @@ -0,0 +1,178 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicyapply/v1" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBGPPolicyApplyServices implements BGPPolicyApplyServiceInterface +type FakeBGPPolicyApplyServices struct { + Fake *FakeBgppolicyapplyV1 +} + +var bgppolicyapplyservicesResource = v1.SchemeGroupVersion.WithResource("bgppolicyapplyservices") + +var bgppolicyapplyservicesKind = v1.SchemeGroupVersion.WithKind("BGPPolicyApplyService") + +// Get takes name of the bGPPolicyApplyService, and returns the corresponding bGPPolicyApplyService object, and an error if there is any. +func (c *FakeBGPPolicyApplyServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BGPPolicyApplyService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(bgppolicyapplyservicesResource, name), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} + +// List takes label and field selectors, and returns the list of BGPPolicyApplyServices that match those selectors. +func (c *FakeBGPPolicyApplyServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BGPPolicyApplyServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(bgppolicyapplyservicesResource, bgppolicyapplyservicesKind, opts), &v1.BGPPolicyApplyServiceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.BGPPolicyApplyServiceList{ListMeta: obj.(*v1.BGPPolicyApplyServiceList).ListMeta} + for _, item := range obj.(*v1.BGPPolicyApplyServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested bGPPolicyApplyServices. +func (c *FakeBGPPolicyApplyServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(bgppolicyapplyservicesResource, opts)) +} + +// Create takes the representation of a bGPPolicyApplyService and creates it. Returns the server's representation of the bGPPolicyApplyService, and an error, if there is any. +func (c *FakeBGPPolicyApplyServices) Create(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.CreateOptions) (result *v1.BGPPolicyApplyService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(bgppolicyapplyservicesResource, bGPPolicyApplyService), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} + +// Update takes the representation of a bGPPolicyApplyService and updates it. Returns the server's representation of the bGPPolicyApplyService, and an error, if there is any. +func (c *FakeBGPPolicyApplyServices) Update(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.UpdateOptions) (result *v1.BGPPolicyApplyService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(bgppolicyapplyservicesResource, bGPPolicyApplyService), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBGPPolicyApplyServices) UpdateStatus(ctx context.Context, bGPPolicyApplyService *v1.BGPPolicyApplyService, opts metav1.UpdateOptions) (*v1.BGPPolicyApplyService, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(bgppolicyapplyservicesResource, "status", bGPPolicyApplyService), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} + +// Delete takes name of the bGPPolicyApplyService and deletes it. Returns an error if one occurs. +func (c *FakeBGPPolicyApplyServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(bgppolicyapplyservicesResource, name, opts), &v1.BGPPolicyApplyService{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBGPPolicyApplyServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(bgppolicyapplyservicesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.BGPPolicyApplyServiceList{}) + return err +} + +// Patch applies the patch and returns the patched bGPPolicyApplyService. +func (c *FakeBGPPolicyApplyServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyApplyService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicyapplyservicesResource, name, pt, data, subresources...), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied bGPPolicyApplyService. +func (c *FakeBGPPolicyApplyServices) Apply(ctx context.Context, bGPPolicyApplyService *bgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyApplyService, err error) { + if bGPPolicyApplyService == nil { + return nil, fmt.Errorf("bGPPolicyApplyService provided to Apply must not be nil") + } + data, err := json.Marshal(bGPPolicyApplyService) + if err != nil { + return nil, err + } + name := bGPPolicyApplyService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyApplyService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicyapplyservicesResource, *name, types.ApplyPatchType, data), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeBGPPolicyApplyServices) ApplyStatus(ctx context.Context, bGPPolicyApplyService *bgppolicyapplyv1.BGPPolicyApplyServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyApplyService, err error) { + if bGPPolicyApplyService == nil { + return nil, fmt.Errorf("bGPPolicyApplyService provided to Apply must not be nil") + } + data, err := json.Marshal(bGPPolicyApplyService) + if err != nil { + return nil, err + } + name := bGPPolicyApplyService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyApplyService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicyapplyservicesResource, *name, types.ApplyPatchType, data, "status"), &v1.BGPPolicyApplyService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyApplyService), err +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/generated_expansion.go new file mode 100644 index 0000000..79ef34b --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicyapply/v1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type BGPPolicyApplyServiceExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsets_client.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsets_client.go new file mode 100644 index 0000000..047b86a --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsets_client.go @@ -0,0 +1,107 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/scheme" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + rest "k8s.io/client-go/rest" +) + +type BgppolicydefinedsetsV1Interface interface { + RESTClient() rest.Interface + BGPPolicyDefinedSetsServicesGetter +} + +// BgppolicydefinedsetsV1Client is used to interact with features provided by the bgppolicydefinedsets.loxilb.io group. +type BgppolicydefinedsetsV1Client struct { + restClient rest.Interface +} + +func (c *BgppolicydefinedsetsV1Client) BGPPolicyDefinedSetsServices() BGPPolicyDefinedSetsServiceInterface { + return newBGPPolicyDefinedSetsServices(c) +} + +// NewForConfig creates a new BgppolicydefinedsetsV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BgppolicydefinedsetsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BgppolicydefinedsetsV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BgppolicydefinedsetsV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BgppolicydefinedsetsV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BgppolicydefinedsetsV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BgppolicydefinedsetsV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BgppolicydefinedsetsV1Client for the given RESTClient. +func New(c rest.Interface) *BgppolicydefinedsetsV1Client { + return &BgppolicydefinedsetsV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BgppolicydefinedsetsV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go new file mode 100644 index 0000000..168f61e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go @@ -0,0 +1,243 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicydefinedsets/v1" + scheme "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/scheme" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BGPPolicyDefinedSetsServicesGetter has a method to return a BGPPolicyDefinedSetsServiceInterface. +// A group's client should implement this interface. +type BGPPolicyDefinedSetsServicesGetter interface { + BGPPolicyDefinedSetsServices() BGPPolicyDefinedSetsServiceInterface +} + +// BGPPolicyDefinedSetsServiceInterface has methods to work with BGPPolicyDefinedSetsService resources. +type BGPPolicyDefinedSetsServiceInterface interface { + Create(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.CreateOptions) (*v1.BGPPolicyDefinedSetsService, error) + Update(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.UpdateOptions) (*v1.BGPPolicyDefinedSetsService, error) + UpdateStatus(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.UpdateOptions) (*v1.BGPPolicyDefinedSetsService, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.BGPPolicyDefinedSetsService, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.BGPPolicyDefinedSetsServiceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyDefinedSetsService, err error) + Apply(ctx context.Context, bGPPolicyDefinedSetsService *bgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinedSetsService, err error) + ApplyStatus(ctx context.Context, bGPPolicyDefinedSetsService *bgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinedSetsService, err error) + BGPPolicyDefinedSetsServiceExpansion +} + +// bGPPolicyDefinedSetsServices implements BGPPolicyDefinedSetsServiceInterface +type bGPPolicyDefinedSetsServices struct { + client rest.Interface +} + +// newBGPPolicyDefinedSetsServices returns a BGPPolicyDefinedSetsServices +func newBGPPolicyDefinedSetsServices(c *BgppolicydefinedsetsV1Client) *bGPPolicyDefinedSetsServices { + return &bGPPolicyDefinedSetsServices{ + client: c.RESTClient(), + } +} + +// Get takes name of the bGPPolicyDefinedSetsService, and returns the corresponding bGPPolicyDefinedSetsService object, and an error if there is any. +func (c *bGPPolicyDefinedSetsServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Get(). + Resource("bgppolicydefinedsetsservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BGPPolicyDefinedSetsServices that match those selectors. +func (c *bGPPolicyDefinedSetsServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BGPPolicyDefinedSetsServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.BGPPolicyDefinedSetsServiceList{} + err = c.client.Get(). + Resource("bgppolicydefinedsetsservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested bGPPolicyDefinedSetsServices. +func (c *bGPPolicyDefinedSetsServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("bgppolicydefinedsetsservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a bGPPolicyDefinedSetsService and creates it. Returns the server's representation of the bGPPolicyDefinedSetsService, and an error, if there is any. +func (c *bGPPolicyDefinedSetsServices) Create(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.CreateOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Post(). + Resource("bgppolicydefinedsetsservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyDefinedSetsService). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a bGPPolicyDefinedSetsService and updates it. Returns the server's representation of the bGPPolicyDefinedSetsService, and an error, if there is any. +func (c *bGPPolicyDefinedSetsServices) Update(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.UpdateOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Put(). + Resource("bgppolicydefinedsetsservices"). + Name(bGPPolicyDefinedSetsService.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyDefinedSetsService). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *bGPPolicyDefinedSetsServices) UpdateStatus(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.UpdateOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Put(). + Resource("bgppolicydefinedsetsservices"). + Name(bGPPolicyDefinedSetsService.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyDefinedSetsService). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the bGPPolicyDefinedSetsService and deletes it. Returns an error if one occurs. +func (c *bGPPolicyDefinedSetsServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("bgppolicydefinedsetsservices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *bGPPolicyDefinedSetsServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("bgppolicydefinedsetsservices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched bGPPolicyDefinedSetsService. +func (c *bGPPolicyDefinedSetsServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyDefinedSetsService, err error) { + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Patch(pt). + Resource("bgppolicydefinedsetsservices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied bGPPolicyDefinedSetsService. +func (c *bGPPolicyDefinedSetsServices) Apply(ctx context.Context, bGPPolicyDefinedSetsService *bgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + if bGPPolicyDefinedSetsService == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(bGPPolicyDefinedSetsService) + if err != nil { + return nil, err + } + name := bGPPolicyDefinedSetsService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService.Name must be provided to Apply") + } + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("bgppolicydefinedsetsservices"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *bGPPolicyDefinedSetsServices) ApplyStatus(ctx context.Context, bGPPolicyDefinedSetsService *bgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + if bGPPolicyDefinedSetsService == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(bGPPolicyDefinedSetsService) + if err != nil { + return nil, err + } + + name := bGPPolicyDefinedSetsService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService.Name must be provided to Apply") + } + + result = &v1.BGPPolicyDefinedSetsService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("bgppolicydefinedsetsservices"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/doc.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/doc.go new file mode 100644 index 0000000..3af5d05 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/doc.go new file mode 100644 index 0000000..16f4439 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsets_client.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsets_client.go new file mode 100644 index 0000000..2687424 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsets_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeBgppolicydefinedsetsV1 struct { + *testing.Fake +} + +func (c *FakeBgppolicydefinedsetsV1) BGPPolicyDefinedSetsServices() v1.BGPPolicyDefinedSetsServiceInterface { + return &FakeBGPPolicyDefinedSetsServices{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBgppolicydefinedsetsV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsetsservice.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsetsservice.go new file mode 100644 index 0000000..acd2145 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/fake/fake_bgppolicydefinedsetsservice.go @@ -0,0 +1,178 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicydefinedsets/v1" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBGPPolicyDefinedSetsServices implements BGPPolicyDefinedSetsServiceInterface +type FakeBGPPolicyDefinedSetsServices struct { + Fake *FakeBgppolicydefinedsetsV1 +} + +var bgppolicydefinedsetsservicesResource = v1.SchemeGroupVersion.WithResource("bgppolicydefinedsetsservices") + +var bgppolicydefinedsetsservicesKind = v1.SchemeGroupVersion.WithKind("BGPPolicyDefinedSetsService") + +// Get takes name of the bGPPolicyDefinedSetsService, and returns the corresponding bGPPolicyDefinedSetsService object, and an error if there is any. +func (c *FakeBGPPolicyDefinedSetsServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(bgppolicydefinedsetsservicesResource, name), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} + +// List takes label and field selectors, and returns the list of BGPPolicyDefinedSetsServices that match those selectors. +func (c *FakeBGPPolicyDefinedSetsServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BGPPolicyDefinedSetsServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(bgppolicydefinedsetsservicesResource, bgppolicydefinedsetsservicesKind, opts), &v1.BGPPolicyDefinedSetsServiceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.BGPPolicyDefinedSetsServiceList{ListMeta: obj.(*v1.BGPPolicyDefinedSetsServiceList).ListMeta} + for _, item := range obj.(*v1.BGPPolicyDefinedSetsServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested bGPPolicyDefinedSetsServices. +func (c *FakeBGPPolicyDefinedSetsServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(bgppolicydefinedsetsservicesResource, opts)) +} + +// Create takes the representation of a bGPPolicyDefinedSetsService and creates it. Returns the server's representation of the bGPPolicyDefinedSetsService, and an error, if there is any. +func (c *FakeBGPPolicyDefinedSetsServices) Create(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.CreateOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(bgppolicydefinedsetsservicesResource, bGPPolicyDefinedSetsService), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} + +// Update takes the representation of a bGPPolicyDefinedSetsService and updates it. Returns the server's representation of the bGPPolicyDefinedSetsService, and an error, if there is any. +func (c *FakeBGPPolicyDefinedSetsServices) Update(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.UpdateOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(bgppolicydefinedsetsservicesResource, bGPPolicyDefinedSetsService), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBGPPolicyDefinedSetsServices) UpdateStatus(ctx context.Context, bGPPolicyDefinedSetsService *v1.BGPPolicyDefinedSetsService, opts metav1.UpdateOptions) (*v1.BGPPolicyDefinedSetsService, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(bgppolicydefinedsetsservicesResource, "status", bGPPolicyDefinedSetsService), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} + +// Delete takes name of the bGPPolicyDefinedSetsService and deletes it. Returns an error if one occurs. +func (c *FakeBGPPolicyDefinedSetsServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(bgppolicydefinedsetsservicesResource, name, opts), &v1.BGPPolicyDefinedSetsService{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBGPPolicyDefinedSetsServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(bgppolicydefinedsetsservicesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.BGPPolicyDefinedSetsServiceList{}) + return err +} + +// Patch applies the patch and returns the patched bGPPolicyDefinedSetsService. +func (c *FakeBGPPolicyDefinedSetsServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyDefinedSetsService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicydefinedsetsservicesResource, name, pt, data, subresources...), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied bGPPolicyDefinedSetsService. +func (c *FakeBGPPolicyDefinedSetsServices) Apply(ctx context.Context, bGPPolicyDefinedSetsService *bgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + if bGPPolicyDefinedSetsService == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService provided to Apply must not be nil") + } + data, err := json.Marshal(bGPPolicyDefinedSetsService) + if err != nil { + return nil, err + } + name := bGPPolicyDefinedSetsService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicydefinedsetsservicesResource, *name, types.ApplyPatchType, data), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeBGPPolicyDefinedSetsServices) ApplyStatus(ctx context.Context, bGPPolicyDefinedSetsService *bgppolicydefinedsetsv1.BGPPolicyDefinedSetsServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinedSetsService, err error) { + if bGPPolicyDefinedSetsService == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService provided to Apply must not be nil") + } + data, err := json.Marshal(bGPPolicyDefinedSetsService) + if err != nil { + return nil, err + } + name := bGPPolicyDefinedSetsService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinedSetsService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicydefinedsetsservicesResource, *name, types.ApplyPatchType, data, "status"), &v1.BGPPolicyDefinedSetsService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinedSetsService), err +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/generated_expansion.go new file mode 100644 index 0000000..03eeb6c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinedsets/v1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type BGPPolicyDefinedSetsServiceExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinition_client.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinition_client.go new file mode 100644 index 0000000..ae17588 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinition_client.go @@ -0,0 +1,107 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "net/http" + + "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/scheme" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + rest "k8s.io/client-go/rest" +) + +type BgppolicydefinitionV1Interface interface { + RESTClient() rest.Interface + BGPPolicyDefinitionServicesGetter +} + +// BgppolicydefinitionV1Client is used to interact with features provided by the bgppolicydefinition.loxilb.io group. +type BgppolicydefinitionV1Client struct { + restClient rest.Interface +} + +func (c *BgppolicydefinitionV1Client) BGPPolicyDefinitionServices() BGPPolicyDefinitionServiceInterface { + return newBGPPolicyDefinitionServices(c) +} + +// NewForConfig creates a new BgppolicydefinitionV1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*BgppolicydefinitionV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new BgppolicydefinitionV1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*BgppolicydefinitionV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &BgppolicydefinitionV1Client{client}, nil +} + +// NewForConfigOrDie creates a new BgppolicydefinitionV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *BgppolicydefinitionV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new BgppolicydefinitionV1Client for the given RESTClient. +func New(c rest.Interface) *BgppolicydefinitionV1Client { + return &BgppolicydefinitionV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *BgppolicydefinitionV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinitionservice.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinitionservice.go new file mode 100644 index 0000000..4f9f839 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/bgppolicydefinitionservice.go @@ -0,0 +1,243 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + json "encoding/json" + "fmt" + "time" + + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicydefinition/v1" + scheme "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/scheme" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// BGPPolicyDefinitionServicesGetter has a method to return a BGPPolicyDefinitionServiceInterface. +// A group's client should implement this interface. +type BGPPolicyDefinitionServicesGetter interface { + BGPPolicyDefinitionServices() BGPPolicyDefinitionServiceInterface +} + +// BGPPolicyDefinitionServiceInterface has methods to work with BGPPolicyDefinitionService resources. +type BGPPolicyDefinitionServiceInterface interface { + Create(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.CreateOptions) (*v1.BGPPolicyDefinitionService, error) + Update(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.UpdateOptions) (*v1.BGPPolicyDefinitionService, error) + UpdateStatus(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.UpdateOptions) (*v1.BGPPolicyDefinitionService, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.BGPPolicyDefinitionService, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.BGPPolicyDefinitionServiceList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyDefinitionService, err error) + Apply(ctx context.Context, bGPPolicyDefinitionService *bgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinitionService, err error) + ApplyStatus(ctx context.Context, bGPPolicyDefinitionService *bgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinitionService, err error) + BGPPolicyDefinitionServiceExpansion +} + +// bGPPolicyDefinitionServices implements BGPPolicyDefinitionServiceInterface +type bGPPolicyDefinitionServices struct { + client rest.Interface +} + +// newBGPPolicyDefinitionServices returns a BGPPolicyDefinitionServices +func newBGPPolicyDefinitionServices(c *BgppolicydefinitionV1Client) *bGPPolicyDefinitionServices { + return &bGPPolicyDefinitionServices{ + client: c.RESTClient(), + } +} + +// Get takes name of the bGPPolicyDefinitionService, and returns the corresponding bGPPolicyDefinitionService object, and an error if there is any. +func (c *bGPPolicyDefinitionServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BGPPolicyDefinitionService, err error) { + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Get(). + Resource("bgppolicydefinitionservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of BGPPolicyDefinitionServices that match those selectors. +func (c *bGPPolicyDefinitionServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BGPPolicyDefinitionServiceList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.BGPPolicyDefinitionServiceList{} + err = c.client.Get(). + Resource("bgppolicydefinitionservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested bGPPolicyDefinitionServices. +func (c *bGPPolicyDefinitionServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Resource("bgppolicydefinitionservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a bGPPolicyDefinitionService and creates it. Returns the server's representation of the bGPPolicyDefinitionService, and an error, if there is any. +func (c *bGPPolicyDefinitionServices) Create(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.CreateOptions) (result *v1.BGPPolicyDefinitionService, err error) { + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Post(). + Resource("bgppolicydefinitionservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyDefinitionService). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a bGPPolicyDefinitionService and updates it. Returns the server's representation of the bGPPolicyDefinitionService, and an error, if there is any. +func (c *bGPPolicyDefinitionServices) Update(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.UpdateOptions) (result *v1.BGPPolicyDefinitionService, err error) { + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Put(). + Resource("bgppolicydefinitionservices"). + Name(bGPPolicyDefinitionService.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyDefinitionService). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *bGPPolicyDefinitionServices) UpdateStatus(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.UpdateOptions) (result *v1.BGPPolicyDefinitionService, err error) { + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Put(). + Resource("bgppolicydefinitionservices"). + Name(bGPPolicyDefinitionService.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(bGPPolicyDefinitionService). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the bGPPolicyDefinitionService and deletes it. Returns an error if one occurs. +func (c *bGPPolicyDefinitionServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Resource("bgppolicydefinitionservices"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *bGPPolicyDefinitionServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("bgppolicydefinitionservices"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched bGPPolicyDefinitionService. +func (c *bGPPolicyDefinitionServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyDefinitionService, err error) { + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Patch(pt). + Resource("bgppolicydefinitionservices"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied bGPPolicyDefinitionService. +func (c *bGPPolicyDefinitionServices) Apply(ctx context.Context, bGPPolicyDefinitionService *bgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinitionService, err error) { + if bGPPolicyDefinitionService == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(bGPPolicyDefinitionService) + if err != nil { + return nil, err + } + name := bGPPolicyDefinitionService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService.Name must be provided to Apply") + } + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("bgppolicydefinitionservices"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *bGPPolicyDefinitionServices) ApplyStatus(ctx context.Context, bGPPolicyDefinitionService *bgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinitionService, err error) { + if bGPPolicyDefinitionService == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(bGPPolicyDefinitionService) + if err != nil { + return nil, err + } + + name := bGPPolicyDefinitionService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService.Name must be provided to Apply") + } + + result = &v1.BGPPolicyDefinitionService{} + err = c.client.Patch(types.ApplyPatchType). + Resource("bgppolicydefinitionservices"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/doc.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/doc.go new file mode 100644 index 0000000..3af5d05 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1 diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/doc.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/doc.go new file mode 100644 index 0000000..16f4439 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// Package fake has the automatically generated clients. +package fake diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinition_client.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinition_client.go new file mode 100644 index 0000000..5ca7a86 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinition_client.go @@ -0,0 +1,40 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeBgppolicydefinitionV1 struct { + *testing.Fake +} + +func (c *FakeBgppolicydefinitionV1) BGPPolicyDefinitionServices() v1.BGPPolicyDefinitionServiceInterface { + return &FakeBGPPolicyDefinitionServices{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeBgppolicydefinitionV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinitionservice.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinitionservice.go new file mode 100644 index 0000000..4afab3d --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/fake/fake_bgppolicydefinitionservice.go @@ -0,0 +1,178 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + json "encoding/json" + "fmt" + + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/client/applyconfiguration/bgppolicydefinition/v1" + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeBGPPolicyDefinitionServices implements BGPPolicyDefinitionServiceInterface +type FakeBGPPolicyDefinitionServices struct { + Fake *FakeBgppolicydefinitionV1 +} + +var bgppolicydefinitionservicesResource = v1.SchemeGroupVersion.WithResource("bgppolicydefinitionservices") + +var bgppolicydefinitionservicesKind = v1.SchemeGroupVersion.WithKind("BGPPolicyDefinitionService") + +// Get takes name of the bGPPolicyDefinitionService, and returns the corresponding bGPPolicyDefinitionService object, and an error if there is any. +func (c *FakeBGPPolicyDefinitionServices) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.BGPPolicyDefinitionService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(bgppolicydefinitionservicesResource, name), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} + +// List takes label and field selectors, and returns the list of BGPPolicyDefinitionServices that match those selectors. +func (c *FakeBGPPolicyDefinitionServices) List(ctx context.Context, opts metav1.ListOptions) (result *v1.BGPPolicyDefinitionServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(bgppolicydefinitionservicesResource, bgppolicydefinitionservicesKind, opts), &v1.BGPPolicyDefinitionServiceList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1.BGPPolicyDefinitionServiceList{ListMeta: obj.(*v1.BGPPolicyDefinitionServiceList).ListMeta} + for _, item := range obj.(*v1.BGPPolicyDefinitionServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested bGPPolicyDefinitionServices. +func (c *FakeBGPPolicyDefinitionServices) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(bgppolicydefinitionservicesResource, opts)) +} + +// Create takes the representation of a bGPPolicyDefinitionService and creates it. Returns the server's representation of the bGPPolicyDefinitionService, and an error, if there is any. +func (c *FakeBGPPolicyDefinitionServices) Create(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.CreateOptions) (result *v1.BGPPolicyDefinitionService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(bgppolicydefinitionservicesResource, bGPPolicyDefinitionService), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} + +// Update takes the representation of a bGPPolicyDefinitionService and updates it. Returns the server's representation of the bGPPolicyDefinitionService, and an error, if there is any. +func (c *FakeBGPPolicyDefinitionServices) Update(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.UpdateOptions) (result *v1.BGPPolicyDefinitionService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(bgppolicydefinitionservicesResource, bGPPolicyDefinitionService), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeBGPPolicyDefinitionServices) UpdateStatus(ctx context.Context, bGPPolicyDefinitionService *v1.BGPPolicyDefinitionService, opts metav1.UpdateOptions) (*v1.BGPPolicyDefinitionService, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(bgppolicydefinitionservicesResource, "status", bGPPolicyDefinitionService), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} + +// Delete takes name of the bGPPolicyDefinitionService and deletes it. Returns an error if one occurs. +func (c *FakeBGPPolicyDefinitionServices) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(bgppolicydefinitionservicesResource, name, opts), &v1.BGPPolicyDefinitionService{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeBGPPolicyDefinitionServices) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(bgppolicydefinitionservicesResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1.BGPPolicyDefinitionServiceList{}) + return err +} + +// Patch applies the patch and returns the patched bGPPolicyDefinitionService. +func (c *FakeBGPPolicyDefinitionServices) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.BGPPolicyDefinitionService, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicydefinitionservicesResource, name, pt, data, subresources...), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied bGPPolicyDefinitionService. +func (c *FakeBGPPolicyDefinitionServices) Apply(ctx context.Context, bGPPolicyDefinitionService *bgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinitionService, err error) { + if bGPPolicyDefinitionService == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService provided to Apply must not be nil") + } + data, err := json.Marshal(bGPPolicyDefinitionService) + if err != nil { + return nil, err + } + name := bGPPolicyDefinitionService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicydefinitionservicesResource, *name, types.ApplyPatchType, data), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeBGPPolicyDefinitionServices) ApplyStatus(ctx context.Context, bGPPolicyDefinitionService *bgppolicydefinitionv1.BGPPolicyDefinitionServiceApplyConfiguration, opts metav1.ApplyOptions) (result *v1.BGPPolicyDefinitionService, err error) { + if bGPPolicyDefinitionService == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService provided to Apply must not be nil") + } + data, err := json.Marshal(bGPPolicyDefinitionService) + if err != nil { + return nil, err + } + name := bGPPolicyDefinitionService.Name + if name == nil { + return nil, fmt.Errorf("bGPPolicyDefinitionService.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(bgppolicydefinitionservicesResource, *name, types.ApplyPatchType, data, "status"), &v1.BGPPolicyDefinitionService{}) + if obj == nil { + return nil, err + } + return obj.(*v1.BGPPolicyDefinitionService), err +} diff --git a/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/generated_expansion.go new file mode 100644 index 0000000..86e59d7 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/bgppolicydefinition/v1/generated_expansion.go @@ -0,0 +1,21 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +type BGPPolicyDefinitionServiceExpansion interface{} diff --git a/pkg/client/informers/externalversions/bgppolicyapply/interface.go b/pkg/client/informers/externalversions/bgppolicyapply/interface.go new file mode 100644 index 0000000..88842c4 --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicyapply/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package bgppolicyapply + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicyapply/v1" + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/bgppolicyapply/v1/bgppolicyapplyservice.go b/pkg/client/informers/externalversions/bgppolicyapply/v1/bgppolicyapplyservice.go new file mode 100644 index 0000000..ecf1b3c --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicyapply/v1/bgppolicyapplyservice.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + versioned "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/listers/bgppolicyapply/v1" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// BGPPolicyApplyServiceInformer provides access to a shared informer and lister for +// BGPPolicyApplyServices. +type BGPPolicyApplyServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.BGPPolicyApplyServiceLister +} + +type bGPPolicyApplyServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewBGPPolicyApplyServiceInformer constructs a new informer for BGPPolicyApplyService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBGPPolicyApplyServiceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBGPPolicyApplyServiceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredBGPPolicyApplyServiceInformer constructs a new informer for BGPPolicyApplyService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredBGPPolicyApplyServiceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BgppolicyapplyV1().BGPPolicyApplyServices().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BgppolicyapplyV1().BGPPolicyApplyServices().Watch(context.TODO(), options) + }, + }, + &bgppolicyapplyv1.BGPPolicyApplyService{}, + resyncPeriod, + indexers, + ) +} + +func (f *bGPPolicyApplyServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBGPPolicyApplyServiceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *bGPPolicyApplyServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&bgppolicyapplyv1.BGPPolicyApplyService{}, f.defaultInformer) +} + +func (f *bGPPolicyApplyServiceInformer) Lister() v1.BGPPolicyApplyServiceLister { + return v1.NewBGPPolicyApplyServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/bgppolicyapply/v1/interface.go b/pkg/client/informers/externalversions/bgppolicyapply/v1/interface.go new file mode 100644 index 0000000..e3301e4 --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicyapply/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // BGPPolicyApplyServices returns a BGPPolicyApplyServiceInformer. + BGPPolicyApplyServices() BGPPolicyApplyServiceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// BGPPolicyApplyServices returns a BGPPolicyApplyServiceInformer. +func (v *version) BGPPolicyApplyServices() BGPPolicyApplyServiceInformer { + return &bGPPolicyApplyServiceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/bgppolicydefinedsets/interface.go b/pkg/client/informers/externalversions/bgppolicydefinedsets/interface.go new file mode 100644 index 0000000..ebbb509 --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicydefinedsets/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package bgppolicydefinedsets + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicydefinedsets/v1" + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go b/pkg/client/informers/externalversions/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go new file mode 100644 index 0000000..e7cd798 --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + versioned "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/listers/bgppolicydefinedsets/v1" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// BGPPolicyDefinedSetsServiceInformer provides access to a shared informer and lister for +// BGPPolicyDefinedSetsServices. +type BGPPolicyDefinedSetsServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.BGPPolicyDefinedSetsServiceLister +} + +type bGPPolicyDefinedSetsServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewBGPPolicyDefinedSetsServiceInformer constructs a new informer for BGPPolicyDefinedSetsService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBGPPolicyDefinedSetsServiceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBGPPolicyDefinedSetsServiceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredBGPPolicyDefinedSetsServiceInformer constructs a new informer for BGPPolicyDefinedSetsService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredBGPPolicyDefinedSetsServiceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BgppolicydefinedsetsV1().BGPPolicyDefinedSetsServices().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BgppolicydefinedsetsV1().BGPPolicyDefinedSetsServices().Watch(context.TODO(), options) + }, + }, + &bgppolicydefinedsetsv1.BGPPolicyDefinedSetsService{}, + resyncPeriod, + indexers, + ) +} + +func (f *bGPPolicyDefinedSetsServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBGPPolicyDefinedSetsServiceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *bGPPolicyDefinedSetsServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&bgppolicydefinedsetsv1.BGPPolicyDefinedSetsService{}, f.defaultInformer) +} + +func (f *bGPPolicyDefinedSetsServiceInformer) Lister() v1.BGPPolicyDefinedSetsServiceLister { + return v1.NewBGPPolicyDefinedSetsServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/bgppolicydefinedsets/v1/interface.go b/pkg/client/informers/externalversions/bgppolicydefinedsets/v1/interface.go new file mode 100644 index 0000000..471ffb5 --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicydefinedsets/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // BGPPolicyDefinedSetsServices returns a BGPPolicyDefinedSetsServiceInformer. + BGPPolicyDefinedSetsServices() BGPPolicyDefinedSetsServiceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// BGPPolicyDefinedSetsServices returns a BGPPolicyDefinedSetsServiceInformer. +func (v *version) BGPPolicyDefinedSetsServices() BGPPolicyDefinedSetsServiceInformer { + return &bGPPolicyDefinedSetsServiceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/bgppolicydefinition/interface.go b/pkg/client/informers/externalversions/bgppolicydefinition/interface.go new file mode 100644 index 0000000..e81a721 --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicydefinition/interface.go @@ -0,0 +1,46 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package bgppolicydefinition + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicydefinition/v1" + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface +} + +type group struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/bgppolicydefinition/v1/bgppolicydefinitionservice.go b/pkg/client/informers/externalversions/bgppolicydefinition/v1/bgppolicydefinitionservice.go new file mode 100644 index 0000000..804466e --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicydefinition/v1/bgppolicydefinitionservice.go @@ -0,0 +1,89 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + versioned "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/loxilb-io/kube-loxilb/pkg/client/listers/bgppolicydefinition/v1" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// BGPPolicyDefinitionServiceInformer provides access to a shared informer and lister for +// BGPPolicyDefinitionServices. +type BGPPolicyDefinitionServiceInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.BGPPolicyDefinitionServiceLister +} + +type bGPPolicyDefinitionServiceInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewBGPPolicyDefinitionServiceInformer constructs a new informer for BGPPolicyDefinitionService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewBGPPolicyDefinitionServiceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredBGPPolicyDefinitionServiceInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredBGPPolicyDefinitionServiceInformer constructs a new informer for BGPPolicyDefinitionService type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredBGPPolicyDefinitionServiceInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BgppolicydefinitionV1().BGPPolicyDefinitionServices().List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.BgppolicydefinitionV1().BGPPolicyDefinitionServices().Watch(context.TODO(), options) + }, + }, + &bgppolicydefinitionv1.BGPPolicyDefinitionService{}, + resyncPeriod, + indexers, + ) +} + +func (f *bGPPolicyDefinitionServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredBGPPolicyDefinitionServiceInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *bGPPolicyDefinitionServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&bgppolicydefinitionv1.BGPPolicyDefinitionService{}, f.defaultInformer) +} + +func (f *bGPPolicyDefinitionServiceInformer) Lister() v1.BGPPolicyDefinitionServiceLister { + return v1.NewBGPPolicyDefinitionServiceLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/bgppolicydefinition/v1/interface.go b/pkg/client/informers/externalversions/bgppolicydefinition/v1/interface.go new file mode 100644 index 0000000..962361f --- /dev/null +++ b/pkg/client/informers/externalversions/bgppolicydefinition/v1/interface.go @@ -0,0 +1,45 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // BGPPolicyDefinitionServices returns a BGPPolicyDefinitionServiceInformer. + BGPPolicyDefinitionServices() BGPPolicyDefinitionServiceInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// BGPPolicyDefinitionServices returns a BGPPolicyDefinitionServiceInformer. +func (v *version) BGPPolicyDefinitionServices() BGPPolicyDefinitionServiceInformer { + return &bGPPolicyDefinitionServiceInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index cb786f3..df88097 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -25,6 +25,9 @@ import ( versioned "github.com/loxilb-io/kube-loxilb/pkg/client/clientset/versioned" bgppeer "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppeer" + bgppolicyapply "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicyapply" + bgppolicydefinedsets "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicydefinedsets" + bgppolicydefinition "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/bgppolicydefinition" internalinterfaces "github.com/loxilb-io/kube-loxilb/pkg/client/informers/externalversions/internalinterfaces" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -254,8 +257,23 @@ type SharedInformerFactory interface { InformerFor(obj runtime.Object, newFunc internalinterfaces.NewInformerFunc) cache.SharedIndexInformer Bgppeer() bgppeer.Interface + Bgppolicyapply() bgppolicyapply.Interface + Bgppolicydefinedsets() bgppolicydefinedsets.Interface + Bgppolicydefinition() bgppolicydefinition.Interface } func (f *sharedInformerFactory) Bgppeer() bgppeer.Interface { return bgppeer.New(f, f.namespace, f.tweakListOptions) } + +func (f *sharedInformerFactory) Bgppolicyapply() bgppolicyapply.Interface { + return bgppolicyapply.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Bgppolicydefinedsets() bgppolicydefinedsets.Interface { + return bgppolicydefinedsets.New(f, f.namespace, f.tweakListOptions) +} + +func (f *sharedInformerFactory) Bgppolicydefinition() bgppolicydefinition.Interface { + return bgppolicydefinition.New(f, f.namespace, f.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 23dc919..14c5130 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,6 +22,9 @@ import ( "fmt" v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppeer/v1" + bgppolicyapplyv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + bgppolicydefinedsetsv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + bgppolicydefinitionv1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" ) @@ -56,6 +59,18 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource case v1.SchemeGroupVersion.WithResource("bgppeerservices"): return &genericInformer{resource: resource.GroupResource(), informer: f.Bgppeer().V1().BGPPeerServices().Informer()}, nil + // Group=bgppolicyapply.loxilb.io, Version=v1 + case bgppolicyapplyv1.SchemeGroupVersion.WithResource("bgppolicyapplyservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Bgppolicyapply().V1().BGPPolicyApplyServices().Informer()}, nil + + // Group=bgppolicydefinedsets.loxilb.io, Version=v1 + case bgppolicydefinedsetsv1.SchemeGroupVersion.WithResource("bgppolicydefinedsetsservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Bgppolicydefinedsets().V1().BGPPolicyDefinedSetsServices().Informer()}, nil + + // Group=bgppolicydefinition.loxilb.io, Version=v1 + case bgppolicydefinitionv1.SchemeGroupVersion.WithResource("bgppolicydefinitionservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Bgppolicydefinition().V1().BGPPolicyDefinitionServices().Informer()}, nil + } return nil, fmt.Errorf("no informer found for %v", resource) diff --git a/pkg/client/listers/bgppolicyapply/v1/bgppolicyapplyservice.go b/pkg/client/listers/bgppolicyapply/v1/bgppolicyapplyservice.go new file mode 100644 index 0000000..5b6fc9b --- /dev/null +++ b/pkg/client/listers/bgppolicyapply/v1/bgppolicyapplyservice.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicyapply/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BGPPolicyApplyServiceLister helps list BGPPolicyApplyServices. +// All objects returned here must be treated as read-only. +type BGPPolicyApplyServiceLister interface { + // List lists all BGPPolicyApplyServices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.BGPPolicyApplyService, err error) + // Get retrieves the BGPPolicyApplyService from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.BGPPolicyApplyService, error) + BGPPolicyApplyServiceListerExpansion +} + +// bGPPolicyApplyServiceLister implements the BGPPolicyApplyServiceLister interface. +type bGPPolicyApplyServiceLister struct { + indexer cache.Indexer +} + +// NewBGPPolicyApplyServiceLister returns a new BGPPolicyApplyServiceLister. +func NewBGPPolicyApplyServiceLister(indexer cache.Indexer) BGPPolicyApplyServiceLister { + return &bGPPolicyApplyServiceLister{indexer: indexer} +} + +// List lists all BGPPolicyApplyServices in the indexer. +func (s *bGPPolicyApplyServiceLister) List(selector labels.Selector) (ret []*v1.BGPPolicyApplyService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BGPPolicyApplyService)) + }) + return ret, err +} + +// Get retrieves the BGPPolicyApplyService from the index for a given name. +func (s *bGPPolicyApplyServiceLister) Get(name string) (*v1.BGPPolicyApplyService, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("bgppolicyapplyservice"), name) + } + return obj.(*v1.BGPPolicyApplyService), nil +} diff --git a/pkg/client/listers/bgppolicyapply/v1/expansion_generated.go b/pkg/client/listers/bgppolicyapply/v1/expansion_generated.go new file mode 100644 index 0000000..70323fc --- /dev/null +++ b/pkg/client/listers/bgppolicyapply/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// BGPPolicyApplyServiceListerExpansion allows custom methods to be added to +// BGPPolicyApplyServiceLister. +type BGPPolicyApplyServiceListerExpansion interface{} diff --git a/pkg/client/listers/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go b/pkg/client/listers/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go new file mode 100644 index 0000000..bad8c76 --- /dev/null +++ b/pkg/client/listers/bgppolicydefinedsets/v1/bgppolicydefinedsetsservice.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinedsets/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BGPPolicyDefinedSetsServiceLister helps list BGPPolicyDefinedSetsServices. +// All objects returned here must be treated as read-only. +type BGPPolicyDefinedSetsServiceLister interface { + // List lists all BGPPolicyDefinedSetsServices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.BGPPolicyDefinedSetsService, err error) + // Get retrieves the BGPPolicyDefinedSetsService from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.BGPPolicyDefinedSetsService, error) + BGPPolicyDefinedSetsServiceListerExpansion +} + +// bGPPolicyDefinedSetsServiceLister implements the BGPPolicyDefinedSetsServiceLister interface. +type bGPPolicyDefinedSetsServiceLister struct { + indexer cache.Indexer +} + +// NewBGPPolicyDefinedSetsServiceLister returns a new BGPPolicyDefinedSetsServiceLister. +func NewBGPPolicyDefinedSetsServiceLister(indexer cache.Indexer) BGPPolicyDefinedSetsServiceLister { + return &bGPPolicyDefinedSetsServiceLister{indexer: indexer} +} + +// List lists all BGPPolicyDefinedSetsServices in the indexer. +func (s *bGPPolicyDefinedSetsServiceLister) List(selector labels.Selector) (ret []*v1.BGPPolicyDefinedSetsService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BGPPolicyDefinedSetsService)) + }) + return ret, err +} + +// Get retrieves the BGPPolicyDefinedSetsService from the index for a given name. +func (s *bGPPolicyDefinedSetsServiceLister) Get(name string) (*v1.BGPPolicyDefinedSetsService, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("bgppolicydefinedsetsservice"), name) + } + return obj.(*v1.BGPPolicyDefinedSetsService), nil +} diff --git a/pkg/client/listers/bgppolicydefinedsets/v1/expansion_generated.go b/pkg/client/listers/bgppolicydefinedsets/v1/expansion_generated.go new file mode 100644 index 0000000..4dcb714 --- /dev/null +++ b/pkg/client/listers/bgppolicydefinedsets/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// BGPPolicyDefinedSetsServiceListerExpansion allows custom methods to be added to +// BGPPolicyDefinedSetsServiceLister. +type BGPPolicyDefinedSetsServiceListerExpansion interface{} diff --git a/pkg/client/listers/bgppolicydefinition/v1/bgppolicydefinitionservice.go b/pkg/client/listers/bgppolicydefinition/v1/bgppolicydefinitionservice.go new file mode 100644 index 0000000..fadd501 --- /dev/null +++ b/pkg/client/listers/bgppolicydefinition/v1/bgppolicydefinitionservice.go @@ -0,0 +1,68 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/loxilb-io/kube-loxilb/pkg/crds/bgppolicydefinition/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// BGPPolicyDefinitionServiceLister helps list BGPPolicyDefinitionServices. +// All objects returned here must be treated as read-only. +type BGPPolicyDefinitionServiceLister interface { + // List lists all BGPPolicyDefinitionServices in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.BGPPolicyDefinitionService, err error) + // Get retrieves the BGPPolicyDefinitionService from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.BGPPolicyDefinitionService, error) + BGPPolicyDefinitionServiceListerExpansion +} + +// bGPPolicyDefinitionServiceLister implements the BGPPolicyDefinitionServiceLister interface. +type bGPPolicyDefinitionServiceLister struct { + indexer cache.Indexer +} + +// NewBGPPolicyDefinitionServiceLister returns a new BGPPolicyDefinitionServiceLister. +func NewBGPPolicyDefinitionServiceLister(indexer cache.Indexer) BGPPolicyDefinitionServiceLister { + return &bGPPolicyDefinitionServiceLister{indexer: indexer} +} + +// List lists all BGPPolicyDefinitionServices in the indexer. +func (s *bGPPolicyDefinitionServiceLister) List(selector labels.Selector) (ret []*v1.BGPPolicyDefinitionService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.BGPPolicyDefinitionService)) + }) + return ret, err +} + +// Get retrieves the BGPPolicyDefinitionService from the index for a given name. +func (s *bGPPolicyDefinitionServiceLister) Get(name string) (*v1.BGPPolicyDefinitionService, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("bgppolicydefinitionservice"), name) + } + return obj.(*v1.BGPPolicyDefinitionService), nil +} diff --git a/pkg/client/listers/bgppolicydefinition/v1/expansion_generated.go b/pkg/client/listers/bgppolicydefinition/v1/expansion_generated.go new file mode 100644 index 0000000..979171f --- /dev/null +++ b/pkg/client/listers/bgppolicydefinition/v1/expansion_generated.go @@ -0,0 +1,23 @@ +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +// BGPPolicyDefinitionServiceListerExpansion allows custom methods to be added to +// BGPPolicyDefinitionServiceLister. +type BGPPolicyDefinitionServiceListerExpansion interface{} diff --git a/pkg/crds/bgppolicyapply/v1/doc.go b/pkg/crds/bgppolicyapply/v1/doc.go new file mode 100644 index 0000000..5251360 --- /dev/null +++ b/pkg/crds/bgppolicyapply/v1/doc.go @@ -0,0 +1,4 @@ +// +k8s:deepcopy-gen=package +// +groupName=bgppolicyapply.loxilb.io + +package v1 diff --git a/pkg/crds/bgppolicyapply/v1/register.go b/pkg/crds/bgppolicyapply/v1/register.go new file mode 100644 index 0000000..5755bba --- /dev/null +++ b/pkg/crds/bgppolicyapply/v1/register.go @@ -0,0 +1,31 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const GroupName = "bgppolicyapply.loxilb.io" + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes( + SchemeGroupVersion, + &BGPPolicyApplyService{}, + &BGPPolicyApplyServiceList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/crds/bgppolicyapply/v1/types.go b/pkg/crds/bgppolicyapply/v1/types.go new file mode 100644 index 0000000..894d0f7 --- /dev/null +++ b/pkg/crds/bgppolicyapply/v1/types.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 NetLOX Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "github.com/loxilb-io/kube-loxilb/pkg/api" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type BGPPolicyApplyModel api.BGPPolicyApply + +// BGPPolicyapplyServiceStatus defines the observed state of FireWallService +type BGPPolicyApplyServiceStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BGPPolicyApplyService struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BGPPolicyApplyModel `json:"spec,omitempty"` + Status BGPPolicyApplyServiceStatus `json:"status,omitempty"` +} + +// BGPPolicyapplySpec defines the desired state of LBService +type BGPPolicyApplySpec struct { + Model BGPPolicyApplyModel `json:"bgppolicyapply"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BGPPolicyApplyServiceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []*BGPPolicyApplyService `json:"items"` +} + +func (bgpPolicyapplyModel *BGPPolicyApplyModel) GetKeyStruct() api.LoxiModel { + return bgpPolicyapplyModel +} diff --git a/pkg/crds/bgppolicyapply/v1/zz_generated.deepcopy.go b/pkg/crds/bgppolicyapply/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000..b6c8056 --- /dev/null +++ b/pkg/crds/bgppolicyapply/v1/zz_generated.deepcopy.go @@ -0,0 +1,145 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyApplyModel) DeepCopyInto(out *BGPPolicyApplyModel) { + *out = *in + if in.Policies != nil { + in, out := &in.Policies, &out.Policies + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyApplyModel. +func (in *BGPPolicyApplyModel) DeepCopy() *BGPPolicyApplyModel { + if in == nil { + return nil + } + out := new(BGPPolicyApplyModel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyApplyService) DeepCopyInto(out *BGPPolicyApplyService) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyApplyService. +func (in *BGPPolicyApplyService) DeepCopy() *BGPPolicyApplyService { + if in == nil { + return nil + } + out := new(BGPPolicyApplyService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BGPPolicyApplyService) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyApplyServiceList) DeepCopyInto(out *BGPPolicyApplyServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*BGPPolicyApplyService, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(BGPPolicyApplyService) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyApplyServiceList. +func (in *BGPPolicyApplyServiceList) DeepCopy() *BGPPolicyApplyServiceList { + if in == nil { + return nil + } + out := new(BGPPolicyApplyServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BGPPolicyApplyServiceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyApplyServiceStatus) DeepCopyInto(out *BGPPolicyApplyServiceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyApplyServiceStatus. +func (in *BGPPolicyApplyServiceStatus) DeepCopy() *BGPPolicyApplyServiceStatus { + if in == nil { + return nil + } + out := new(BGPPolicyApplyServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyApplySpec) DeepCopyInto(out *BGPPolicyApplySpec) { + *out = *in + in.Model.DeepCopyInto(&out.Model) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyApplySpec. +func (in *BGPPolicyApplySpec) DeepCopy() *BGPPolicyApplySpec { + if in == nil { + return nil + } + out := new(BGPPolicyApplySpec) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/crds/bgppolicydefinedsets/v1/doc.go b/pkg/crds/bgppolicydefinedsets/v1/doc.go new file mode 100644 index 0000000..14f3eae --- /dev/null +++ b/pkg/crds/bgppolicydefinedsets/v1/doc.go @@ -0,0 +1,4 @@ +// +k8s:deepcopy-gen=package +// +groupName=bgppolicydefinedsets.loxilb.io + +package v1 diff --git a/pkg/crds/bgppolicydefinedsets/v1/register.go b/pkg/crds/bgppolicydefinedsets/v1/register.go new file mode 100644 index 0000000..92f0905 --- /dev/null +++ b/pkg/crds/bgppolicydefinedsets/v1/register.go @@ -0,0 +1,31 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const GroupName = "bgppolicydefinedsets.loxilb.io" + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes( + SchemeGroupVersion, + &BGPPolicyDefinedSetsService{}, + &BGPPolicyDefinedSetsServiceList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/crds/bgppolicydefinedsets/v1/types.go b/pkg/crds/bgppolicydefinedsets/v1/types.go new file mode 100644 index 0000000..d2b6771 --- /dev/null +++ b/pkg/crds/bgppolicydefinedsets/v1/types.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2024 NetLOX Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "github.com/loxilb-io/kube-loxilb/pkg/api" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type BGPPolicyDefinedSetsModel api.BGPPolicyDefinedSets + +// BGPPolicyDefinedSetsServiceStatus defines the observed state of FireWallService +type BGPPolicyDefinedSetsServiceStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BGPPolicyDefinedSetsService struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BGPPolicyDefinedSetsModel `json:"spec,omitempty"` + Status BGPPolicyDefinedSetsServiceStatus `json:"status,omitempty"` +} + +// BGPPolicyDefinedSetsSpec defines the desired state of LBService +type BGPPolicyDefinedSetsSpec struct { + Model BGPPolicyDefinedSetsModel `json:"bgppolicydefinedsets"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BGPPolicyDefinedSetsServiceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []*BGPPolicyDefinedSetsService `json:"items"` +} + +func (bgpPolicyDefinedsetsModel *BGPPolicyDefinedSetsModel) GetKeyStruct() api.LoxiModel { + return bgpPolicyDefinedsetsModel +} diff --git a/pkg/crds/bgppolicydefinedsets/v1/zz_generated.deepcopy.go b/pkg/crds/bgppolicydefinedsets/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000..8ced79b --- /dev/null +++ b/pkg/crds/bgppolicydefinedsets/v1/zz_generated.deepcopy.go @@ -0,0 +1,151 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + api "github.com/loxilb-io/kube-loxilb/pkg/api" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinedSetsModel) DeepCopyInto(out *BGPPolicyDefinedSetsModel) { + *out = *in + if in.List != nil { + in, out := &in.List, &out.List + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PrefixList != nil { + in, out := &in.PrefixList, &out.PrefixList + *out = make([]api.Prefix, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinedSetsModel. +func (in *BGPPolicyDefinedSetsModel) DeepCopy() *BGPPolicyDefinedSetsModel { + if in == nil { + return nil + } + out := new(BGPPolicyDefinedSetsModel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinedSetsService) DeepCopyInto(out *BGPPolicyDefinedSetsService) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinedSetsService. +func (in *BGPPolicyDefinedSetsService) DeepCopy() *BGPPolicyDefinedSetsService { + if in == nil { + return nil + } + out := new(BGPPolicyDefinedSetsService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BGPPolicyDefinedSetsService) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinedSetsServiceList) DeepCopyInto(out *BGPPolicyDefinedSetsServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*BGPPolicyDefinedSetsService, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(BGPPolicyDefinedSetsService) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinedSetsServiceList. +func (in *BGPPolicyDefinedSetsServiceList) DeepCopy() *BGPPolicyDefinedSetsServiceList { + if in == nil { + return nil + } + out := new(BGPPolicyDefinedSetsServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BGPPolicyDefinedSetsServiceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinedSetsServiceStatus) DeepCopyInto(out *BGPPolicyDefinedSetsServiceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinedSetsServiceStatus. +func (in *BGPPolicyDefinedSetsServiceStatus) DeepCopy() *BGPPolicyDefinedSetsServiceStatus { + if in == nil { + return nil + } + out := new(BGPPolicyDefinedSetsServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinedSetsSpec) DeepCopyInto(out *BGPPolicyDefinedSetsSpec) { + *out = *in + in.Model.DeepCopyInto(&out.Model) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinedSetsSpec. +func (in *BGPPolicyDefinedSetsSpec) DeepCopy() *BGPPolicyDefinedSetsSpec { + if in == nil { + return nil + } + out := new(BGPPolicyDefinedSetsSpec) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/crds/bgppolicydefinition/v1/doc.go b/pkg/crds/bgppolicydefinition/v1/doc.go new file mode 100644 index 0000000..8adc98f --- /dev/null +++ b/pkg/crds/bgppolicydefinition/v1/doc.go @@ -0,0 +1,4 @@ +// +k8s:deepcopy-gen=package +// +groupName=bgppolicydefinition.loxilb.io + +package v1 diff --git a/pkg/crds/bgppolicydefinition/v1/register.go b/pkg/crds/bgppolicydefinition/v1/register.go new file mode 100644 index 0000000..bb486c1 --- /dev/null +++ b/pkg/crds/bgppolicydefinition/v1/register.go @@ -0,0 +1,31 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +const GroupName = "bgppolicydefinition.loxilb.io" + +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"} + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + AddToScheme = SchemeBuilder.AddToScheme +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes( + SchemeGroupVersion, + &BGPPolicyDefinitionService{}, + &BGPPolicyDefinitionServiceList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/crds/bgppolicydefinition/v1/types.go b/pkg/crds/bgppolicydefinition/v1/types.go new file mode 100644 index 0000000..6ecba99 --- /dev/null +++ b/pkg/crds/bgppolicydefinition/v1/types.go @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2024 NetLOX Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package v1 + +import ( + "github.com/loxilb-io/kube-loxilb/pkg/api" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// BGPPolicyDefinitionServiceStatus defines the observed state of FireWallService +type BGPPolicyDefinitionServiceStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BGPPolicyDefinitionService struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec BGPPolicyDefinition `json:"spec,omitempty"` + Status BGPPolicyDefinitionServiceStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type BGPPolicyDefinitionServiceList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []*BGPPolicyDefinitionService `json:"items"` +} + +func (bgpPolicyDefinitionModel *BGPPolicyDefinition) GetKeyStruct() api.LoxiModel { + return bgpPolicyDefinitionModel +} + +// BGPPolicyDefinition - Info related to a end-point config entry +type BGPPolicyDefinition struct { + Name string `json:"name"` + Statement []Statement `json:"statements"` +} + +type Statement struct { + Name string `json:"name,omitempty"` + Conditions Conditions `json:"conditions,omitempty"` + Actions Actions `json:"actions,omitempty"` +} + +type Actions struct { + RouteDisposition string `json:"routeDisposition"` + BGPActions BGPActions `json:"bgpActions,omitempty"` +} + +type BGPActions struct { + SetMed string `json:"setMed,omitempty"` + SetCommunity SetCommunity `json:"setCommunity,omitempty"` + SetExtCommunity SetCommunity `json:"setExtCommunity,omitempty"` + SetLargeCommunity SetCommunity `json:"setLargeCommunity,omitempty"` + SetNextHop string `json:"setNextHop,omitempty"` + SetLocalPerf int `json:"setLocalPerf,omitempty"` + SetAsPathPrepend SetAsPathPrepend `json:"setAsPathPrepend,omitempty"` +} + +type SetCommunity struct { + Options string `json:"options,omitempty"` + SetCommunityMethod []string `json:"setCommunityMethod,omitempty"` +} + +type SetAsPathPrepend struct { + ASN string `json:"as,omitempty"` + RepeatN int `json:"repeatN,omitempty"` +} + +type Conditions struct { + PrefixSet MatchPrefixSet `json:"matchPrefixSet,omitempty"` + NeighborSet MatchNeighborSet `json:"matchNeighborSet,omitempty"` + BGPConditions BGPConditions `json:"bgpConditions"` +} + +type MatchNeighborSet struct { + MatchSetOption string `json:"matchSetOption,omitempty"` + NeighborSet string `json:"neighborSet,omitempty"` +} + +type MatchPrefixSet struct { + MatchSetOption string `json:"matchSetOption,omitempty"` + PrefixSet string `json:"prefixSet,omitempty"` +} + +type BGPConditions struct { + AfiSafiIn []string `json:"afiSafiIn,omitempty"` + AsPathSet BGPAsPathSet `json:"matchAsPathSet,omitempty"` + AsPathLength BGPAsPathLength `json:"asPathLength,omitempty"` + CommunitySet BGPCommunitySet `json:"matchCommunitySet,omitempty"` + ExtCommunitySet BGPCommunitySet `json:"matchExtCommunitySet,omitempty"` + LargeCommunitySet BGPCommunitySet `json:"largeCommunitySet,omitempty"` + RouteType string `json:"routeType,omitempty"` + NextHopInList []string `json:"nextHopInList,omitempty"` + Rpki string `json:"rpki,omitempty"` +} + +type BGPAsPathLength struct { + Operator string `json:"operator,omitempty"` + Value int `json:"value,omitempty"` +} +type BGPAsPathSet struct { + AsPathSet string `json:"asPathSet,omitempty"` + MatchSetOptions string `json:"matchSetOptions,omitempty"` +} +type BGPCommunitySet struct { + CommunitySet string `json:"communitySet,omitempty"` + MatchSetOptions string `json:"matchSetOptions,omitempty"` +} diff --git a/pkg/crds/bgppolicydefinition/v1/zz_generated.deepcopy.go b/pkg/crds/bgppolicydefinition/v1/zz_generated.deepcopy.go new file mode 100644 index 0000000..723a936 --- /dev/null +++ b/pkg/crds/bgppolicydefinition/v1/zz_generated.deepcopy.go @@ -0,0 +1,352 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Actions) DeepCopyInto(out *Actions) { + *out = *in + in.BGPActions.DeepCopyInto(&out.BGPActions) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Actions. +func (in *Actions) DeepCopy() *Actions { + if in == nil { + return nil + } + out := new(Actions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPActions) DeepCopyInto(out *BGPActions) { + *out = *in + in.SetCommunity.DeepCopyInto(&out.SetCommunity) + in.SetExtCommunity.DeepCopyInto(&out.SetExtCommunity) + in.SetLargeCommunity.DeepCopyInto(&out.SetLargeCommunity) + out.SetAsPathPrepend = in.SetAsPathPrepend + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPActions. +func (in *BGPActions) DeepCopy() *BGPActions { + if in == nil { + return nil + } + out := new(BGPActions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPAsPathLength) DeepCopyInto(out *BGPAsPathLength) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPAsPathLength. +func (in *BGPAsPathLength) DeepCopy() *BGPAsPathLength { + if in == nil { + return nil + } + out := new(BGPAsPathLength) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPAsPathSet) DeepCopyInto(out *BGPAsPathSet) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPAsPathSet. +func (in *BGPAsPathSet) DeepCopy() *BGPAsPathSet { + if in == nil { + return nil + } + out := new(BGPAsPathSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPCommunitySet) DeepCopyInto(out *BGPCommunitySet) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPCommunitySet. +func (in *BGPCommunitySet) DeepCopy() *BGPCommunitySet { + if in == nil { + return nil + } + out := new(BGPCommunitySet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPConditions) DeepCopyInto(out *BGPConditions) { + *out = *in + if in.AfiSafiIn != nil { + in, out := &in.AfiSafiIn, &out.AfiSafiIn + *out = make([]string, len(*in)) + copy(*out, *in) + } + out.AsPathSet = in.AsPathSet + out.AsPathLength = in.AsPathLength + out.CommunitySet = in.CommunitySet + out.ExtCommunitySet = in.ExtCommunitySet + out.LargeCommunitySet = in.LargeCommunitySet + if in.NextHopInList != nil { + in, out := &in.NextHopInList, &out.NextHopInList + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPConditions. +func (in *BGPConditions) DeepCopy() *BGPConditions { + if in == nil { + return nil + } + out := new(BGPConditions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinition) DeepCopyInto(out *BGPPolicyDefinition) { + *out = *in + if in.Statement != nil { + in, out := &in.Statement, &out.Statement + *out = make([]Statement, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinition. +func (in *BGPPolicyDefinition) DeepCopy() *BGPPolicyDefinition { + if in == nil { + return nil + } + out := new(BGPPolicyDefinition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinitionService) DeepCopyInto(out *BGPPolicyDefinitionService) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinitionService. +func (in *BGPPolicyDefinitionService) DeepCopy() *BGPPolicyDefinitionService { + if in == nil { + return nil + } + out := new(BGPPolicyDefinitionService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BGPPolicyDefinitionService) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinitionServiceList) DeepCopyInto(out *BGPPolicyDefinitionServiceList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]*BGPPolicyDefinitionService, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(BGPPolicyDefinitionService) + (*in).DeepCopyInto(*out) + } + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinitionServiceList. +func (in *BGPPolicyDefinitionServiceList) DeepCopy() *BGPPolicyDefinitionServiceList { + if in == nil { + return nil + } + out := new(BGPPolicyDefinitionServiceList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *BGPPolicyDefinitionServiceList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BGPPolicyDefinitionServiceStatus) DeepCopyInto(out *BGPPolicyDefinitionServiceStatus) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BGPPolicyDefinitionServiceStatus. +func (in *BGPPolicyDefinitionServiceStatus) DeepCopy() *BGPPolicyDefinitionServiceStatus { + if in == nil { + return nil + } + out := new(BGPPolicyDefinitionServiceStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Conditions) DeepCopyInto(out *Conditions) { + *out = *in + out.PrefixSet = in.PrefixSet + out.NeighborSet = in.NeighborSet + in.BGPConditions.DeepCopyInto(&out.BGPConditions) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Conditions. +func (in *Conditions) DeepCopy() *Conditions { + if in == nil { + return nil + } + out := new(Conditions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MatchNeighborSet) DeepCopyInto(out *MatchNeighborSet) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchNeighborSet. +func (in *MatchNeighborSet) DeepCopy() *MatchNeighborSet { + if in == nil { + return nil + } + out := new(MatchNeighborSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MatchPrefixSet) DeepCopyInto(out *MatchPrefixSet) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MatchPrefixSet. +func (in *MatchPrefixSet) DeepCopy() *MatchPrefixSet { + if in == nil { + return nil + } + out := new(MatchPrefixSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SetAsPathPrepend) DeepCopyInto(out *SetAsPathPrepend) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SetAsPathPrepend. +func (in *SetAsPathPrepend) DeepCopy() *SetAsPathPrepend { + if in == nil { + return nil + } + out := new(SetAsPathPrepend) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SetCommunity) DeepCopyInto(out *SetCommunity) { + *out = *in + if in.SetCommunityMethod != nil { + in, out := &in.SetCommunityMethod, &out.SetCommunityMethod + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SetCommunity. +func (in *SetCommunity) DeepCopy() *SetCommunity { + if in == nil { + return nil + } + out := new(SetCommunity) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Statement) DeepCopyInto(out *Statement) { + *out = *in + in.Conditions.DeepCopyInto(&out.Conditions) + in.Actions.DeepCopyInto(&out.Actions) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Statement. +func (in *Statement) DeepCopy() *Statement { + if in == nil { + return nil + } + out := new(Statement) + in.DeepCopyInto(out) + return out +} From d45bcfb1c5b1ec7d1bace18beb570c51933fbe06 Mon Sep 17 00:00:00 2001 From: inhogog2 <75723069+inhogog2@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:35:58 +0900 Subject: [PATCH 2/4] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 03fcd97..b45b773 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,9 @@ Thereafter, the process of service creation remains the same as explained in pre Kube-loxilb provides Custom Resource Definition (CRD). Current the following operations are supported (which would be continually updated): - Add a BGP Peer - Delete a BGP Peer +- Add/Delete a BGP Policy + +For information on BGP Policy CRD, please refer [here.](https://github.com/loxilb-io/loxilbdocs/blob/main/docs/k8s_bgp_policy_crd.md) An example of CRD is stored in manifest/crds. Setting up a BGP Peer as an example is as follows: From 91f1f1e3f930eb703684f1a8c5e40b703c3ce3db Mon Sep 17 00:00:00 2001 From: inho Date: Thu, 4 Jul 2024 15:20:51 +0900 Subject: [PATCH 3/4] Added config option to enable CRD --- cmd/loxilb-agent/agent.go | 12 +++++++----- cmd/loxilb-agent/config.go | 2 ++ cmd/loxilb-agent/options.go | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/loxilb-agent/agent.go b/cmd/loxilb-agent/agent.go index fb9f25d..71a5604 100644 --- a/cmd/loxilb-agent/agent.go +++ b/cmd/loxilb-agent/agent.go @@ -254,13 +254,15 @@ func run(o *Options) error { }() log.StartLogFileNumberMonitor(stopCh) informerFactory.Start(stopCh) - crdInformerFactory.Start(stopCh) go lbManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) - go BgpPeerManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) - go BGPPolicyDefinedSetsManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) - go BGPPolicyDefinitionManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) - go BGPPolicyApplyManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + if o.config.EnableBGPCRDs { + crdInformerFactory.Start(stopCh) + go BgpPeerManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + go BGPPolicyDefinedSetsManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + go BGPPolicyDefinitionManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + go BGPPolicyApplyManager.Run(stopCh, loxiLBLiveCh, loxiLBPurgeCh, loxiLBSelMasterEvent) + } // Run gateway API managers if o.config.EnableGatewayAPI { diff --git a/cmd/loxilb-agent/config.go b/cmd/loxilb-agent/config.go index 4cdc8e0..d8f8b46 100644 --- a/cmd/loxilb-agent/config.go +++ b/cmd/loxilb-agent/config.go @@ -75,4 +75,6 @@ type AgentConfig struct { // Specify aws secondary IP. Used when configuring HA in AWS. // The specified private IP is assigned to the loxilb instance and is associated with EIP. PrivateCIDR string `yaml:"privateCIDR,omitempty"` + // enable Gateway API + EnableBGPCRDs bool `yaml:"enableBGPCRDs,omitempty"` } diff --git a/cmd/loxilb-agent/options.go b/cmd/loxilb-agent/options.go index 49a3856..5c33326 100644 --- a/cmd/loxilb-agent/options.go +++ b/cmd/loxilb-agent/options.go @@ -62,6 +62,7 @@ func (o *Options) addFlags(fs *pflag.FlagSet) { fs.StringVar(&secondaryCIDRs6, "externalSecondaryCIDRs6", secondaryCIDRs6, "External Secondary CIDR6 Range(s)") fs.StringVar(&o.config.LoxilbLoadBalancerClass, "loxilbLoadBalancerClass", o.config.LoxilbLoadBalancerClass, "Load-Balancer Class Name") fs.BoolVar(&o.config.EnableGatewayAPI, "gatewayAPI", false, "Enable gateway API managers") + fs.BoolVar(&o.config.EnableBGPCRDs, "enableBGPCRDs", false, "Enable BGP CRDs") fs.StringVar(&o.config.LoxilbGatewayClass, "loxilbGatewayClass", o.config.LoxilbGatewayClass, "GatewayClass manager Name") fs.Uint16Var(&o.config.SetBGP, "setBGP", o.config.SetBGP, "Use BGP routing") fs.Uint16Var(&o.config.ListenBGPPort, "listenBGPPort", o.config.ListenBGPPort, "Custom BGP listen port") From f841a440983f0dc14f0b7bf37af78faae54fce7b Mon Sep 17 00:00:00 2001 From: inhogog2 <75723069+inhogog2@users.noreply.github.com> Date: Thu, 4 Jul 2024 15:26:16 +0900 Subject: [PATCH 4/4] Update README.md --- README.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b45b773..f3d7632 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ wget https://github.com/loxilb-io/kube-loxilb/raw/main/manifest/ext-cluster/kube #- --monitor #- --setBGP=65100 #- --extBGPPeers=50.50.50.1:65101,51.51.51.1:65102 + #- --enableBGPCRDs #- --setRoles=0.0.0.0 #- --setLBMode=1 #- --setUniqueIP=false @@ -67,6 +68,7 @@ The arguments have the following meaning : | setLBMode | 0, 1, 2
0 - default (only DNAT, preserves source-IP)
1 - onearm (source IP is changed to load balancer’s interface IP)
2 - fullNAT (sourceIP is changed to virtual IP) | | setUniqueIP | Allocate unique service-IP per LB service (default : false) | | externalSecondaryCIDRs | Secondary CIDR or IPAddress ranges to allocate addresses from in case of multi-homing support | +| enableBGPCRDs | Enable BGP Policy and Peer CRDs | Many of the above flags and arguments can be overriden on a per-service basis based on loxilb specific annotation as mentioned below. @@ -211,7 +213,24 @@ For information on BGP Policy CRD, please refer [here.](https://github.com/loxil An example of CRD is stored in manifest/crds. Setting up a BGP Peer as an example is as follows: -1. Pre-Processing (Register kube-loxilb CRDs with K8s). Apply lbpeercrd.yaml as first step +1. Pre-Processing (Register kube-loxilb CRDs with K8s). + +First of all change the kube-loxilb.yaml arguments. It need to add `- --enableBGPCRDs` option. +``` + args: + - --loxiURL=http://12.12.12.1:11111 + - --externalCIDR=123.123.123.1/24 + #- --externalSecondaryCIDRs=124.124.124.1/24,125.125.125.1/24 + #- --externalCIDR6=3ffe::1/96 + #- --monitor + #- --setBGP=65100 + #- --extBGPPeers=50.50.50.1:65101,51.51.51.1:65102 + - --enableBGPCRDs + #- --setRoles=0.0.0.0 + #- --setLBMode=1 + #- --setUniqueIP=false +``` +And Apply lbpeercrd.yaml ``` kubectl apply -f manifest/crds/lbpeercrd.yaml ```